Skip to content

Commit 9e8252c

Browse files
committed
deduplicate
1 parent 25a384e commit 9e8252c

File tree

2 files changed

+18
-38
lines changed

2 files changed

+18
-38
lines changed

.github/workflows/_reusable-build-images.yml

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,26 @@ on:
2222
outputs:
2323
backend-artifact-name:
2424
description: "Name of the backend artifact"
25-
value: ${{ jobs.build-test-images.outputs.artifact-name }}
25+
value: ${{ jobs.build-test-images.outputs.backend-artifact-name }}
2626
frontend-artifact-name:
2727
description: "Name of the frontend artifact"
28-
value: ${{ jobs.build-test-images-frontend.outputs.artifact-name }}
28+
value: ${{ jobs.build-test-images.outputs.frontend-artifact-name }}
2929

3030
jobs:
3131
build-test-images:
32-
if: ${{ inputs.build-backend }}
32+
strategy:
33+
matrix:
34+
type: [backend, frontend]
35+
exclude:
36+
- type: backend
37+
condition: ${{ !inputs.build-backend }}
38+
- type: frontend
39+
condition: ${{ !inputs.build-frontend }}
3340
timeout-minutes: 30
3441
runs-on: ${{ inputs.os }}
3542
outputs:
36-
artifact-name: docker-buildx-images-${{ runner.os }}-${{ github.sha }}-backend
43+
backend-artifact-name: ${{ matrix.type == 'backend' && format('docker-buildx-images-{0}-{1}-backend', runner.os, github.sha) || '' }}
44+
frontend-artifact-name: ${{ matrix.type == 'frontend' && format('docker-buildx-images-{0}-{1}-frontend', runner.os, github.sha) || '' }}
3745
steps:
3846
- uses: actions/checkout@v4
3947
- name: setup docker buildx
@@ -49,37 +57,13 @@ jobs:
4957
run: |
5058
export DOCKER_IMAGE_TAG=$(exec ci/helpers/build_docker_image_tag.bash)
5159
mkdir --parents /${{ runner.temp }}/build
52-
make build local-dest=/${{ runner.temp }}/build exclude=static-webserver
60+
if [ "${{ matrix.type }}" = "backend" ]; then
61+
make build local-dest=/${{ runner.temp }}/build exclude=static-webserver
62+
else
63+
make build local-dest=/${{ runner.temp }}/build target=static-webserver
64+
fi
5365
- name: upload build artifacts
5466
uses: actions/upload-artifact@v4
5567
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
68+
name: docker-buildx-images-${{ runner.os }}-${{ github.sha }}-${{ matrix.type }}
8569
path: /${{ runner.temp }}/build

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,6 @@ jobs:
267267
anything-js:
268268
- '**/*.js'
269269
build-test-images:
270-
# this step comes first, so that it is executed as first job in push calls
271-
# in PR calls this step is anyway skipped
272270
needs: changes
273271
if: ${{ needs.changes.outputs.anything == 'true' || github.event_name == 'push' || github.event.inputs.force_all_builds == 'true' }}
274272
uses: ./.github/workflows/_reusable-build-images.yml
@@ -279,8 +277,6 @@ jobs:
279277
python-version: "3.11"
280278

281279
build-test-images-frontend:
282-
# this step comes first, so that it is executed as first job in push calls
283-
# in PR calls this step is anyway skipped
284280
needs: changes
285281
if: ${{ needs.changes.outputs.anything == 'true' || github.event_name == 'push' || github.event.inputs.force_all_builds == 'true' }}
286282
uses: ./.github/workflows/_reusable-build-images.yml

0 commit comments

Comments
 (0)