-
Notifications
You must be signed in to change notification settings - Fork 8
89 lines (75 loc) · 2.71 KB
/
test.yml
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
name: "Test"
on:
push:
branches:
- main
pull_request:
jobs:
# The bake file defines several targets for the bats group using a matrix.
# We expand these and parametrise a GitHub Actions matrix with each value.
expand_bake_matrix:
name: Find the bakefile targets to run
runs-on: ubuntu-latest
outputs:
bats_targets: ${{ steps.expand_bake_matrix.outputs.bats_targets }}
tesh_targets: ${{ steps.expand_bake_matrix.outputs.tesh_targets }}
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1
- name: Expand bats matrix
id: expand_bake_matrix
run: |
docker buildx bake bats tesh --print \
| jq -cer '{tesh: .group.tesh.targets, bats: .group.bats.targets}
| to_entries[]
| {name: .key, targets: .value}
| "\(.name)_targets=\(.targets | tojson)"' \
| tee -a "${GITHUB_OUTPUT:?}"
bats_tests:
name: Bats tests
runs-on: ubuntu-latest
needs:
- expand_bake_matrix
strategy:
matrix:
target: ${{ fromJSON(needs.expand_bake_matrix.outputs.bats_targets) }}
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1
- name: Run Bats Test Matrix
uses: docker/bake-action@f32f8b8d70bc284af19f8148dd14ad1d2fbc6c28
with:
targets: ${{ matrix.target }}
files: docker-bake.hcl
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
- name: Report Results
run: ./.github/workflows/report-results.sh
readme_examples:
name: README.md examples (run using Tesh to validate outputs)
runs-on: ubuntu-latest
needs:
- expand_bake_matrix
strategy:
matrix:
target: ${{ fromJSON(needs.expand_bake_matrix.outputs.tesh_targets) }}
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1
- name: Run Bats Test Matrix
uses: docker/bake-action@f32f8b8d70bc284af19f8148dd14ad1d2fbc6c28
with:
targets: ${{ matrix.target }}
files: docker-bake.hcl
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
- name: Report Results
run: ./.github/workflows/report-results.sh