Skip to content

Commit 00e94b1

Browse files
committed
chore: start with fixing integration tests
1 parent c651326 commit 00e94b1

File tree

5 files changed

+84
-42
lines changed

5 files changed

+84
-42
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,11 @@ jobs:
2828
id-token: write
2929
packages: write
3030
pull-requests: write
31+
32+
dependency-review:
33+
uses: ./.github/workflows/wc-dependency-review.yml
34+
with:
35+
runner-labels: ubuntu-latest
36+
permissions:
37+
contents: read
38+
pull-requests: write

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

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,6 @@ jobs:
3434
dockerfile: .devcontainer/${{ matrix.flavor }}/Dockerfile
3535
image-name: ${{ github.repository }}-${{ matrix.flavor }}
3636

37-
dependency-review:
38-
runs-on: ubuntu-latest
39-
permissions:
40-
contents: read
41-
pull-requests: write
42-
needs: build-push
43-
if: github.event_name == 'pull_request'
44-
steps:
45-
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
46-
with:
47-
disable-sudo-and-containers: true
48-
egress-policy: audit
49-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
50-
with:
51-
persist-credentials: false
52-
- uses: actions/dependency-review-action@56339e523c0409420f6c2c9a2f4292bbb3c07dd3 # v4.8.0
53-
with:
54-
comment-summary-in-pr: on-failure
55-
fail-on-severity: critical
56-
5737
integration-test:
5838
strategy:
5939
matrix:
@@ -62,8 +42,10 @@ jobs:
6242
needs: build-push
6343
uses: ./.github/workflows/wc-integration-test.yml
6444
with:
65-
flavor: ${{ matrix.flavor }}
66-
runner: ${{ matrix.runner }}
45+
fully-qualified-image-name: ${{ needs.build-push.outputs.fully-qualified-image-name }}
46+
image-basename: ${{ needs.build-push.outputs.image-basename }}
47+
test-file: test/${{ matrix.flavor }}/integration.bats
48+
runner-labels: ${{ matrix.runner }}
6749

6850
acceptance-test:
6951
strategy:

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ on:
3434
required: false
3535
type: string
3636
default: ubuntu-latest
37+
outputs:
38+
image-basename:
39+
description: "The sanitized base name of the image (without registry or tag)"
40+
value: ${{ jobs.sanitize-inputs.outputs.image-basename }}
41+
image-name:
42+
description: "The sanitized name of the image (without registry or tag)"
43+
value: ${{ jobs.sanitize-inputs.outputs.image-name }}
44+
fully-qualified-image-name:
45+
description: "The fully qualified name of the image including registry (but without tag)"
46+
value: ${{ jobs.sanitize-inputs.outputs.fully-qualified-image-name }}
3747
secrets:
3848
DOCKER_USERNAME:
3949
description: "User name for Docker login, if not provided the GitHub actor will be used"
@@ -48,9 +58,9 @@ jobs:
4858
sanitize-inputs:
4959
runs-on: ${{ inputs.default-runner }}
5060
outputs:
61+
image-basename: ${{ steps.sanitize-image-name.outputs.sanitized-basename }}
5162
image-name: ${{ steps.sanitize-image-name.outputs.sanitized-image-name }}
5263
fully-qualified-image-name: ${{ inputs.registry }}/${{ steps.sanitize-image-name.outputs.sanitized-image-name }}
53-
image-basename: ${{ steps.sanitize-image-name.outputs.sanitized-basename }}
5464
steps:
5565
- name: Sanitize image name
5666
id: sanitize-image-name
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Dependency Review
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
runner-labels:
8+
description: "Runner to use for the job, will be passed to `runs-on`"
9+
required: false
10+
type: string
11+
default: ubuntu-latest
12+
13+
permissions: {}
14+
15+
jobs:
16+
dependency-review:
17+
runs-on: ${{ inputs.runner-labels }}
18+
permissions:
19+
contents: read
20+
pull-requests: write
21+
steps:
22+
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
23+
with:
24+
disable-sudo-and-containers: true
25+
egress-policy: audit
26+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
27+
with:
28+
persist-credentials: false
29+
- uses: actions/dependency-review-action@56339e523c0409420f6c2c9a2f4292bbb3c07dd3 # v4.8.0
30+
with:
31+
comment-summary-in-pr: on-failure
32+
fail-on-severity: critical

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

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,28 @@ name: Integration Test
44
on:
55
workflow_call:
66
inputs:
7-
flavor:
7+
fully-qualified-image-name:
8+
required: false
9+
type: string
10+
image-basename:
811
required: true
912
type: string
10-
runner:
13+
test-file:
14+
required: true
15+
type: string
16+
runner-labels:
17+
description: "Runner to use for the job, will be passed to `runs-on`"
1118
required: true
1219
type: string
1320

