feat: postgis built in our bundle again and matching version we need #554
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: Testinfra Integration Tests | |
on: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
test-all-in-one: | |
strategy: | |
matrix: | |
include: | |
- runner: [self-hosted, X64] | |
arch: amd64 | |
- runner: arm-runner | |
arch: arm64 | |
runs-on: ${{ matrix.runner }} | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v3 | |
- run: docker context create builders | |
- uses: docker/setup-buildx-action@v3 | |
with: | |
endpoint: builders | |
- name: Run aio integration tests | |
run: | | |
# TODO: use poetry for pkg mgmt | |
pip3 install boto3 boto3-stubs[essential] docker ec2instanceconnectcli pytest pytest-testinfra[paramiko,docker] requests | |
if ! pytest -vv testinfra/test_all_in_one.py; then | |
# display container logs if the test fails | |
if [ -f testinfra-aio-container-logs.log ]; then | |
echo "AIO container logs:" | |
cat testinfra-aio-container-logs.log | |
fi | |
exit 1 | |
fi | |
test-ami: | |
strategy: | |
matrix: | |
include: | |
- runner: arm-runner | |
arch: arm64 | |
ubuntu_release: focal | |
ubuntu_version: 20.04 | |
mcpu: neoverse-n1 | |
runs-on: ${{ matrix.runner }} | |
timeout-minutes: 150 | |
permissions: | |
contents: write | |
packages: write | |
id-token: write | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- id: args | |
uses: mikefarah/yq@master | |
with: | |
cmd: yq 'to_entries | map(select(.value|type == "!!str")) | map(.key + "=" + .value) | join("\n")' 'ansible/vars.yml' | |
- run: docker context create builders | |
- uses: docker/setup-buildx-action@v3 | |
with: | |
endpoint: builders | |
- uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
${{ steps.args.outputs.result }} | |
target: extensions | |
tags: supabase/postgres:extensions | |
platforms: linux/${{ matrix.arch }} | |
outputs: type=tar,dest=/tmp/extensions.tar | |
cache-from: | | |
type=gha,scope=${{ github.ref_name }}-extensions | |
type=gha,scope=${{ github.base_ref }}-extensions | |
type=gha,scope=develop-extensions | |
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-extensions | |
- name: Extract built packages | |
run: | | |
mkdir -p ansible/files/extensions | |
tar xvf /tmp/extensions.tar -C ansible/files/extensions --strip-components 1 | |
- id: version | |
run: echo "${{ steps.args.outputs.result }}" | grep "postgresql" >> "$GITHUB_OUTPUT" | |
- name: Build Postgres deb | |
uses: docker/build-push-action@v5 | |
with: | |
file: docker/Dockerfile | |
target: pg-deb | |
build-args: | | |
ubuntu_release=${{ matrix.ubuntu_release }} | |
ubuntu_release_no=${{ matrix.ubuntu_version }} | |
postgresql_major=${{ steps.version.outputs.postgresql_major }} | |
postgresql_release=${{ steps.version.outputs.postgresql_release }} | |
CPPFLAGS=-mcpu=${{ matrix.mcpu }} | |
tags: supabase/postgres:deb | |
platforms: linux/${{ matrix.arch }} | |
outputs: type=tar,dest=/tmp/pg-deb.tar | |
cache-from: | | |
type=gha,scope=${{ github.ref_name }}-deb | |
type=gha,scope=${{ github.base_ref }}-deb | |
type=gha,scope=develop-deb | |
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-deb | |
- name: Extract Postgres deb | |
run: | | |
mkdir -p ansible/files/postgres | |
tar xvf /tmp/pg-deb.tar -C ansible/files/postgres --strip-components 1 | |
# Packer doesn't support skipping registering the AMI for the ebssurrogate | |
# builder, so we register an AMI with a fixed name and run tests on an | |
# instance launched from that | |
# https://github.com/hashicorp/packer/issues/4899 | |
- name: Build AMI | |
run: | | |
packer init amazon-arm64.pkr.hcl | |
GIT_SHA=${{github.sha}} | |
packer build -var "git-head-version=${GIT_SHA}" -var "packer-execution-id=${GITHUB_RUN_ID}" -var-file="development-arm.vars.pkr.hcl" -var-file="common.vars.pkr.hcl" -var "ansible_arguments=" -var "postgres-version=ci-ami-test" -var "region=ap-southeast-1" -var 'ami_regions=["ap-southeast-1"]' -var "force-deregister=true" amazon-arm64.pkr.hcl | |
- name: Run tests | |
timeout-minutes: 10 | |
run: | | |
# TODO: use poetry for pkg mgmt | |
pip3 install boto3 boto3-stubs[essential] docker ec2instanceconnectcli pytest pytest-testinfra[paramiko,docker] requests | |
pytest -vv -s testinfra/test_ami.py | |
- name: Cleanup resources on build cancellation | |
if: ${{ cancelled() }} | |
run: | | |
aws ec2 --region ap-southeast-1 describe-instances --filters "Name=tag:packerExecutionId,Values=${GITHUB_RUN_ID}" --query "Reservations[].Instances[].InstanceId" --output text | xargs -n 1 -I {} aws ec2 terminate-instances --region ap-southeast-1 --instance-ids {} | |
- name: Cleanup resources on build cancellation | |
if: ${{ always() }} | |
run: | | |
aws ec2 --region ap-southeast-1 describe-instances --filters "Name=tag:testinfra-run-id,Values=${GITHUB_RUN_ID}" --query "Reservations[].Instances[].InstanceId" --output text | xargs -n 1 -I {} aws ec2 terminate-instances --region ap-southeast-1 --instance-ids {} || true |