Skip to content

Commit 4508d51

Browse files
authored
ci: make podman tests optional
1 parent a021052 commit 4508d51

4 files changed

Lines changed: 40 additions & 44 deletions

File tree

.github/workflows/continuous-integration.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,16 @@ jobs:
5151
packages: write # is needed to push image manifest when using GitHub Container Registry
5252
pull-requests: write # is needed by marocchino/sticky-pull-request-comment to post comments
5353
with:
54+
acceptance-test-path: ${{ (github.actor != 'dependabot[bot]' && matrix.flavor == 'cpp') && 'test/cpp/features' || '' }}
55+
acceptance-test-devcontainer-file: .devcontainer/${{ matrix.flavor }}-test/devcontainer.json
5456
build-args: |
5557
BASE_IMAGE=${{ needs.build-push-base.outputs.fully-qualified-image-name }}@${{ needs.build-push-base.outputs.digest }}
5658
devcontainer-metadata-file: .devcontainer/${{ matrix.flavor }}/devcontainer-metadata.json
5759
dockerfile: .devcontainer/${{ matrix.flavor }}/Dockerfile
5860
enable-edge-tag: ${{ github.event_name == 'merge_group' }}
5961
image-name: ${{ github.repository }}-${{ matrix.flavor }}
6062
integration-test-file: test/${{ matrix.flavor }}/integration-tests.bats
61-
acceptance-test-path: ${{ (github.actor != 'dependabot[bot]' && matrix.flavor == 'cpp') && 'test/cpp/features' || '' }}
62-
test-devcontainer-file: .devcontainer/${{ matrix.flavor }}-test/devcontainer.json
63+
integration-test-podman: true
6364

6465
dependency-review:
6566
name: 🔍 Dependency Review

.github/workflows/wc-build-push-test.yml

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@ name: Build, Push & Test
44
on:
55
workflow_call:
66
inputs:
7+
acceptance-test-devcontainer-file:
8+
description: Path to the devcontainer.json file to use for acceptance tests.
9+
required: false
10+
type: string
711
acceptance-test-path:
8-
description: Path to the Playwright acceptance tests (directory that contains playwright.config.ts)
12+
description: Path to the Playwright acceptance tests (directory that contains playwright.config.ts).
913
required: false
1014
type: string
1115
build-args:
12-
description: Optional docker build args (newline-separated KEY=VALUE)
16+
description: Optional docker build args (newline-separated KEY=VALUE).
1317
required: false
1418
type: string
1519
build-test-runner-labels:
@@ -38,7 +42,7 @@ on:
3842
required: true
3943
type: string
4044
enable-edge-tag:
41-
description: Whether to also build and push an "edge" tag for the image
45+
description: Whether to also build and push an "edge" tag for the image.
4246
required: false
4347
type: boolean
4448
default: false
@@ -52,9 +56,14 @@ on:
5256
required: true
5357
type: string
5458
integration-test-file:
55-
description: Path to the BATS test file to run for integration tests
59+
description: Path to the BATS test file to run for integration tests.
5660
required: false
5761
type: string
62+
integration-test-podman:
63+
description: Enable running the tests using the Podman container runtime, next to the default Docker container runtime.
64+
required: false
65+
type: boolean
66+
default: false
5867
registry:
5968
description: >-
6069
Docker registry to push built containers to.
@@ -73,10 +82,6 @@ on:
7382
required: false
7483
type: string
7584
default: '["ubuntu-latest"]'
76-
test-devcontainer-file:
77-
description: Path to the devcontainer.json file to use for acceptance tests
78-
required: false
79-
type: string
8085
outputs:
8186
digest:
8287
value: ${{ jobs.build-push.outputs.digest }}
@@ -88,10 +93,10 @@ on:
8893
value: ${{ jobs.build-push.outputs.version }}
8994
secrets:
9095
DOCKER_REGISTRY_PASSWORD:
91-
description: Password or token for Docker login, if not provided the GitHub token will be used
96+
description: Password or token for Docker login, if not provided the GitHub token will be used.
9297
required: false
9398
DOCKER_REGISTRY_USERNAME:
94-
description: User name for Docker login, if not provided the GitHub actor will be used
99+
description: User name for Docker login, if not provided the GitHub actor will be used.
95100
required: false
96101
TEST_GITHUB_PASSWORD:
97102
required: false
@@ -116,7 +121,7 @@ jobs:
116121
id-token: write # is needed by actions/attest-build-provenance to obtain an OIDC token
117122
packages: write # is needed to push image manifest when using GitHub Container Registry
118123
pull-requests: write # is needed by marocchino/sticky-pull-request-comment to post comments
119-
secrets:
124+
secrets: &docker-secrets
120125
DOCKER_REGISTRY_USERNAME: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
121126
DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
122127
with:
@@ -129,17 +134,15 @@ jobs:
129134
runner-labels: ${{ inputs.runner-labels }}
130135
build-test-runner-labels: ${{ inputs.build-test-runner-labels }}
131136

