Repository navigation
117 lines (102 loc) · 3.98 KB
/
Copy pathe2e-tests.yaml
File metadata and controls
117 lines (102 loc) · 3.98 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
name: 'E2E tests'
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master
- 'V*'
# deny-all default; each job below grants only the scopes it needs
permissions: {}
jobs:
# Docs-only changes (docs/, markdown, rst) can't affect the e2e tests. Detected once here so the
# (required) e2e-test job below can skip entirely on them: that keeps the check fast and avoids
# the cost of building/pushing images and running the full e2e suite for changes that can't have
# broken anything it tests. A job skipped via `if:` reports as a passing check, so this still
# satisfies the required status check, unlike skipping the workflow itself via a trigger-level
# path filter.
changes:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
persist-credentials: false
- name: Check for non-doc changes
id: filter
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
with:
predicate-quantifier: 'some-with-excludes'
filters: |
code:
- '**'
- '!docs/**'
- '!**/*.md'
- '!**/*.rst'
e2e-test:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' && (github.event.pull_request.merged || github.event.pull_request.head.repo.full_name == github.repository) }}
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
# use go version from go.mod.
go-version-file: 'go.mod'
cache: false
- name: Set up QEMU
uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
- name: Login to ghcr.io
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setting git SHA to PR head
if: ${{ github.event_name == 'pull_request' }}
run: echo "SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
- name: Setting git SHA to branch head
if: ${{ github.event_name != 'pull_request' }}
run: echo "SHA=${{ github.sha }}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7
with:
context: .
file: Dockerfile
platforms: linux/amd64
push: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
tags: ghcr.io/nuts-foundation/nuts-node-ci:${{ env.SHA }}
cache-from: type=gha,scope=e2e
cache-to: type=gha,scope=e2e,mode=max
- name: Run E2E tests
run: |
cd e2e-tests && \
find . -type f -name "docker-compose*.yml" | xargs -I{} sed -i "s~nutsfoundation/nuts-node:master~ghcr.io/nuts-foundation/nuts-node-ci:${SHA}~g" {} && \
find . -type f -name "run-test.sh" | xargs -I{} sed -i 's/docker-compose exec/docker-compose exec -T/g' {} && \
./run-tests.sh
- name: package cleanup
uses: dataaxiom/ghcr-cleanup-action@d52806a0dc70b430571a37da1fde39733ffd640f # v1
continue-on-error: true # action doesn't fail when this step fails
with:
owner: nuts-foundation
package: nuts-node-ci
token: ${{ secrets.GITHUB_TOKEN }}
keep-n-tagged: 3