Build PostgreSQL (Dev) #562
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: Build PostgreSQL (Dev) | |
| on: | |
| workflow_dispatch: | |
| workflow_call: | |
| schedule: | |
| - cron: "00 05 * * *" | |
| jobs: | |
| get-versions: | |
| uses: ./.github/workflows/manifest.yml | |
| with: | |
| config-path: manifest.json | |
| build-postgresql-dev: | |
| needs: get-versions | |
| strategy: | |
| fail-fast: false | |
| env: | |
| POSTGRESQL-DEV_VERSION: ${{needs.get-versions.outputs.POSTGRESQL-DEV_VERSION}} | |
| runs-on: windows-latest | |
| steps: | |
| - uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Download dependencies | |
| uses: dawidd6/action-download-artifact@v7 | |
| with: | |
| workflow: bundle-deps.yml | |
| workflow_conclusion: success | |
| name: all-deps-win64 | |
| path: /builddeps | |
| if_no_artifact_found: fail | |
| # Copy libraries requires at runtime to installation directory. | |
| # | |
| # Do so before configuring / building postgres, otherwise we need to | |
| # duplicate knowledge about aberrant paths like "bin64". | |
| - name: Install Dependencies | |
| run: | | |
| mkdir \postgresql | |
| mkdir \postgresql\bin | |
| copy \builddeps\bin64\icuuc*.dll \postgresql\bin\ | |
| copy \builddeps\bin64\icudt*.dll \postgresql\bin\ | |
| copy \builddeps\bin64\icuin*.dll \postgresql\bin\ | |
| copy \builddeps\bin\libiconv-2.dll \postgresql\bin\ | |
| copy \builddeps\bin\libintl-8.dll \postgresql\bin\ | |
| copy \builddeps\bin\libxml2.dll \postgresql\bin\ | |
| copy \builddeps\bin\libxslt.dll \postgresql\bin\ | |
| copy \builddeps\bin\libssl-*-x64.dll \postgresql\bin\ | |
| copy \builddeps\bin\libcrypto-*-x64.dll \postgresql\bin\ | |
| copy \builddeps\bin\liblz4.dll \postgresql\bin\ | |
| copy \builddeps\bin\libzstd.dll \postgresql\bin\ | |
| copy \builddeps\bin\zlib1.dll \postgresql\bin\ | |
| - name: Add build deps to path | |
| run: | | |
| # so binaries and libraries can be found/run | |
| echo "/builddeps/bin" >> $ENV:GITHUB_PATH | |
| echo "/builddeps" >> $ENV:GITHUB_PATH | |
| echo "/postgresql/bin" >> $ENV:GITHUB_PATH | |
| # This is run as a privileged user. For some reason windows ends up | |
| # creating the directories owned by "Administrator", which causes | |
| # problems because when postgres drops privileges, it doesn't have | |
| # sufficient rights to access them anymore! | |
| # | |
| # I have pulled most of my hair out over the last hours. | |
| # | |
| # See also https://www.postgresql.org/message-id/20240707064046.blgjxoqiywunbebl%40awork3.anarazel.de | |
| - name: Work around privilege issue | |
| run: | | |
| icacls.exe . /inheritance:e /grant 'runneradmin:(OI)(CI)F' | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: postgres/postgres | |
| path: postgresql-${{ env.POSTGRESQL-DEV_VERSION }} | |
| ref: ${{ env.POSTGRESQL-DEV_VERSION }} | |
| - name: Source archive | |
| run: | | |
| cd postgresql-${{ env.POSTGRESQL-DEV_VERSION }} | |
| git archive --format=tar.gz -o ../postgresql-dev-${{ env.POSTGRESQL-DEV_VERSION }}.tar.gz --prefix=postgresql-dev-${{ env.POSTGRESQL-DEV_VERSION }}/ ${{ env.POSTGRESQL-DEV_VERSION }} | |
| - name: Configure | |
| run: | | |
| # Optimize path length for Meson 1.9.1+ to avoid Windows 32KB PATH limit | |
| # Move to short root path: \s\pg\b instead of long GitHub Actions path | |
| # This saves ~40 chars per path = ~8KB total with 200+ test directories | |
| New-Item -ItemType Directory -Force -Path \s | |
| Move-Item postgresql-${{ env.POSTGRESQL-DEV_VERSION }} \s\pg | |
| # Resolve builddeps path | |
| $deps = resolve-path /builddeps | |
| # Change to source directory | |
| cd \s\pg | |
| # can't enable some extra tests | |
| # - libpq_encryption -> fails for unknown reasons | |
| # - kerberos -> test not yet supported on windows | |
| # - load_balance -> would need to set up hostnames | |
| meson setup ` | |
| --prefix=\postgresql ` | |
| "--cmake-prefix-path=${deps}" ` | |
| "--pkg-config-path=${deps}\lib\pkgconfig" ` | |
| "-Dextra_include_dirs=${deps}\include" ` | |
| "-Dextra_lib_dirs=${deps}\lib,${deps}\lib\amd64" ` | |
| "-DPG_TEST_EXTRA=ldap ssl" ` | |
| -Duuid=ossp ` | |
| -Db_pch=true ` | |
| -Dgssapi=disabled ` | |
| -Dbuildtype=debugoptimized ` | |
| b | |
| - name: Build | |
| run: | | |
| cd \s\pg\b | |
| ninja -j 1 | |
| - name: Test - core | |
| run: | | |
| cd \s\pg\b | |
| # use unix socket to prevent port conflicts | |
| $env:PG_TEST_USE_UNIX_SOCKETS = 1; | |
| # otherwise pg_regress insists on creating the directory and does it | |
| # in a non-existing place, this needs to be fixed :( | |
| mkdir d:/sockets | |
| $env:PG_REGRESS_SOCK_DIR = "d:/sockets/" | |
| meson test --timeout-multiplier 2 --suite setup --suite recovery --suite subscription | |
| - name: Test - ecpg | |
| run: | | |
| cd \s\pg\b | |
| $env:PG_TEST_USE_UNIX_SOCKETS = 1; | |
| $env:PG_REGRESS_SOCK_DIR = "d:/sockets/" | |
| meson test --timeout-multiplier 2 --suite ecpg | |
| - name: Test - tools | |
| run: | | |
| cd \s\pg\b | |
| $env:PG_TEST_USE_UNIX_SOCKETS = 1; | |
| $env:PG_REGRESS_SOCK_DIR = "d:/sockets/" | |
| meson test --no-rebuild --timeout-multiplier 2 --suite scripts --suite pg_verifybackup --suite pg_rewind --suite pg_combinebackup --suite pg_upgrade --suite amcheck --suite pg_amcheck --suite pg_basebackup --suite pg_dump --suite authentication --suite libpq --suite commit_ts --suite pg_ctl --suite test_misc | |
| - name: Test - contrib & extensions | |
| run: | | |
| cd \s\pg\b | |
| $env:PG_TEST_USE_UNIX_SOCKETS = 1; | |
| $env:PG_REGRESS_SOCK_DIR = "d:/sockets/" | |
| meson test --no-rebuild --timeout-multiplier 2 --no-suite setup --no-suite recovery --no-suite subscription --no-suite ecpg --no-suite scripts --no-suite pg_verifybackup --no-suite pg_rewind --no-suite pg_combinebackup --no-suite pg_upgrade --no-suite amcheck --no-suite pg_amcheck --no-suite pg_basebackup --no-suite pg_dump --no-suite authentication --no-suite libpq --no-suite commit_ts --no-suite pg_ctl --no-suite test_misc | |
| - name: Upload Test Results | |
| if: ${{ !success() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test_logs | |
| path: | | |
| \s\pg\b\testrun\**\*.log | |
| \s\pg\b\testrun\**\regress_log_* | |
| \s\pg\b\testrun\**\*.diffs | |
| \s\pg\b\testrun\**\*.out | |
| \s\pg\b\meson-logs\testlog.txt | |
| - name: Install | |
| run: | | |
| cd \s\pg\b | |
| meson install --quiet | |
| - name: Upload Source | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| if-no-files-found: error | |
| name: postgresql-dev-${{ env.POSTGRESQL-DEV_VERSION }}-src | |
| path: postgresql-dev-${{ env.POSTGRESQL-DEV_VERSION }}.tar.gz | |
| - name: Upload Binaries | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| if-no-files-found: error | |
| name: postgresql-dev-${{ env.POSTGRESQL-DEV_VERSION }}-win64 | |
| path: /postgresql | |
| - name: Upload Meson Log | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| if-no-files-found: error | |
| name: meson_log | |
| path: \s\pg\b\meson-logs\meson-log.txt | |
| - name: Package Release Assets | |
| shell: pwsh | |
| run: | | |
| Compress-Archive /postgresql /postgresql-${{ env.POSTGRESQL-DEV_VERSION }}-latest.zip | |
| - name: Create Release | |
| uses: "marvinpinto/action-automatic-releases@latest" | |
| with: | |
| repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
| automatic_release_tag: "postgresql-${{ env.POSTGRESQL-DEV_VERSION }}-latest" | |
| title: "PostgreSQL ${{ env.POSTGRESQL-DEV_VERSION }}" | |
| files: | | |
| /postgresql-${{ env.POSTGRESQL-DEV_VERSION }}-latest.zip |