14-
permissions:
15-
contents: read
16-
17-
env:
18-
CONTAINER_FLAVOR: ${{ inputs.flavor }}
19-
RUNNER: ${{ inputs.runner }}
21+
permissions: {}
2022

2123
jobs:
2224
determine-container:
23-
runs-on: ${{ inputs.runner }}
25+
runs-on: ${{ inputs.runner-labels }}
2426
outputs:
2527
container: ${{ steps.set-container.outputs.container }}
28+
runner-arch: ${{ steps.runner-arch.outputs.arch }}
2629
steps:
2730
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
2831
with:
@@ -32,17 +35,21 @@ jobs:
3235
id: runner-arch
3336
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
3437
with:
35-
path: ${{ runner.temp }}/digests-${{ inputs.flavor }}-${{ steps.runner-arch.outputs.arch }}
36-
pattern: digests-${{ inputs.flavor }}-${{ steps.runner-arch.outputs.arch }}
37-
- run: echo "container=$(printf "ghcr.io/${GH_REPO}-${CONTAINER_FLAVOR}@sha256:%s " *)" >> "$GITHUB_OUTPUT"
38-
working-directory: ${{ runner.temp }}/digests-${{ inputs.flavor }}-${{ steps.runner-arch.outputs.arch }}
38+
path: ${{ runner.temp }}/digests-${{ inputs.image-basename }}-${{ steps.runner-arch.outputs.arch }}
39+
pattern: digests-${{ inputs.image-basename }}-${{ steps.runner-arch.outputs.arch }}
40+
- run: echo "container=$(printf "${FULLY_QUALIFIED_IMAGE_NAME}@sha256:%s " *)" >> "$GITHUB_OUTPUT"
41+
working-directory: ${{ runner.temp }}/digests-${{ inputs.image-basename }}-${{ steps.runner-arch.outputs.arch }}
3942
env:
43+
FULLY_QUALIFIED_IMAGE_NAME: ${{ inputs.fully-qualified-image-name }}
4044
GH_REPO: ${{ github.repository }}
4145
id: set-container
46+
4247
run-test:
4348
needs: determine-container
44-
runs-on: ${{ inputs.runner }}
49+
runs-on: ${{ inputs.runner-labels }}
4550
container: ${{ needs.determine-container.outputs.container }}
51+
permissions:
52+
contents: read
4653
steps:
4754
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
4855
with:
@@ -52,15 +59,18 @@ jobs:
5259
with:
5360
persist-credentials: false
5461
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
55-
if: inputs.flavor == 'cpp'
5662
with:
5763
path: test/cpp/.xwin-cache
58-
key: xwin-cache-${{ inputs.runner }}
64+
key: xwin-cache-${{ needs.determine-container.outputs.runner-arch }}
5965
restore-keys: |
60-
xwin-cache
61-
- run: bats --formatter junit "test/${CONTAINER_FLAVOR}/integration-tests.bats" | tee "test-report-${CONTAINER_FLAVOR}-${RUNNER}.xml"
66+
xwin-cache-${{ needs.determine-container.outputs.runner-arch }}
67+
- run: bats --formatter junit "${TEST_FILE}" | tee "test-report-${IMAGE_BASENAME}-${RUNNER_ARCH}.xml"
68+
env:
69+
IMAGE_BASENAME: ${{ inputs.image-basename }}
70+
TEST_FILE: ${{ inputs.test-file }}
71+
RUNNER_ARCH: ${{ needs.determine-container.outputs.runner-arch }}
6272
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
6373
if: always()
6474
with:
65-
name: test-results-integration-${{ inputs.flavor }}-${{ inputs.runner }}
75+
name: test-results-integration-${{ inputs.image-basename }}-${{ needs.determine-container.outputs.runner-arch }}
6676
path: test-report-*.xml

0 commit comments

Comments
 (0)