Skip to content

Commit a01883b

Browse files
committed
modularize
1 parent 396202b commit a01883b

File tree

2 files changed

+97
-58
lines changed

2 files changed

+97
-58
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Reusable Build Images
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
build-backend:
7+
required: true
8+
type: boolean
9+
description: "Whether backend images should be built"
10+
build-frontend:
11+
required: true
12+
type: boolean
13+
description: "Whether frontend images should be built"
14+
python-version:
15+
required: true
16+
type: string
17+
description: "Python version to use"
18+
os:
19+
required: true
20+
type: string
21+
description: "Runner OS to use"
22+
outputs:
23+
backend-artifact-name:
24+
description: "Name of the backend artifact"
25+
value: ${{ jobs.build-test-images.outputs.artifact-name }}
26+
frontend-artifact-name:
27+
description: "Name of the frontend artifact"
28+
value: ${{ jobs.build-test-images-frontend.outputs.artifact-name }}
29+
30+
jobs:
31+
build-test-images:
32+
if: ${{ inputs.build-backend }}
33+
timeout-minutes: 30
34+
runs-on: ${{ inputs.os }}
35+
outputs:
36+
artifact-name: docker-buildx-images-${{ runner.os }}-${{ github.sha }}-backend
37+
steps:
38+
- uses: actions/checkout@v4
39+
- name: setup docker buildx
40+
id: buildx
41+
uses: docker/setup-buildx-action@v3
42+
with:
43+
driver: docker-container
44+
- name: expose github runtime for buildx
45+
uses: crazy-max/ghaction-github-runtime@v3
46+
- name: show system environs
47+
run: ./ci/helpers/show_system_versions.bash
48+
- name: build images
49+
run: |
50+
export DOCKER_IMAGE_TAG=$(exec ci/helpers/build_docker_image_tag.bash)
51+
mkdir --parents /${{ runner.temp }}/build
52+
make build local-dest=/${{ runner.temp }}/build exclude=static-webserver
53+
- name: upload build artifacts
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: docker-buildx-images-${{ runner.os }}-${{ github.sha }}-backend
57+
path: /${{ runner.temp }}/build
58+
59+
build-test-images-frontend:
60+
if: ${{ inputs.build-frontend }}
61+
timeout-minutes: 30
62+
runs-on: ${{ inputs.os }}
63+
outputs:
64+
artifact-name: docker-buildx-images-${{ runner.os }}-${{ github.sha }}-frontend
65+
steps:
66+
- uses: actions/checkout@v4
67+
- name: setup docker buildx
68+
id: buildx
69+
uses: docker/setup-buildx-action@v3
70+
with:
71+
driver: docker-container
72+
- name: expose github runtime for buildx
73+
uses: crazy-max/ghaction-github-runtime@v3
74+
- name: show system environs
75+
run: ./ci/helpers/show_system_versions.bash
76+
- name: build images
77+
run: |
78+
export DOCKER_IMAGE_TAG=$(exec ci/helpers/build_docker_image_tag.bash)
79+
mkdir --parents /${{ runner.temp }}/build
80+
make build local-dest=/${{ runner.temp }}/build target=static-webserver
81+
- name: upload build artifacts
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: docker-buildx-images-${{ runner.os }}-${{ github.sha }}-frontend
85+
path: /${{ runner.temp }}/build

.github/workflows/ci-testing-deploy.yml

Lines changed: 12 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -276,70 +276,24 @@ jobs:
276276
# in PR calls this step is anyway skipped
277277
needs: changes
278278
if: ${{ needs.changes.outputs.anything == 'true' || github.event_name == 'push' }}
279-
timeout-minutes: 30
280-
runs-on: ${{ matrix.os }}
281-
strategy:
282-
matrix:
283-
python: ["3.11"]
284-
os: [ubuntu-24.04]
285-
fail-fast: false
286-
name: "[build] docker images (excluding frontend)"
287-
steps:
288-
- uses: actions/checkout@v4
289-
- name: setup docker buildx
290-
id: buildx
291-
uses: docker/setup-buildx-action@v3
292-
with:
293-
driver: docker-container
294-
- name: expose github runtime for buildx
295-
uses: crazy-max/ghaction-github-runtime@v3
296-
- name: show system environs
297-
run: ./ci/helpers/show_system_versions.bash
298-
- name: build images
299-
run: |
300-
export DOCKER_IMAGE_TAG=$(exec ci/helpers/build_docker_image_tag.bash)
301-
mkdir --parents /${{ runner.temp }}/build
302-
make build local-dest=/${{ runner.temp }}/build exclude=static-webserver
303-
- name: upload build artifacts
304-
uses: actions/upload-artifact@v4
305-
with:
306-
name: docker-buildx-images-${{ runner.os }}-${{ github.sha }}-backend
307-
path: /${{ runner.temp }}/build
279+
uses: ./.github/workflows/_reusable-build-images.yml
280+
with:
281+
build-backend: true
282+
build-frontend: false
283+
os: ubuntu-24.04
284+
python-version: "3.11"
308285

309286
build-test-images-frontend:
310287
# this step comes first, so that it is executed as first job in push calls
311288
# in PR calls this step is anyway skipped
312289
needs: changes
313290
if: ${{ needs.changes.outputs.anything == 'true' || github.event_name == 'push' }}
314-
timeout-minutes: 30
315-
runs-on: ${{ matrix.os }}
316-
strategy:
317-
matrix:
318-
python: ["3.11"]
319-
os: [ubuntu-24.04]
320-
fail-fast: false
321-
name: "[build] docker images (frontend-only)"
322-
steps:
323-
- uses: actions/checkout@v4
324-
- name: setup docker buildx
325-
id: buildx
326-
uses: docker/setup-buildx-action@v3
327-
with:
328-
driver: docker-container
329-
- name: expose github runtime for buildx
330-
uses: crazy-max/ghaction-github-runtime@v3
331-
- name: show system environs
332-
run: ./ci/helpers/show_system_versions.bash
333-
- name: build images
334-
run: |
335-
export DOCKER_IMAGE_TAG=$(exec ci/helpers/build_docker_image_tag.bash)
336-
mkdir --parents /${{ runner.temp }}/build
337-
make build local-dest=/${{ runner.temp }}/build target=static-webserver
338-
- name: upload build artifacts
339-
uses: actions/upload-artifact@v4
340-
with:
341-
name: docker-buildx-images-${{ runner.os }}-${{ github.sha }}-frontend
342-
path: /${{ runner.temp }}/build
291+
uses: ./.github/workflows/_reusable-build-images.yml
292+
with:
293+
build-backend: false
294+
build-frontend: true
295+
os: ubuntu-24.04
296+
python-version: "3.11"
343297

344298
unit-test-webserver-01:
345299
needs: changes

0 commit comments

Comments
 (0)