Build test pipelines on every push (#13)

This commit is contained in:
Dr. Patrick Urbanke (劉自成)
2025-05-25 23:01:34 +02:00
committed by GitHub
parent 38e9b6de82
commit 97cce29ae6
6 changed files with 82 additions and 157 deletions
@@ -1,6 +1,6 @@
name: linux-postgres-cxx20
name: linux-cxx20
on: [push, pull_request]
on: [push]
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
@@ -13,16 +13,37 @@ jobs:
include:
- compiler: llvm
compiler-version: 16
db: postgres
- compiler: llvm
compiler-version: 18
db: postgres
- compiler: gcc
compiler-version: 11
additional-dep: "g++-11"
db: postgres
- compiler: gcc
compiler-version: 12
db: postgres
- compiler: gcc
compiler-version: 14
name: "${{ github.job }} (${{ matrix.compiler }}-${{ matrix.compiler-version }})"
db: postgres
- compiler: llvm
compiler-version: 16
db: sqlite
- compiler: llvm
compiler-version: 18
db: sqlite
- compiler: gcc
compiler-version: 11
additional-dep: "g++-11"
db: sqlite
- compiler: gcc
compiler-version: 12
db: sqlite
- compiler: gcc
compiler-version: 14
db: sqlite
name: "${{ github.job }} (${{ matrix.compiler }}-${{ matrix.compiler-version }}-${{ matrix.db }})"
runs-on: ubuntu-latest
steps:
- name: Checkout
@@ -48,6 +69,7 @@ jobs:
sudo apt update
sudo apt install -y ninja-build ${{ matrix.additional-dep }}
- name: Compile
if: matrix.db == 'postgres'
run: |
if [[ "${{ matrix.compiler }}" == "llvm" ]]; then
export CC=clang-${{ matrix.compiler-version }}
@@ -61,7 +83,23 @@ jobs:
$CXX --version
cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=20 -DSQLGEN_BUILD_TESTS=ON -DSQLGEN_SQLITE3=OFF
cmake --build build
- name: Compile
if: matrix.db == 'sqlite'
run: |
if [[ "${{ matrix.compiler }}" == "llvm" ]]; then
export CC=clang-${{ matrix.compiler-version }}
export CXX=clang++-${{ matrix.compiler-version }}
elif [[ "${{ matrix.compiler }}" == "gcc" ]]; then
export CC=gcc-${{ matrix.compiler-version }}
export CXX=g++-${{ matrix.compiler-version }}
fi
sudo ln -s $(which ccache) /usr/local/bin/$CC
sudo ln -s $(which ccache) /usr/local/bin/$CXX
$CXX --version
cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=20 -DSQLGEN_BUILD_TESTS=ON -DSQLGEN_POSTGRES=OFF
cmake --build build
- name: Set up postgres
if: matrix.db == 'postgres'
run: |
sudo systemctl start postgresql.service
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'password';"
-66
View File
@@ -1,66 +0,0 @@
name: linux-sqlite-cxx20
on: [push, pull_request]
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
jobs:
linux:
strategy:
fail-fast: false
matrix:
include:
- compiler: llvm
compiler-version: 16
- compiler: llvm
compiler-version: 18
- compiler: gcc
compiler-version: 11
additional-dep: "g++-11"
- compiler: gcc
compiler-version: 12
- compiler: gcc
compiler-version: 14
name: "${{ github.job }} (${{ matrix.compiler }}-${{ matrix.compiler-version }})"
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: "${{ github.job }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}"
max-size: "2G"
- name: Run vcpkg
uses: lukka/run-vcpkg@v11
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y ninja-build ${{ matrix.additional-dep }}
- name: Compile
run: |
if [[ "${{ matrix.compiler }}" == "llvm" ]]; then
export CC=clang-${{ matrix.compiler-version }}
export CXX=clang++-${{ matrix.compiler-version }}
elif [[ "${{ matrix.compiler }}" == "gcc" ]]; then
export CC=gcc-${{ matrix.compiler-version }}
export CXX=g++-${{ matrix.compiler-version }}
fi
sudo ln -s $(which ccache) /usr/local/bin/$CC
sudo ln -s $(which ccache) /usr/local/bin/$CXX
$CXX --version
cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=20 -DSQLGEN_BUILD_TESTS=ON -DSQLGEN_POSTGRES=OFF
cmake --build build -j4
- name: Run tests
run: |
ctest --test-dir build --output-on-failure
@@ -1,6 +1,6 @@
name: macos-postgres-cxx20
name: macos-cxx20
on: [push, pull_request]
on: [push]
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
@@ -10,7 +10,16 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ["macos-latest", "macos-13"]
include:
- os: "macos-latest"
db: postgres
- os: "macos-latest"
db: sqlite
- os: "macos-13"
db: postgres
- os: "macos-13"
db: sqlite
name: "${{ github.job }} (${{ matrix.os }}-${{ matrix.db }})"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
@@ -36,6 +45,7 @@ jobs:
run: brew install ninja autoconf bison flex
if: matrix.os == 'macos-latest'
- name: Compile
if: matrix.db == 'postgres'
env:
CC: clang
CXX: clang++
@@ -47,6 +57,19 @@ jobs:
$CXX --version
cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=20 -DSQLGEN_BUILD_TESTS=ON -DSQLGEN_SQLITE3=OFF -DSQLGEN_BUILD_DRY_TESTS_ONLY=ON
cmake --build build -j 4
- name: Compile
if: matrix.db == 'sqlite'
env:
CC: clang
CXX: clang++
run: |
if [[ "${{ matrix.os == 'macos-latest' }}" == "true" ]]; then
export VCPKG_FORCE_SYSTEM_BINARIES=arm
export CMAKE_GENERATOR=Ninja
fi
$CXX --version
cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=20 -DSQLGEN_BUILD_TESTS=ON -DSQLGEN_POSTGRES=OFF
cmake --build build -j 4
- name: Run tests
run: |
ctest --test-dir build --output-on-failure
-52
View File
@@ -1,52 +0,0 @@
name: macos-sqlite-cxx20
on: [push, pull_request]
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
jobs:
macos-clang:
strategy:
fail-fast: false
matrix:
os: ["macos-latest", "macos-13"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: "${{ github.job }}-${{ matrix.os }}"
max-size: "2G"
create-symlink: true
- name: Run vcpkg
uses: lukka/run-vcpkg@v11
- name: Install ninja
run: brew install ninja
if: matrix.os == 'macos-latest'
- name: Compile
env:
CC: clang
CXX: clang++
run: |
if [[ "${{ matrix.os == 'macos-latest' }}" == "true" ]]; then
export VCPKG_FORCE_SYSTEM_BINARIES=arm
export CMAKE_GENERATOR=Ninja
fi
$CXX --version
cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=20 -DSQLGEN_BUILD_TESTS=ON -DSQLGEN_POSTGRES=OFF
cmake --build build -j 4
- name: Run tests
run: |
ctest --test-dir build --output-on-failure
@@ -1,12 +1,19 @@
name: windows-postgres-cxx20
name: windows-cxx20
on: [push, pull_request]
on: [push]
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
jobs:
windows-msvc:
strategy:
fail-fast: false
matrix:
include:
- db: postgres
- db: sqlite
name: "(windows-${{ matrix.db }})"
runs-on: windows-latest
steps:
- name: Checkout
@@ -23,9 +30,15 @@ jobs:
- uses: ilammy/msvc-dev-cmd@v1
- uses: lukka/run-vcpkg@v11
- name: Compile
if: matrix.db == 'postgres'
run: |
cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=20 -DSQLGEN_BUILD_TESTS=ON -DSQLGEN_SQLITE3=OFF -DSQLGEN_BUILD_DRY_TESTS_ONLY=ON
cmake --build build --config Release -j4
- name: Compile
if: matrix.db == 'sqlite'
run: |
cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=20 -DSQLGEN_BUILD_TESTS=ON -DSQLGEN_POSTGRES=OFF
cmake --build build --config Release -j4
- name: Run tests
run: |
ctest --test-dir build --output-on-failure
@@ -1,31 +0,0 @@
name: windows-sqlite-cxx20
on: [push, pull_request]
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
jobs:
windows-msvc:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- uses: ilammy/msvc-dev-cmd@v1
- uses: lukka/run-vcpkg@v11
- name: Compile
run: |
cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=20 -DSQLGEN_BUILD_TESTS=ON -DSQLGEN_POSTGRES=OFF
cmake --build build --config Release -j4
- name: Run tests
run: |
ctest --test-dir build --output-on-failure