From 97cce29ae67ff87855c352726107f7e1e3800b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=2E=20Patrick=20Urbanke=20=28=E5=8A=89=E8=87=AA=E6=88=90?= =?UTF-8?q?=29?= Date: Sun, 25 May 2025 23:01:34 +0200 Subject: [PATCH] Build test pipelines on every push (#13) --- ...x-postgres-cxx20.yaml => linux-cxx20.yaml} | 44 ++++++++++++- .github/workflows/linux-sqlite-cxx20.yaml | 66 ------------------- ...s-postgres-cxx20.yaml => macos-cxx20.yaml} | 29 +++++++- .github/workflows/macos-sqlite-cxx20.yaml | 52 --------------- ...postgres-cxx20.yaml => windows-cxx20.yaml} | 17 ++++- .github/workflows/windows-sqlite-cxx20.yaml | 31 --------- 6 files changed, 82 insertions(+), 157 deletions(-) rename .github/workflows/{linux-postgres-cxx20.yaml => linux-cxx20.yaml} (62%) delete mode 100644 .github/workflows/linux-sqlite-cxx20.yaml rename .github/workflows/{macos-postgres-cxx20.yaml => macos-cxx20.yaml} (65%) delete mode 100644 .github/workflows/macos-sqlite-cxx20.yaml rename .github/workflows/{windows-postgres-cxx20.yaml => windows-cxx20.yaml} (67%) delete mode 100644 .github/workflows/windows-sqlite-cxx20.yaml diff --git a/.github/workflows/linux-postgres-cxx20.yaml b/.github/workflows/linux-cxx20.yaml similarity index 62% rename from .github/workflows/linux-postgres-cxx20.yaml rename to .github/workflows/linux-cxx20.yaml index 2a5c28e..558b297 100644 --- a/.github/workflows/linux-postgres-cxx20.yaml +++ b/.github/workflows/linux-cxx20.yaml @@ -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';" diff --git a/.github/workflows/linux-sqlite-cxx20.yaml b/.github/workflows/linux-sqlite-cxx20.yaml deleted file mode 100644 index 5ef9ddd..0000000 --- a/.github/workflows/linux-sqlite-cxx20.yaml +++ /dev/null @@ -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 diff --git a/.github/workflows/macos-postgres-cxx20.yaml b/.github/workflows/macos-cxx20.yaml similarity index 65% rename from .github/workflows/macos-postgres-cxx20.yaml rename to .github/workflows/macos-cxx20.yaml index ff85ced..e62496a 100644 --- a/.github/workflows/macos-postgres-cxx20.yaml +++ b/.github/workflows/macos-cxx20.yaml @@ -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 diff --git a/.github/workflows/macos-sqlite-cxx20.yaml b/.github/workflows/macos-sqlite-cxx20.yaml deleted file mode 100644 index 6143850..0000000 --- a/.github/workflows/macos-sqlite-cxx20.yaml +++ /dev/null @@ -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 diff --git a/.github/workflows/windows-postgres-cxx20.yaml b/.github/workflows/windows-cxx20.yaml similarity index 67% rename from .github/workflows/windows-postgres-cxx20.yaml rename to .github/workflows/windows-cxx20.yaml index bdb3298..266223c 100644 --- a/.github/workflows/windows-postgres-cxx20.yaml +++ b/.github/workflows/windows-cxx20.yaml @@ -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 diff --git a/.github/workflows/windows-sqlite-cxx20.yaml b/.github/workflows/windows-sqlite-cxx20.yaml deleted file mode 100644 index 0be215a..0000000 --- a/.github/workflows/windows-sqlite-cxx20.yaml +++ /dev/null @@ -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