-
Notifications
You must be signed in to change notification settings - Fork 7
96 lines (93 loc) · 3.33 KB
/
wc-integration-test-podman.yml
File metadata and controls
96 lines (93 loc) · 3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
name: 🦭 Integration Test
on:
workflow_call:
inputs:
build-test-runner-labels:
required: true
type: string
fully-qualified-image-name:
required: true
type: string
image-basename:
required: true
type: string
image-digest:
required: true
type: string
registry:
required: true
type: string
test-file:
required: true
type: string
secrets:
DOCKER_REGISTRY_PASSWORD:
required: true
DOCKER_REGISTRY_USERNAME:
required: true
permissions: {}
jobs:
run-test:
name: 🦭 Integration Test (${{ (startsWith(matrix.runner, '[') && endsWith(matrix.runner, ']')) && join(matrix.runner, ', ') || matrix.runner }})
strategy:
matrix:
runner: ${{ fromJson(inputs.build-test-runner-labels) }}
runs-on: ${{ matrix.runner }}
permissions:
contents: read
steps:
- uses: step-security/harden-runner@f808768d1510423e83855289c910610ca9b43176 # v2.17.0
with:
disable-sudo: false
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install Podman
run: |
sudo apt-get update
sudo apt-get install -y podman
podman --version
- name: Login to container registry
run: |
printf '%s' "${REGISTRY_PASSWORD}" | podman login "${REGISTRY}" --username "${REGISTRY_USERNAME}" --password-stdin
env:
REGISTRY: ${{ inputs.registry }}
REGISTRY_USERNAME: ${{ secrets.DOCKER_REGISTRY_USERNAME || github.actor }}
REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD || github.token }}
- name: Pull container image
run: |
podman pull "${IMAGE_WITH_DIGEST}"
env:
IMAGE_WITH_DIGEST: ${{ inputs.fully-qualified-image-name }}@${{ inputs.image-digest }}
- run: echo "arch=$(echo "${RUNNER_ARCH}" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
id: runner-arch
- name: Run integration tests using Podman
run: |
podman run --rm \
--network=host \
-v "${WORKSPACE}:${WORKSPACE}" \
-w "${WORKSPACE}" \
-e IMAGE_BASENAME="${IMAGE_BASENAME}" \
-e TEST_FILE="${TEST_FILE}" \
-e RUNNER_ARCH="${RUNNER_ARCH}" \
"${IMAGE_WITH_DIGEST}" \
bats --formatter junit "${TEST_FILE}" | tee "test-report-${IMAGE_BASENAME}-podman-${RUNNER_ARCH}.xml"
env:
IMAGE_BASENAME: ${{ inputs.image-basename }}
IMAGE_WITH_DIGEST: ${{ inputs.fully-qualified-image-name }}@${{ inputs.image-digest }}
RUNNER_ARCH: ${{ steps.runner-arch.outputs.arch }}
TEST_FILE: ${{ inputs.test-file }}
WORKSPACE: ${{ github.workspace }}
- name: Log out of container registry
if: ${{ always() }}
run: |
podman logout "${REGISTRY}"
env:
REGISTRY: ${{ inputs.registry }}
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: ${{ !cancelled() }}
with:
name: test-results-integration-podman-${{ inputs.image-basename }}-${{ steps.runner-arch.outputs.arch }}
path: test-report-*.xml