132-
integration-test:
137+
integration-test-docker:
133138
name: 🧪
134139
if: ${{ inputs.integration-test-file }}
135140
needs: build-push
136-
uses: ./.github/workflows/wc-integration-test.yml
141+
uses: ./.github/workflows/wc-integration-test-docker.yml
137142
permissions:
138143
contents: read
139-
secrets:
140-
DOCKER_REGISTRY_USERNAME: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
141-
DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
142-
with:
144+
secrets: *docker-secrets
145+
with: &integration-test-inputs
143146
build-test-runner-labels: ${{ inputs.build-test-runner-labels }}
144147
fully-qualified-image-name: ${{ needs.build-push.outputs.fully-qualified-image-name }}
145148
image-basename: ${{ needs.build-push.outputs.image-basename }}
@@ -149,25 +152,17 @@ jobs:
149152

150153
integration-test-podman:
151154
name: 🧪
152-
if: ${{ inputs.integration-test-file }}
155+
if: ${{ inputs.integration-test-file && inputs.integration-test-podman }}
153156
needs: build-push
154157
uses: ./.github/workflows/wc-integration-test-podman.yml
155158
permissions:
156159
contents: read
157-
secrets:
158-
DOCKER_REGISTRY_USERNAME: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
159-
DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
160-
with:
161-
build-test-runner-labels: ${{ inputs.build-test-runner-labels }}
162-
fully-qualified-image-name: ${{ needs.build-push.outputs.fully-qualified-image-name }}
163-
image-basename: ${{ needs.build-push.outputs.image-basename }}
164-
image-digest: ${{ needs.build-push.outputs.digest }}
165-
registry: ${{ inputs.registry }}
166-
test-file: ${{ inputs.integration-test-file }}
160+
secrets: *docker-secrets
161+
with: *integration-test-inputs
167162

168163
acceptance-test:
169164
name: 🏗️
170-
if: ${{ inputs.test-devcontainer-file && inputs.acceptance-test-path }}
165+
if: ${{ inputs.acceptance-test-devcontainer-file && inputs.acceptance-test-path }}
171166
needs: build-push
172167
uses: ./.github/workflows/wc-acceptance-test.yml
173168
permissions:
@@ -179,5 +174,5 @@ jobs:
179174
TEST_GITHUB_TOTP_SECRET: ${{ secrets.TEST_GITHUB_TOTP_SECRET }}
180175
with:
181176
image-basename: ${{ needs.build-push.outputs.image-basename }}
182-
devcontainer-file: ${{ inputs.test-devcontainer-file }}
177+
devcontainer-file: ${{ inputs.acceptance-test-devcontainer-file }}
183178
acceptance-test-path: ${{ inputs.acceptance-test-path }}

.github/workflows/wc-integration-test.yml renamed to .github/workflows/wc-integration-test-docker.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
---
2-
name: Integration Test
2+
name: 🐳 Integration Test
33

44
on:
55
workflow_call:
66
inputs:
7+
build-test-runner-labels:
8+
required: true
9+
type: string
710
fully-qualified-image-name:
811
required: true
912
type: string
@@ -13,26 +16,23 @@ on:
1316
image-digest:
1417
required: true
1518
type: string
16-
test-file:
17-
required: true
18-
type: string
19-
build-test-runner-labels:
19+
registry:
2020
required: true
2121
type: string
22-
registry:
22+
test-file:
2323
required: true
2424
type: string
2525
secrets:
26-
DOCKER_REGISTRY_USERNAME:
27-
required: true
2826
DOCKER_REGISTRY_PASSWORD:
2927
required: true
28+
DOCKER_REGISTRY_USERNAME:
29+
required: true
3030

3131
permissions: {}
3232

3333
jobs:
3434
run-test:
35-
name: Integration Test (${{ (startsWith(matrix.runner, '[') && endsWith(matrix.runner, ']')) && join(matrix.runner, ', ') || matrix.runner }})
35+
name: 🐳 Integration Test (${{ (startsWith(matrix.runner, '[') && endsWith(matrix.runner, ']')) && join(matrix.runner, ', ') || matrix.runner }})
3636
strategy:
3737
matrix:
3838
runner: ${{ fromJson(inputs.build-test-runner-labels) }}
@@ -62,5 +62,5 @@ jobs:
6262
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
6363
if: ${{ !cancelled() }}
6464
with:
65-
name: test-results-integration-${{ inputs.image-basename }}-${{ steps.runner-arch.outputs.arch }}
65+
name: test-results-integration-docker-${{ inputs.image-basename }}-${{ steps.runner-arch.outputs.arch }}
6666
path: test-report-*.xml

.github/workflows/wc-integration-test-podman.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: Integration Test (Podman)
2+
name: 🦭 Integration Test
33

44
on:
55
workflow_call:
@@ -32,7 +32,7 @@ permissions: {}
3232

3333
jobs:
3434
run-test:
35-
name: Integration Test Podman (${{ (startsWith(matrix.runner, '[') && endsWith(matrix.runner, ']')) && join(matrix.runner, ', ') || matrix.runner }})
35+
name: 🦭 Integration Test (${{ (startsWith(matrix.runner, '[') && endsWith(matrix.runner, ']')) && join(matrix.runner, ', ') || matrix.runner }})
3636
strategy:
3737
matrix:
3838
runner: ${{ fromJson(inputs.build-test-runner-labels) }}

0 commit comments

Comments
 (0)