-
Notifications
You must be signed in to change notification settings - Fork 22
179 lines (173 loc) · 4.76 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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches:
- 'main'
pull_request:
paths-ignore:
- '.github/*-releases.json'
env:
NODE_VERSION: "20"
BUILDX_VERSION: "v0.17.1"
BUILDKIT_IMAGE: "moby/buildkit:v0.16.0"
jobs:
test:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Test
uses: docker/bake-action@v5
with:
targets: test-coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Check coverage
run: |
if [ -f ./coverage/clover.xml ] && [ ! -f ./coverage/allSkipped.txt ]; then
echo "RUN_CODECOV=true" >> $GITHUB_ENV
else
echo "RUN_CODECOV=false" >> $GITHUB_ENV
fi
shell: bash
-
name: Upload coverage
uses: codecov/codecov-action@v4
if: env.RUN_CODECOV == 'true'
with:
file: ./coverage/clover.xml
flags: unit
token: ${{ secrets.CODECOV_TOKEN }}
prepare-itg:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.tests.outputs.matrix }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Enable corepack
run: |
corepack enable
yarn --version
-
name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
-
name: Install
run: yarn install
-
name: Create matrix
id: tests
run: |
declare -a tests
for test in $(yarn run test:itg-list); do
tests+=("${test#$(pwd)/__tests__/}")
done
echo "matrix=$(echo ${tests[@]} | jq -cR 'split(" ")')" >>${GITHUB_OUTPUT}
-
name: Show matrix
run: |
echo ${{ steps.tests.outputs.matrix }}
test-itg:
runs-on: ${{ matrix.os }}
needs:
- prepare-itg
strategy:
fail-fast: false
matrix:
test: ${{ fromJson(needs.prepare-itg.outputs.matrix) }}
os:
- ubuntu-latest
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
- macos-13
- macos-12
- windows-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
-
# FIXME: Needs to setup node twice on Windows due to a bug with runner
name: Setup Node
if: startsWith(matrix.os, 'windows')
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
-
name: Enable corepack
run: |
corepack enable
yarn --version
-
name: Install QEMU 9.0.2
if: startsWith(matrix.os, 'macos')
run: |
brew uninstall qemu || true
brew autoremove
curl -o /tmp/qemu.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/f1a9cf104a9a51779c7a532b658c490f69974839/Formula/q/qemu.rb
brew install /tmp/qemu.rb
-
name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
-
name: Set up Docker Buildx
if: startsWith(matrix.os, 'ubuntu')
uses: docker/setup-buildx-action@v3
with:
version: ${{ env.BUILDX_VERSION }}
driver: docker
-
name: Set up container builder
if: startsWith(matrix.os, 'ubuntu')
id: builder
uses: docker/setup-buildx-action@v3
with:
version: ${{ env.BUILDX_VERSION }}
driver-opts: image=${{ env.BUILDKIT_IMAGE }}
use: false
-
name: Install
run: yarn install
-
name: Test
run: |
yarn test:itg-coverage --runTestsByPath __tests__/${{ matrix.test }} --coverageDirectory=./coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CTN_BUILDER_NAME: ${{ steps.builder.outputs.name }}
TEST_FOR_SUMMARY: ${{ secrets.TEST_FOR_SUMMARY }}
-
name: Check coverage
run: |
if [ -f ./coverage/clover.xml ] && [ ! -f ./coverage/allSkipped.txt ]; then
echo "RUN_CODECOV=true" >> $GITHUB_ENV
else
echo "RUN_CODECOV=false" >> $GITHUB_ENV
fi
shell: bash
-
name: Upload coverage
uses: codecov/codecov-action@v4
if: env.RUN_CODECOV == 'true'
with:
file: ./coverage/clover.xml
flags: itg
token: ${{ secrets.CODECOV_TOKEN }}