|
| 1 | +name: Test |
| 2 | + |
| 3 | +on: |
| 4 | +push: |
| 5 | +branches: |
| 6 | +- "**" |
| 7 | +pull_request: |
| 8 | +branches: |
| 9 | +- main |
| 10 | +# Allows you to run this workflow manually from the Actions tab |
| 11 | +workflow_dis: |
| 12 | + |
| 13 | +jobs: |
| 14 | +Test: |
| 15 | +strategy: |
| 16 | +matrix: |
| 17 | +# pg_version: [15] |
| 18 | +pg_version: [11, 12, 13, 14, 15] |
| 19 | +os: [ubuntu-22.04] |
| 20 | +# tests: [tap] |
| 21 | +tests: [tap, python] |
| 22 | +# test_mode: [normal, legacy, paranoia] |
| 23 | +test_mode: [normal, paranoia] |
| 24 | +exclude: |
| 25 | +- tests: tap |
| 26 | +test_mode: paranoia |
| 27 | +- tests: python |
| 28 | +test_mode: normal |
| 29 | +- tests: python |
| 30 | +test_mode: legacy |
| 31 | +fail-fast: false |
| 32 | +name: ${{ format('Ptrack ({0}, PostgreSQL {1}, {2} tests, {3} mode)', matrix.os, matrix.pg_version, matrix.tests, matrix.test_mode) }} |
| 33 | +container: |
| 34 | +image: ${{ format('ghcr.io/postgres-dev/{0}:1.0', matrix.os) }} |
| 35 | +env: |
| 36 | +PG_BRANCH: ${{ format('REL_{0}_STABLE', matrix.pg_version) }} |
| 37 | +PGDATA: $HOME/data |
| 38 | +TEST_MODE: ${{ matrix.test_mode }} |
| 39 | +options: --privileged |
| 40 | +steps: |
| 41 | +- name: Get Postgres sources |
| 42 | +uses: actions/checkout@v3 |
| 43 | +with: |
| 44 | +repository: postgres/postgres |
| 45 | +ref: ${{ format('REL_{0}_STABLE', matrix.pg_version) }} |
| 46 | +path: postgres |
| 47 | +- name: Get Ptrack sources |
| 48 | +uses: actions/checkout@v3 |
| 49 | +with: |
| 50 | +path: ptrack |
| 51 | +- name: Get Pg_probackup sources |
| 52 | +uses: actions/checkout@v3 |
| 53 | +with: |
| 54 | +repository: postgrespro/pg_probackup |
| 55 | +path: pg_probackup |
| 56 | +- name: Apply ptrack es |
| 57 | +run: make top_builddir=../postgres |
| 58 | +working-directory: ptrack |
| 59 | +- name: Install Postgres |
| 60 | +run: | |
| 61 | +make install-postgres top_builddir=$_WORKSPACE/postgres prefix=$HOME/pgsql && |
| 62 | +echo $HOME/pgsql/bin >> $_PATH |
| 63 | + working-directory: ptrack |
| 64 | +- name: Install Ptrack |
| 65 | +run: make install USE_PGXS=1 PG_CPPFLAGS=-coverage SHLIB_LINK=-coverage |
| 66 | +working-directory: ptrack |
| 67 | +- name: Install Pg_probackup |
| 68 | +run: make install-pg-probackup USE_PGXS=1 top_srcdir=../postgres |
| 69 | +working-directory: ptrack |
| 70 | +shell: bash {0} |
| 71 | +- name: Install additional packages |
| 72 | +run: | |
| 73 | +apt update && |
| 74 | +apt install -y python3-pip python3-six python3-pytest python3-pytest-xdist curl && |
| 75 | +pip3 install --no-input testgres |
| 76 | + # All steps have been so far executed by root but ptrack tests run from an |
| 77 | +# unprivileged user so change some permissions |
| 78 | +- name: Adjust the permissions of ptrack test folders |
| 79 | +run: | |
| 80 | +mkdir pg_probackup/tests/tmp_dirs |
| 81 | +chown -R "dev:" pg_probackup ptrack |
| 82 | + - name: Test |
| 83 | +run: make test-${{ matrix.tests }} USE_PGXS=1 |
| 84 | +working-directory: ptrack |
| 85 | +shell: runuser dev {0} |
| 86 | +- name: Collect coverage results |
| 87 | +run: make coverage |
| 88 | +working-directory: ptrack |
| 89 | +shell: runuser dev {0} |
| 90 | +- name: Upload coverage results to Codecov |
| 91 | +uses: codecov/codecov-action@v3 |
| 92 | +with: |
| 93 | +working-directory: ptrack |
| 94 | +runs-on: ubuntu-latest |
0 commit comments