Skip to content

Commit 400140f

Browse files
committed
replace qemu with arm64 runner
1 parent 54658b4 commit 400140f

1 file changed

Lines changed: 138 additions & 54 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 138 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@ env:
2121

2222
jobs:
2323
build:
24-
runs-on: ubuntu-latest
2524
if: "!contains(github.event.head_commit.message, '[skip ci]')"
2625
strategy:
2726
matrix:
2827
arch: [amd64, arm64]
28+
include:
29+
- arch: amd64
30+
runner: ubuntu-24.04
31+
- arch: arm64
32+
runner: ubuntu-24.04-arm
33+
runs-on: ${{ matrix.runner }}
2934
steps:
3035
- uses: actions/checkout@v6
3136

@@ -39,10 +44,6 @@ jobs:
3944
python -m pip install --upgrade pip
4045
python -m pip install boto3 click
4146
42-
- name: Set up QEMU
43-
if: matrix.arch == 'arm64'
44-
uses: docker/setup-qemu-action@v4
45-
4647
- name: Set up Docker Buildx
4748
uses: docker/setup-buildx-action@v3
4849

@@ -69,27 +70,26 @@ jobs:
6970
- name: Test
7071
run: |
7172
docker run \
72-
--platform=linux/${{ matrix.arch }} \
7373
--entrypoint bash \
7474
-v ${{ github.workspace }}:/local \
7575
--rm ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-${{ matrix.arch }} \
7676
/local/tests/tests.sh
7777
78-
deploy:
78+
deploy-gdal:
7979
needs: [build]
80-
runs-on: ubuntu-latest
8180
if: contains(github.ref, 'tags') && github.event_name == 'push'
81+
strategy:
82+
matrix:
83+
arch: [amd64, arm64]
84+
include:
85+
- arch: amd64
86+
runner: ubuntu-24.04
87+
- arch: arm64
88+
runner: ubuntu-24.04-arm
89+
runs-on: ${{ matrix.runner }}
8290
steps:
8391
- uses: actions/checkout@v6
8492

85-
- name: Set up Python
86-
uses: actions/setup-python@v6
87-
with:
88-
python-version: '3.13'
89-
90-
- name: Set up QEMU
91-
uses: docker/setup-qemu-action@v4
92-
9393
- name: Set up Docker Buildx
9494
uses: docker/setup-buildx-action@v3
9595

@@ -100,60 +100,144 @@ jobs:
100100
username: ${{ github.repository_owner }}
101101
password: ${{ secrets.GITHUB_TOKEN }}
102102

103+
- name: Publish docker image (${{ matrix.arch }})
104+
uses: docker/build-push-action@v6
105+
with:
106+
platforms: linux/${{ matrix.arch }}
107+
context: .
108+
file: dockerfiles/Dockerfile
109+
build-args: |
110+
GDAL_VERSION=${{ env.GDAL_VERSION }}
111+
push: true
112+
cache-from: type=gha,scope=${{ matrix.arch }}
113+
cache-to: type=gha,mode=max,scope=${{ matrix.arch }}
114+
tags: ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-${{ matrix.arch }}
115+
116+
deploy-gdal-manifest:
117+
needs: [deploy-gdal]
118+
runs-on: ubuntu-24.04
119+
if: contains(github.ref, 'tags') && github.event_name == 'push'
120+
steps:
121+
- name: Login to Github
122+
uses: docker/login-action@v3
123+
with:
124+
registry: ghcr.io
125+
username: ${{ github.repository_owner }}
126+
password: ${{ secrets.GITHUB_TOKEN }}
127+
128+
- name: Create multi-arch manifest
129+
run: |
130+
docker buildx imagetools create \
131+
-t ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }} \
132+
ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-amd64 \
133+
ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-arm64
134+
135+
deploy-layers:
136+
needs: [deploy-gdal]
137+
if: contains(github.ref, 'tags') && github.event_name == 'push'
138+
strategy:
139+
matrix:
140+
include:
141+
- arch: amd64
142+
lambda_arch: x86_64
143+
runner: ubuntu-24.04
144+
- arch: arm64
145+
lambda_arch: arm64
146+
runner: ubuntu-24.04-arm
147+
runs-on: ${{ matrix.runner }}
148+
steps:
149+
- uses: actions/checkout@v6
150+
151+
- name: Set up Python
152+
uses: actions/setup-python@v6
153+
with:
154+
python-version: '3.13'
155+
103156
- name: Configure AWS Credentials
104157
uses: aws-actions/configure-aws-credentials@v6
105158
with:
106159
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
107160
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
108161
aws-region: us-east-1
109162

