Skip to content

Commit

Permalink
feat: Support auto revisions
Browse files Browse the repository at this point in the history
  • Loading branch information
palmerj committed Nov 7, 2024
1 parent 3a508cd commit 0b7d661
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 3 deletions.
155 changes: 155 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,158 @@ jobs:
name: PostgreSQL ${{ matrix.pg }} packages for Ubuntu ${{ matrix.release }}
path: 'build-area/*.deb'
if: failure()

test-source-upgrade:
name: Test PostgreSQL ${{ matrix.pg }} source upgrade on Ubuntu ${{ matrix.release }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
pg: ['11', '12', '13', '14']
release: [20.04]
steps:
- name: Check out repository
uses: actions/[email protected]

- name: Build Docker container
run: docker build --build-arg=RELEASE=${{ matrix.release }} --tag=tester .

- name: Upgrade from source
run: docker run --rm tester ./test/ci/source-upgrade.bash ${{ matrix.pg }}

test-source-upgrade-using-loader:
name:
Test PostgreSQL ${{ matrix.pg }} package upgrade using loader on Ubuntu ${{ matrix.release }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
pg: ['11', '12', '13', '14'] # TODO: '15'
release: [20.04]
steps:
- name: Check out repository
uses: actions/[email protected]

- name: Build Docker container
run: docker build --build-arg=RELEASE=${{ matrix.release }} --tag=tester .

- name: Upgrade from latest release
run: docker run --rm tester ./test/ci/source-upgrade-using-loader.bash ${{ matrix.pg }}

test-source-upgrade-using-loader-without-extension-support:
name:
Test PostgreSQL ${{ matrix.pg }} package upgrade using loader without extension support on
Ubuntu ${{ matrix.release }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
pg: ['11', '12', '13', '14'] # TODO: '15'
release: [20.04]
steps:
- name: Check out repository
uses: actions/[email protected]

- name: Build Docker container
run: docker build --build-arg=RELEASE=${{ matrix.release }} --tag=tester .

- name: Upgrade from latest release
run:
docker run --rm tester
./test/ci/source-upgrade-using-loader-without-extension-support.bash ${{ matrix.pg }}

test-package:
name: Test PostgreSQL ${{ matrix.pg }} package install on ${{ matrix.release }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
pg: ['11', '12', '13', '14'] # TODO: '15'
release: [20.04]
steps:
- name: Check out repository
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Build package
uses: linz/linz-software-repository@v15
with:
release: ${{ matrix.release }}
packages: jq

- name: Build Docker container
run: docker build --build-arg=RELEASE=${{ matrix.release }} --tag=tester .

- name: Upgrade from latest release
run:
docker run --rm --volume="${PWD}/build-area:/packages" tester
./test/ci/install-local-package.bash ${{ matrix.pg }}

package:
needs:
- lint
- test-install-from-source
- test-package
- test-package-upgrade
- test-source-upgrade
- test-source-upgrade-using-loader
- test-source-upgrade-using-loader-without-extension-support
name: Package for Ubuntu ${{ matrix.release }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
release: [20.04, 22.04]
max-parallel: 1
steps:
- name: Check out repository
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Determine packagecloud publication target
run: |
# TODO: it would be nice to turn this into a single-liner in
# github-action syntax
echo "GitHub ref: ${{ github.ref }}"
echo "GitHub event_name: ${{ github.event_name }}"
REPO=
if test "${{ github.event_name }}" = 'push'; then
if expr "${{ github.ref }}" : "refs/tags/" > /dev/null; then
REPO=test
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
elif test "${{ github.ref }}" = 'refs/heads/packagecloud' \
-o "${{ github.ref }}" = 'refs/heads/master'
then
REPO=dev
fi
fi
echo "REPO=$REPO" | tee --append $GITHUB_ENV
- name: Build and release package
uses: linz/linz-software-repository@v15
with:
release: ${{ matrix.release }}
packages: jq
packagecloud_token: ${{ secrets.LINZCI_PACKAGECLOUD_TOKEN }}
packagecloud_repository: ${{ env.REPO }}
push_to_git_remote: origin

finalise:
name: Verify all dependencies passed
if: always()
needs:
- lint
- package
- test-install-from-source
- test-package
- test-package-upgrade
- test-source-upgrade
- test-source-upgrade-using-loader
- test-source-upgrade-using-loader-without-extension-support
runs-on: ubuntu-22.04
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/[email protected]
with:
jobs: ${{ toJSON(needs) }}
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ repos:
rev: 02c491342ac7c7a4c0617c01ddd51f49010a77f6 # frozen: v2.12.1-beta
hooks:
- id: hadolint-docker
stages: [commit]
stages: [pre-commit]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: cafd5506f18eea191804850dacc0a4264772d59d # frozen: v3.0.0-alpha.4
hooks:
- id: prettier
stages: [commit]
stages: [pre-commit]
language_version: system

- repo: https://github.com/koalaman/shellcheck-precommit
rev: 3f77b826548d8dc2d26675f077361c92773b50a7 # frozen: v0.9.0
hooks:
- id: shellcheck
stages: [commit]
stages: [pre-commit]
args: ['--external-sources']

0 comments on commit 0b7d661

Please sign in to comment.