Add pgrx test and reorganize PGXS tests #271
Workflow file for this run
This file contains 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: CI/CD | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '0 14 3 * *' # Monthly at 2pm on the 3rd | |
jobs: | |
pgxs: | |
name: π PGXS on PostgreSQL ${{ matrix.pg }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
pg: [16] #, 15, 14, 13, 12, 11, 10, 9.6, 9.5, 9.4, 9.3, 9.2, 9.1, '9.0', 8.4, 8.3, 8.2] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build Image | |
run: docker build -t pgxn-tools-test . | |
- name: Test PGXS as root | |
run: "docker run -w /repo --rm --volume \"$(pwd):/repo\" pgxn-tools-test ./test/pgxs/runtest.sh ${{ matrix.pg }} && git clean -dfx" | |
- name: Test PGXS as nobody | |
run: "docker run -w /repo --rm --volume \"$(pwd):/repo\" -u nobody pgxn-tools-test ./test/pgxs/runtest.sh ${{ matrix.pg }} && git clean -dfx" | |
- name: Test PGXS as custom user | |
run: "docker run -w /repo --rm --volume \"$(pwd):/repo\" -e AS_USER=pgxn_worker pgxn-tools-test ./test/pgxs/runtest.sh ${{ matrix.pg }} && git clean -dfx" | |
pgrx: | |
name: π¦ pgrx on PostgreSQL ${{ matrix.pg }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
pg: [16] #, 15, 14, 13, 12, 11] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build Image | |
run: docker build -t pgxn-tools-test . | |
- name: Test pgrx as root | |
run: "docker run -w /repo --rm --volume \"$(pwd):/repo\" pgxn-tools-test ./test/pgrx/runtest.sh ${{ matrix.pg }} && git clean -dfx" | |
# - name: Test pgrx as nobody | |
# run: "docker run -w /repo --rm --volume \"$(pwd):/repo\" -u nobody pgxn-tools-test ./test/pgrx/runtest.sh ${{ matrix.pg }} && git clean -dfx" | |
- name: Test pgrx as custom user | |
run: "docker run -w /repo --rm --volume \"$(pwd):/repo\" -e AS_USER=pgxn_worker pgxn-tools-test ./test/pgrx/runtest.sh ${{ matrix.pg }} && git clean -dfx" | |
bundle: | |
name: ${{ matrix.util.icon }} Bundle with ${{ matrix.util.name }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
util: | |
- { icon: π·οΈ, name: git, dir: "", run: ./test/pgxs } | |
- { icon: π€, name: zip, dir: /test, run: ./pgxs } | |
env: { PG_VERSION: 16 } | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build Image | |
run: docker build -t pgxn-tools-test . | |
- name: Test ${{ matrix.util.name }} | |
run: "docker run -w /repo --rm --volume \"$(pwd)${{ matrix.util.dir }}:/repo\" pgxn-tools-test ${{ matrix.util.run }}/runtest.sh ${{ env.PG_VERSION }} ${{ matrix.util[1] }}" | |
- name: Test ${{ matrix.util.name }} with extra file | |
run: "docker run -w /repo --rm --volume \"$(pwd)${{ matrix.util.dir }}:/repo\" pgxn-tools-test ${{ matrix.util.run }}/runtest.sh ${{ env.PG_VERSION }} ${{ matrix.util[1] }} yes" | |
- name: Test ${{ matrix.util.name }} with archive-all | |
env: { GIT_ARCHIVE_CMD: archive-all } | |
run: "docker run -w /repo --rm --volume \"$(pwd)${{ matrix.util.dir }}:/repo\" pgxn-tools-test ${{ matrix.util.run }}/runtest.sh ${{ env.PG_VERSION }} ${{ matrix.util[1] }}" | |
- name: Test NO_CLUSTER | |
run: "docker run -w /repo -e NO_CLUSTER=1 --rm --volume \"$(pwd)${{ matrix.util.dir }}:/repo\" pgxn-tools-test ${{ matrix.util.run }}/no_cluster_test.sh ${{ env.PG_VERSION }}" | |
publish: | |
# Publish for a tag starting with v. | |
name: Push to Docker Hub | |
needs: [pgxs, pgrx, bundle] | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: pgxn/pgxn-tools | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern=v{{major}} | |
type=raw,value=bookworm | |
labels: | | |
org.opencontainers.image.title=PGXN Tools | |
org.opencontainers.image.licenses=PostgreSQL | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and Push | |
# https://github.com/marketplace/actions/build-and-push-docker-images | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |