Skip to content

Commit ab89a40

Browse files
committed
test
1 parent 50ad644 commit ab89a40

File tree

3 files changed

+51
-20
lines changed

3 files changed

+51
-20
lines changed

.github/workflows/build-and-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ env:
44
on:
55
workflow_call:
66
inputs:
7-
image:
7+
images:
88
required: true
99
type: string
1010
image_options:
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818

1919
container:
20-
image: ${{ inputs.image }}-ubuntu-latest
20+
image: ${{ fromJSON(inputs.images).ubuntu-latest }}
2121
env:
2222
CFLAGS: -O2 -Wp,-D_FORTIFY_SOURCE=2
2323
LC_ALL: en_US.UTF-8
@@ -80,7 +80,7 @@ jobs:
8080
compiler: ['gcc', 'clang']
8181

8282
container:
83-
image: ${{ inputs.image }}-${{ matrix.image }}
83+
image: ${{ fromJSON(inputs.images)[matrix.image] }}
8484
env:
8585
CFLAGS: -O2 -Wp,-D_FORTIFY_SOURCE=2
8686
CC: ${{ matrix.compiler }}

.github/workflows/container.yml

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
env:
2-
IMAGE_TAG: 2025-11-21.9
3-
41
on:
52
workflow_call:
63
outputs:
7-
image:
8-
description: "The build image"
9-
value: ${{ jobs.build-container.outputs.image }}
4+
images:
5+
description: "The build images"
6+
value: ${{ jobs.collect.outputs.outcomes }}
107
image_options:
118
description: "The options to use with the image"
129
value: --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined --privileged
@@ -17,10 +14,9 @@ jobs:
1714
runs-on: ubuntu-latest
1815
strategy:
1916
matrix:
20-
image: ['ubuntu-latest', 'fedora-latest']
21-
22-
outputs:
23-
image: ${{ steps.check.outputs.image }}
17+
image:
18+
- 'ubuntu-latest:2025-11-21.9'
19+
- 'fedora-latest:2025-11-21.10'
2420

2521
steps:
2622
- name: Login to GHCR
@@ -35,16 +31,22 @@ jobs:
3531
run: |
3632
ACTOR="${{ github.actor }}"
3733
OWNER="${{ github.repository_owner }}"
38-
image_actor="ghcr.io/${ACTOR,,}/flatpak-ci:${{ env.IMAGE_TAG }}"
39-
image_owner="ghcr.io/${OWNER,,}/flatpak-ci:${{ env.IMAGE_TAG }}"
4034
41-
if docker manifest inspect "${image_owner}-${{ matrix.image }}" >/dev/null ; then
35+
image_name=$(echo "${{ matrix.image }}" | cut -d':' -f1)
36+
image="flatpak-ci-${{ matrix.image }}"
37+
38+
echo "image_name=${image_name}" >> "$GITHUB_OUTPUT"
39+
40+
image_owner="ghcr.io/${OWNER,,}/${image}"
41+
image_actor="ghcr.io/${ACTOR,,}/${image}"
42+
43+
if docker manifest inspect "${image_owner}" >/dev/null ; then
4244
echo "exists=true" >> "$GITHUB_OUTPUT"
4345
echo "image=${image_owner}" >> "$GITHUB_OUTPUT"
4446
exit 0
4547
fi
4648
47-
if docker manifest inspect "${image_actor}-${{ matrix.image }}" >/dev/null ; then
49+
if docker manifest inspect "${image_actor}" >/dev/null ; then
4850
echo "exists=true" >> "$GITHUB_OUTPUT"
4951
echo "image=${image_actor}" >> "$GITHUB_OUTPUT"
5052
exit 0
@@ -58,5 +60,34 @@ jobs:
5860
uses: docker/build-push-action@v5
5961
with:
6062
push: true
61-
file: .github/workflows/containers/${{ matrix.image }}.containerfile
62-
tags: ${{ steps.check.outputs.image }}-${{ matrix.image }}
63+
file: .github/workflows/containers/${{ steps.check.outputs.image_name }}.containerfile
64+
tags: ${{ steps.check.outputs.image }}
65+
66+
- name: Record the result
67+
run: |
68+
jq -cn \
69+
--arg name "${{ steps.check.outputs.image_name }}" \
70+
--arg image "${{ steps.check.outputs.image }}" \
71+
'$ARGS.named' > outcome
72+
73+
- name: Upload the result
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: ${{ hashFiles('outcome') }}
77+
path: outcome
78+
79+
collect:
80+
name: Collect build container results
81+
runs-on: ubuntu-latest
82+
needs: build-container
83+
if: ${{ !cancelled() }}
84+
outputs:
85+
outcomes: ${{ steps.collect.outputs.outcomes }}
86+
87+
steps:
88+
- uses: actions/download-artifact@v4
89+
- id: collect
90+
run: |
91+
outcomes="$(cat */outcome | jq -c --slurp 'map({(.name): .image})')"
92+
echo $outcomes
93+
echo outcomes=$outcomes >> $GITHUB_OUTPUT

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
uses: ./.github/workflows/build-and-test.yml
1515
needs: build-container
1616
with:
17-
image: ${{ needs.build-container.outputs.image }}
17+
images: ${{ needs.build-container.outputs.images }}
1818
image_options: ${{ needs.build-container.outputs.image_options }}
1919

2020
checks:

0 commit comments

Comments
 (0)