110-
- name: Publish docker image
163+
- name: Build and Deploy layer (${{ matrix.arch }})
164+
run: |
165+
python -m pip install boto3 click
166+
docker run \
167+
--entrypoint bash \
168+
-e OUTPUT_ZIP=package-${{ matrix.arch }}.zip \
169+
-v ${{ github.workspace }}:/local \
170+
--rm ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-${{ matrix.arch }} \
171+
/local/scripts/create-layer.sh
172+
python scripts/deploy.py ${{ env.GDAL_VERSION_TAG }} --arch ${{ matrix.lambda_arch }} --package package-${{ matrix.arch }}.zip --deploy
173+
174+
deploy-runtime:
175+
needs: [deploy-gdal]
176+
if: contains(github.ref, 'tags') && github.event_name == 'push'
177+
strategy:
178+
matrix:
179+
runtime: ['3.12', '3.13']
180+
arch: [amd64, arm64]
181+
include:
182+
- arch: amd64
183+
runner: ubuntu-24.04
184+
- arch: arm64
185+
runner: ubuntu-24.04-arm
186+
runs-on: ${{ matrix.runner }}
187+
steps:
188+
- uses: actions/checkout@v6
189+
190+
- name: Set up Docker Buildx
191+
uses: docker/setup-buildx-action@v3
192+
193+
- name: Login to Github
194+
uses: docker/login-action@v3
195+
with:
196+
registry: ghcr.io
197+
username: ${{ github.repository_owner }}
198+
password: ${{ secrets.GITHUB_TOKEN }}
199+
200+
- name: Build and push runtime image (python${{ matrix.runtime }}, ${{ matrix.arch }})
111201
uses: docker/build-push-action@v6
112202
with:
113-
platforms: linux/amd64,linux/arm64
203+
platforms: linux/${{ matrix.arch }}
114204
context: .
115-
file: dockerfiles/Dockerfile
205+
file: dockerfiles/runtimes/python
116206
build-args: |
117-
GDAL_VERSION=${{ env.GDAL_VERSION }}
207+
GDAL_VERSION_TAG=${{ env.GDAL_VERSION_TAG }}-${{ matrix.arch }}
208+
RUNTIME_VERSION=${{ matrix.runtime }}
209+
NUMPY_VERSION=2.4.2
210+
PKG_INSTALLER=dnf
118211
push: true
119-
cache-from: |
120-
type=gha,scope=amd64
121-
type=gha,scope=arm64
122-
tags: ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}
212+
cache-from: type=gha,scope=python${{ matrix.runtime }}-${{ matrix.arch }}
213+
cache-to: type=gha,mode=max,scope=python${{ matrix.runtime }}-${{ matrix.arch }}
214+
tags: ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${{ matrix.runtime }}-${{ matrix.arch }}
123215

124-
- name: Build and Deploy layers
125-
run: |
126-
python -m pip install boto3 click
127-
declare -A LAMBDA_ARCH=( [amd64]=x86_64 [arm64]=arm64 )
128-
for arch in amd64 arm64; do
129-
docker run \
130-
--platform=linux/${arch} \
131-
--entrypoint bash \
132-
-e OUTPUT_ZIP=package-${arch}.zip \
133-
-v ${{ github.workspace }}:/local \
134-
--rm ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }} \
135-
/local/scripts/create-layer.sh
136-
python scripts/deploy.py ${{ env.GDAL_VERSION_TAG }} --arch ${LAMBDA_ARCH[$arch]} --package package-${arch}.zip --deploy
137-
done
138-
139-
- name: Build Runtime and Push Python >= 3.12 with dnf
216+
deploy-runtime-manifest:
217+
needs: [deploy-runtime]
218+
runs-on: ubuntu-24.04
219+
if: contains(github.ref, 'tags') && github.event_name == 'push'
220+
strategy:
221+
matrix:
222+
runtime: ['3.12', '3.13']
223+
steps:
224+
- name: Login to Github
225+
uses: docker/login-action@v3
226+
with:
227+
registry: ghcr.io
228+
username: ${{ github.repository_owner }}
229+
password: ${{ secrets.GITHUB_TOKEN }}
230+
231+
- name: Create multi-arch manifest (python${{ matrix.runtime }})
140232
run: |
141-
runtimes='3.12 3.13'
142-
for runtime in ${runtimes}; do
143-
docker buildx build \
144-
--platform=linux/amd64,linux/arm64 \
145-
--build-arg GDAL_VERSION_TAG=${{ env.GDAL_VERSION_TAG }} \
146-
--build-arg RUNTIME_VERSION=${runtime} \
147-
--build-arg NUMPY_VERSION=2.4.2 \
148-
--build-arg PKG_INSTALLER=dnf \
149-
--push \
150-
-f dockerfiles/runtimes/python \
151-
-t ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${runtime} .
152-
done
233+
docker buildx imagetools create \
234+
-t ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${{ matrix.runtime }} \
235+
ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${{ matrix.runtime }}-amd64 \
236+
ghcr.io/${{ github.repository_owner }}/lambda-gdal:${{ env.GDAL_VERSION_TAG }}-python${{ matrix.runtime }}-arm64
153237
154238
update-layer:
155-
needs: [deploy]
156-
runs-on: ubuntu-latest
239+
needs: [deploy-layers]
240+
runs-on: ubuntu-24.04
157241
steps:
158242
- uses: actions/checkout@v6
159243

0 commit comments

Comments
 (0)