Windows #980
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Windows | |
| on: | |
| push: | |
| pull_request: | |
| schedule: | |
| - cron: | | |
| 0 0 * * * | |
| concurrency: | |
| group: ${{ github.head_ref || github.sha }}-${{ github.workflow }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| if: >- | |
| github.event_name != 'schedule' || | |
| (github.event_name == 'schedule' && | |
| github.repository_owner == 'pgroonga') | |
| name: PostgreSQL ${{ matrix.postgresql-version-major }} ${{ matrix.groonga-main == 'yes' && '+ Groonga main' || '' }} | |
| timeout-minutes: 30 | |
| runs-on: windows-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - postgresql-version-major: "14" | |
| postgresql-version: "14.20-1" | |
| - postgresql-version-major: "15" | |
| postgresql-version: "15.15-1" | |
| - postgresql-version-major: "16" | |
| postgresql-version: "16.11-1" | |
| - postgresql-version-major: "17" | |
| postgresql-version: "17.7-1" | |
| - postgresql-version-major: "18" | |
| postgresql-version: "18.1-1" | |
| - groonga-main: "yes" | |
| postgresql-version-major: "18" | |
| postgresql-version: "18.1-1" | |
| env: | |
| PGROONGA_BENCHMARK_GEMFILE: ${{ github.workspace }}\pgroonga-benchmark\Gemfile | |
| PGROONGA_TEST_DATA: "test-data" | |
| PGROONGA_TEST_ENCODING: "UTF-8" | |
| PGROONGA_TEST_USER: "pgroonga-test" | |
| steps: | |
| - name: Disable crash dialog | |
| run: | | |
| reg add "HKCU\SOFTWARE\Microsoft\Windows\Windows Error Reporting" ` | |
| /v DontShowUI ` | |
| /t REG_DWORD ` | |
| /d 1 ` | |
| /f | |
| - name: Use JST | |
| run: | | |
| Set-TimeZone -Id "Tokyo Standard Time" | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - name: Install Visual Studio | |
| if: | |
| matrix.visual-studio-package | |
| run: | | |
| choco install -y ${{ matrix.visual-studio-package }} | |
| - name: Prepare environments | |
| run: | | |
| Write-Output "VC_PREFIX=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC" | ` | |
| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| Write-Output "CCACHE_DIR=${{ github.workspace }}\ccache" | ` | |
| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| $ARTIFACT_ID = "postgresql-${{ matrix.postgresql-version-major }}-x64" | |
| if ("${{ matrix.groonga-main }}" -eq "yes") { | |
| $ARTIFACT_ID += "-groonga-main" | |
| } else { | |
| $ARTIFACT_ID = "release-${ARTIFACT_ID}" | |
| } | |
| Write-Output "ARTIFACT_ID=${ARTIFACT_ID}" | ` | |
| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Cache ccache | |
| uses: actions/cache@v5 | |
| with: | |
| path: ccache | |
| key: windows-msvc-${{ env.ARTIFACT_ID }}-ccache-${{ hashFiles('src/**') }} | |
| restore-keys: windows-msvc-${{ env.ARTIFACT_ID }}-ccache- | |
| - name: Prepare ccache | |
| run: | | |
| choco install ccache | |
| Get-Command ccache | |
| (Get-Command ccache).Source | |
| ccache --show-stats --verbose --version | |
| - name: Download PostgreSQL | |
| run: | | |
| cd .. | |
| $POSTGRESQL_ARCHIVE_NAME = ` | |
| "postgresql-${{ matrix.postgresql-version }}-windows-x64-binaries.zip" | |
| Invoke-WebRequest ` | |
| "https://get.enterprisedb.com/postgresql/$POSTGRESQL_ARCHIVE_NAME" ` | |
| -OutFile $POSTGRESQL_ARCHIVE_NAME | |
| Expand-Archive -Path $POSTGRESQL_ARCHIVE_NAME -DestinationPath . | |
| - name: Download Groonga | |
| run: | | |
| if ("${{ matrix.groonga-main }}" -eq "yes") { | |
| git clone --depth 1 ` | |
| https://github.com/groonga/groonga.git ` | |
| vendor\groonga | |
| cd vendor\groonga | |
| git submodule update --init | |
| cd vendor | |
| ruby download_groonga_normalizer_mysql.rb | |
| ruby download_lz4.rb | |
| ruby download_mecab.rb | |
| ruby download_rapidjson.rb | |
| ruby download_xxhash.rb | |
| ruby download.rb | |
| } else { | |
| Invoke-WebRequest ` | |
| https://packages.groonga.org/source/groonga/groonga-latest.zip ` | |
| -OutFile groonga-latest.zip | |
| Expand-Archive -Path groonga-latest.zip -DestinationPath . | |
| rm groonga-latest.zip | |
| mv groonga-* vendor\groonga | |
| } | |
| - name: Configure Groonga | |
| shell: cmd | |
| run: | | |
| call "%VC_PREFIX%\Auxiliary\Build\vcvars64.bat" | |
| cmake ^ | |
| -B vendor\groonga.build ^ | |
| -G Ninja ^ | |
| -S vendor\groonga ^ | |
| -DCMAKE_BUILD_TYPE=RelWithDebInfo ^ | |
| -DCMAKE_INSTALL_PREFIX="vendor\groonga.install" ^ | |
| -DGRN_WITH_LZ4=bundled ^ | |
| -DGRN_WITH_MECAB=bundled ^ | |
| -DGRN_WITH_MESSAGE_PACK=bundled ^ | |
| -DGRN_WITH_MRUBY=yes ^ | |
| -DGRN_WITH_RAPIDJSON=bundled ^ | |
| -DGRN_WITH_XXHASH=bundled ^ | |
| -DGRN_WITH_ZSTD=bundled | |
| - name: Build Groonga | |
| shell: cmd | |
| run: | | |
| call "%VC_PREFIX%\Auxiliary\Build\vcvars64.bat" | |
| cmake --build vendor\groonga.build | |
| - name: Install Groonga | |
| shell: cmd | |
| run: | | |
| call "%VC_PREFIX%\Auxiliary\Build\vcvars64.bat" | |
| cmake --install vendor\groonga.build | |
| - name: Add Groonga to PATH | |
| run: | | |
| $GROONGA_BIN = "$(Get-Location)\vendor\groonga.install\bin" | |
| $env:PATH = "$GROONGA_BIN;$env:PATH" | |
| echo "PATH=$env:PATH" | ` | |
| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Install Build Tools | |
| run: | | |
| choco install meson | |
| $env:PATH = "C:\Program Files\Meson;$env:PATH" | |
| echo "PATH=$env:PATH" | ` | |
| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| Get-Command meson | |
| (Get-Command meson).Source | |
| meson --version | |
| - name: Install MessagePack | |
| run: | | |
| vcpkg install msgpack-c:x64-windows | |
| $MSGPACK_INSTALL_DIR = "C:\vcpkg\installed\x64-windows" | |
| $env:CMAKE_PREFIX_PATH = "$MSGPACK_INSTALL_DIR;$env:CMAKE_PREFIX_PATH" | |
| Write-Output "CMAKE_PREFIX_PATH=$env:CMAKE_PREFIX_PATH;" | ` | |
| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Add Groonga to CMAKE_PREFIX_PATH | |
| run: | | |
| $GROONGA_INSTALL_DIR = "$(Get-Location)\vendor\groonga.install" | |
| $env:CMAKE_PREFIX_PATH = "$GROONGA_INSTALL_DIR;$env:CMAKE_PREFIX_PATH" | |
| Write-Output "CMAKE_PREFIX_PATH=$env:CMAKE_PREFIX_PATH" | ` | |
| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Prepare pg_regress for PostgreSQL 17+ | |
| if: ${{ matrix.postgresql-version-major >= 17 }} | |
| run: | | |
| # pg_regress.exe depends on libpq.dll and libpq.dll exists | |
| # in pgsql\bin\. We add the bin directory to PATH so that | |
| # pg_regress.exe can find libpq.dll. | |
| # This must run BEFORE meson setup so the dependency is resolved. | |
| $PGSQL_BIN = "$(Get-Location)\..\pgsql\bin" | |
| $env:PATH = "$PGSQL_BIN;$env:PATH" | |
| echo "PATH=$env:PATH" | ` | |
| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Configure PGroonga | |
| shell: cmd | |
| run: | | |
| call "%VC_PREFIX%\Auxiliary\Build\vcvars64.bat" | |
| for %%I in (%CD%\..) do set "PARENT_DIR=%%~fI" | |
| meson setup ^ | |
| --wipe ^ | |
| ..\pgroonga.build ^ | |
| --prefix="%PARENT_DIR%\pgsql" ^ | |
| -Dpg_config="%PARENT_DIR%\pgsql\bin\pg_config.exe" | |
| - name: Build PGroonga | |
| shell: cmd | |
| run: | | |
| call "%VC_PREFIX%\Auxiliary\Build\vcvars64.bat" | |
| meson compile -C ..\pgroonga.build | |
| - name: Install PGroonga | |
| shell: cmd | |
| run: | | |
| call "%VC_PREFIX%\Auxiliary\Build\vcvars64.bat" | |
| meson install -C ..\pgroonga.build | |
| # Upload artifacts | |
| - name: Package | |
| run: | | |
| New-Item artifacts -ItemType Directory | |
| Compress-Archive ` | |
| -Path ..\pgsql\* ` | |
| -DestinationPath artifacts\pgroonga-${{ matrix.postgresql-version-major }}-windows-x64.zip | |
| Write-Output "ARTIFACT_BASENAME=$((Get-Item artifacts\*.zip).name)" | ` | |
| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: ${{ env.ARTIFACT_ID }} | |
| path: artifacts | |
| # Test | |
| - name: Run PostgreSQL for test | |
| run: | | |
| ..\pgsql\bin\initdb ` | |
| --encoding=${Env:PGROONGA_TEST_ENCODING} ` | |
| --locale=C ` | |
| --pgdata=${Env:PGROONGA_TEST_DATA} ` | |
| --username=${Env:PGROONGA_TEST_USER} | |
| Add-Content ` | |
| -Path ${Env:PGROONGA_TEST_DATA}\postgresql.conf ` | |
| -Value "enable_partitionwise_join = on","max_prepared_transactions = 1","random_page_cost = 0" ` | |
| -Encoding utf8 | |
| ..\pgsql\bin\pg_ctl start ` | |
| --pgdata=${Env:PGROONGA_TEST_DATA} | |
| - name: Prepare test files | |
| run: | | |
| # TODO: Remove me when Groonga bundles libstemmer | |
| Remove-Item sql\full-text-search\text\options\token-filters\custom.sql | |
| # Reduce tests to reduce test time | |
| Remove-Item sql\compatibility -Recurse -Force | |
| - name: Run regression test | |
| shell: cmd | |
| run: | | |
| call "%VC_PREFIX%\Auxiliary\Build\vcvars64.bat" | |
| set PGUSER=%PGROONGA_TEST_USER% | |
| meson test -C ..\pgroonga.build -v | |
| - name: Shutdown PostgreSQL for test | |
| if: always() | |
| run: | | |
| ..\pgsql\bin\pg_ctl stop ` | |
| --pgdata=${Env:PGROONGA_TEST_DATA} | |
| - name: Show diff | |
| if: failure() | |
| run: | | |
| Get-Content ..\pgroonga.build\regression.diffs | |
| - uses: actions/checkout@v6 | |
| with: | |
| repository: pgroonga/benchmark | |
| path: pgroonga-benchmark | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ruby | |
| bundler-cache: true | |
| - name: Run unit test | |
| run: | | |
| $Env:PATH = "$(Get-Location)\..\pgsql\bin;${Env:PATH}" | |
| # TODO: Remove me when we fix test failure on Windows | |
| Remove-Item test\test-streaming-replication.rb | |
| bundle exec ruby ` | |
| -I${{ github.workspace }}\pgroonga-benchmark\lib ` | |
| test\run-test.rb |