From b7d0b7af81109eda4840f91dcfcecaa836f37e94 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 6 Jun 2025 19:37:31 +0200 Subject: [PATCH] Make Windows GitHub Actions workflow work Fix the workflow which was added in master to make it possible to use it, but which didn't work yet. Build SOCI under Windows using MSVC and run the tests that we can easily run in the GitHub Actions environment (to run the other ones we would need to set up PostgreSQL ODBC drivers and MySQL and SQL Server databases ourselves). --- .github/workflows/ci_msw.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_msw.yml b/.github/workflows/ci_msw.yml index b3701a29..89a1cbf8 100644 --- a/.github/workflows/ci_msw.yml +++ b/.github/workflows/ci_msw.yml @@ -1,5 +1,5 @@ # Continuous integration workflow for SOCI Windows builds. -name: Windows builds +name: Windows CI on: push: @@ -33,9 +33,11 @@ jobs: - lib_type: shared build_type: Release unity_build: true + - lib_type: static + build_type: Release runs-on: windows-2022 - name: MSVS ${{ matrix.lib_type }} ${{ matrix.build_type }} ${{ matrix.unity_build ? '(unity build)' : '' }} + name: MSVS ${{ matrix.lib_type }} ${{ matrix.build_type }} ${{ matrix.unity_build && '(unity build)' || '' }} env: SOCI_CI: true @@ -43,18 +45,31 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + submodules: 'recursive' - name: Set up MSVS environment uses: seanmiddleditch/gha-setup-vsdevenv@v5 + - name: Set up PostgreSQL + run: | + $pgService = Get-Service -Name postgresql* + Set-Service -InputObject $pgService -Status running -StartupType automatic + Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait + & $env:PGBIN\createdb soci_test + - name: Configure run: | - $soci_shared = "${{ matrix.lib_type == shared }}" ? "ON" : "OFF" + $soci_shared = "${{ matrix.lib_type }}" -eq "shared" ? "ON" : "OFF" $soci_enable_unity_build = "${{ matrix.unity_build }}" ? "ON" : "OFF" - cmake -S . -B build .. -GNinja ` + cmake -S . -B build -GNinja ` -DCMAKE_VERBOSE_MAKEFILE=ON ` -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ` -DCMAKE_UNITY_BUILD=$soci_enable_unity_build ` + -DWITH_BOOST=OFF ` + -DSOCI_DB2=OFF ` + -DSOCI_FIREBIRD=OFF ` + -DSOCI_ORACLE=OFF ` -DSOCI_SHARED=$soci_shared ` -DSOCI_ENABLE_WERROR=ON @@ -64,4 +79,4 @@ jobs: - name: Test run: | - ctest --test-dir build -V --timeout 300 --output-on-failure + ctest --test-dir build -V --timeout 300 --output-on-failure --exclude-regex "soci_mysql_test|soci_odbc_test_.*"