|
| 1 | +name: Build Probackup |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "**" |
| 7 | + # Runs triggered by pull requests are disabled to prevent executing potentially unsafe code from public pull requests |
| 8 | + # pull_request: |
| 9 | + # branches: |
| 10 | + # - main |
| 11 | + |
| 12 | + # Allows you to run this workflow manually from the Actions tab |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +jobs: |
| 16 | + |
| 17 | + build-win2019: |
| 18 | + |
| 19 | + runs-on: |
| 20 | + - windows-2019 |
| 21 | + |
| 22 | + env: |
| 23 | + zlib_dir: C:\dep\zlib |
| 24 | + |
| 25 | + steps: |
| 26 | + |
| 27 | + - uses: actions/checkout@v2 |
| 28 | + |
| 29 | + - name: Install pacman packages |
| 30 | + run: | |
| 31 | + $env:PATH += ";C:\msys64\usr\bin" |
| 32 | + pacman -S --noconfirm --needed bison flex |
| 33 | +
|
| 34 | + - name: Make zlib |
| 35 | + run: | |
| 36 | + git clone -b v1.2.11 --depth 1 https://github.com/madler/zlib.git |
| 37 | + cd zlib |
| 38 | + cmake -DCMAKE_INSTALL_PREFIX:PATH=C:\dep\zlib -G "Visual Studio 16 2019" . |
| 39 | + cmake --build . --config Release --target ALL_BUILD |
| 40 | + cmake --build . --config Release --target INSTALL |
| 41 | + copy C:\dep\zlib\lib\zlibstatic.lib C:\dep\zlib\lib\zdll.lib |
| 42 | + copy C:\dep\zlib\bin\zlib.dll C:\dep\zlib\lib |
| 43 | +
|
| 44 | + - name: Get Postgres sources |
| 45 | + run: git clone -b REL_14_STABLE https://github.com/postgres/postgres.git |
| 46 | + |
| 47 | + # Copy ptrack to contrib to build the ptrack extension |
| 48 | + # Convert line breaks in the patch file to LF otherwise the patch doesn't apply |
| 49 | + - name: Get Ptrack sources |
| 50 | + run: | |
| 51 | + git clone -b master --depth 1 https://github.com/postgrespro/ptrack.git |
| 52 | + Copy-Item -Path ptrack -Destination postgres\contrib -Recurse |
| 53 | + (Get-Content ptrack\patches\REL_14_STABLE-ptrack-core.diff -Raw).Replace("`r`n","`n") | Set-Content ptrack\patches\REL_14_STABLE-ptrack-core.diff -Force -NoNewline |
| 54 | + cd postgres |
| 55 | + git apply -3 ../ptrack/patches/REL_14_STABLE-ptrack-core.diff |
| 56 | +
|
| 57 | + - name: Build Postgres |
| 58 | + run: | |
| 59 | + $env:PATH += ";C:\msys64\usr\bin" |
| 60 | + cd postgres\src\tools\msvc |
| 61 | + (Get-Content config_default.pl) -Replace "zlib *=>(.*?)(?=,? *#)", "zlib => '${{ env.zlib_dir }}'" | Set-Content config.pl |
| 62 | + cmd.exe /s /c "`"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat`" amd64 && .\build.bat" |
| 63 | +
|
| 64 | + - name: Build Probackup |
| 65 | + run: cmd.exe /s /c "`"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat`" amd64 && perl .\gen_probackup_project.pl `"${{ github.workspace }}`"\postgres" |
| 66 | + |
| 67 | + - name: Install Postgres |
| 68 | + run: | |
| 69 | + cd postgres |
| 70 | + src\tools\msvc\install.bat postgres_install |
| 71 | +
|
| 72 | + - name: Install Testgres |
| 73 | + run: | |
| 74 | + git clone -b no-port-for --single-branch --depth 1 https://github.com/postgrespro/testgres.git |
| 75 | + cd testgres |
| 76 | + python setup.py install |
| 77 | +
|
| 78 | + # Grant the Github runner user full control of the workspace for initdb to successfully process the data folder |
| 79 | + - name: Test Probackup |
| 80 | + run: | |
| 81 | + icacls.exe "${{ github.workspace }}" /grant "${env:USERNAME}:(OI)(CI)F" |
| 82 | + $env:PATH += ";${{ github.workspace }}\postgres\postgres_install\lib;${{ env.zlib_dir }}\lib" |
| 83 | + $Env:LC_MESSAGES = "English" |
| 84 | + $Env:PG_CONFIG = "${{ github.workspace }}\postgres\postgres_install\bin\pg_config.exe" |
| 85 | + $Env:PGPROBACKUPBIN = "${{ github.workspace }}\postgres\Release\pg_probackup\pg_probackup.exe" |
| 86 | + $Env:PG_PROBACKUP_PTRACK = "ON" |
| 87 | + If (!$Env:MODE -Or $Env:MODE -Eq "basic") { |
| 88 | + $Env:PG_PROBACKUP_TEST_BASIC = "ON" |
| 89 | + python -m unittest -v tests |
| 90 | + python -m unittest -v tests.init |
| 91 | + } else { |
| 92 | + python -m unittest -v tests.$Env:MODE |
| 93 | + } |
| 94 | +
|
0 commit comments