@@ -38,109 +38,3 @@ jobs:
38
38
fi
39
39
exit 1
40
40
fi
41
-
42
- test-ami :
43
- strategy :
44
- matrix :
45
- include :
46
- - runner : arm-runner
47
- arch : arm64
48
- ubuntu_release : focal
49
- ubuntu_version : 20.04
50
- mcpu : neoverse-n1
51
- runs-on : ${{ matrix.runner }}
52
- timeout-minutes : 150
53
- permissions :
54
- contents : write
55
- packages : write
56
- id-token : write
57
-
58
- steps :
59
- - name : Checkout Repo
60
- uses : actions/checkout@v4
61
-
62
- - id : args
63
- uses : mikefarah/yq@master
64
- with :
65
- cmd : yq 'to_entries | map(select(.value|type == "!!str")) | map(.key + "=" + .value) | join("\n")' 'ansible/vars.yml'
66
-
67
- - run : docker context create builders
68
-
69
- - uses : docker/setup-buildx-action@v3
70
- with :
71
- endpoint : builders
72
-
73
- - uses : docker/build-push-action@v5
74
- with :
75
- build-args : |
76
- ${{ steps.args.outputs.result }}
77
- target : extensions
78
- tags : supabase/postgres:extensions
79
- platforms : linux/${{ matrix.arch }}
80
- outputs : type=tar,dest=/tmp/extensions.tar
81
- cache-from : |
82
- type=gha,scope=${{ github.ref_name }}-extensions
83
- type=gha,scope=${{ github.base_ref }}-extensions
84
- type=gha,scope=develop-extensions
85
- cache-to : type=gha,mode=max,scope=${{ github.ref_name }}-extensions
86
-
87
- - name : Extract built packages
88
- run : |
89
- mkdir -p ansible/files/extensions
90
- tar xvf /tmp/extensions.tar -C ansible/files/extensions --strip-components 1
91
-
92
- - id : version
93
- run : echo "${{ steps.args.outputs.result }}" | grep "postgresql" >> "$GITHUB_OUTPUT"
94
-
95
- - name : Build Postgres deb
96
- uses : docker/build-push-action@v5
97
- with :
98
- file : docker/Dockerfile
99
- target : pg-deb
100
- build-args : |
101
- ubuntu_release=${{ matrix.ubuntu_release }}
102
- ubuntu_release_no=${{ matrix.ubuntu_version }}
103
- postgresql_major=${{ steps.version.outputs.postgresql_major }}
104
- postgresql_release=${{ steps.version.outputs.postgresql_release }}
105
- CPPFLAGS=-mcpu=${{ matrix.mcpu }}
106
- CFLAGS=-g3
107
- tags : supabase/postgres:deb
108
- platforms : linux/${{ matrix.arch }}
109
- outputs : type=tar,dest=/tmp/pg-deb.tar
110
- cache-from : |
111
- type=gha,scope=${{ github.ref_name }}-deb
112
- type=gha,scope=${{ github.base_ref }}-deb
113
- type=gha,scope=develop-deb
114
- cache-to : type=gha,mode=max,scope=${{ github.ref_name }}-deb
115
-
116
- - name : Extract Postgres deb
117
- run : |
118
- mkdir -p ansible/files/postgres
119
- tar xvf /tmp/pg-deb.tar -C ansible/files/postgres --strip-components 1
120
-
121
- # Packer doesn't support skipping registering the AMI for the ebssurrogate
122
- # builder, so we register an AMI with a fixed name and run tests on an
123
- # instance launched from that
124
- # https://github.com/hashicorp/packer/issues/4899
125
- - name : Build AMI
126
- run : |
127
- packer init amazon-arm64.pkr.hcl
128
- GIT_SHA=${{github.sha}}
129
- 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
130
-
131
- - name : Run tests
132
- timeout-minutes : 10
133
- run : |
134
- # TODO: use poetry for pkg mgmt
135
- pip3 install boto3 boto3-stubs[essential] docker ec2instanceconnectcli pytest pytest-testinfra[paramiko,docker] requests
136
- pytest -vv -s testinfra/test_ami.py
137
-
138
- - name : Cleanup resources on build cancellation
139
- if : ${{ cancelled() }}
140
- run : |
141
- 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 {}
142
-
143
- - name : Cleanup resources on build cancellation
144
- if : ${{ always() }}
145
- run : |
146
- 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
0 commit comments