-
Notifications
You must be signed in to change notification settings - Fork 29
249 lines (206 loc) · 7.2 KB
/
liveness.yml
File metadata and controls
249 lines (206 loc) · 7.2 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
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
name: Liveness
on:
# Allows the workflow to be called by release.yml
workflow_call:
inputs:
xk6-version:
required: true
type: string
description: "The xk6 release version to check (e.g., 1.2.5)"
xk6-it-version:
required: true
type: string
description: "The integration test suite version to use for checking (e.g., 1.1.1)"
# Allows manual triggering for ad-hoc checks
workflow_dispatch:
inputs:
xk6-version:
required: false
type: string
default: "latest"
description: "The xk6 release version to check (e.g., 1.2.5)"
xk6-it-version:
required: false
type: string
default: "submodule"
description: "The integration test suite version to use for checking (e.g., 1.1.1)"
jobs:
config:
name: Config
runs-on: ubuntu-latest
outputs:
xk6-version: ${{steps.configure.outputs.xk6-version}}
xk6-it-version: ${{steps.configure.outputs.xk6-it-version}}
permissions:
contents: read
steps:
- name: Configure
id: configure
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XK6_VERSION: ${{ inputs.xk6-version }}
XK6_IT_VERSION: ${{ inputs.xk6-it-version }}
run: |
set -euo pipefail
if [ -z "${XK6_VERSION}" ] || [ "${XK6_VERSION}" == "latest" ]; then
url=$(curl -s -I "https://github.com/grafana/xk6/releases/latest" | grep -i location)
XK6_VERSION="${url##*v}"
XK6_VERSION=${XK6_VERSION//[[:space:]]/}
else
XK6_VERSION="${XK6_VERSION##*v}"
fi
if [ -z "${XK6_IT_VERSION}" ] || [ "${XK6_IT_VERSION}" == "latest" ]; then
url=$(curl -s -I "https://github.com/grafana/xk6-it/releases/latest" | grep -i location)
XK6_IT_VERSION="${url##*v}"
XK6_IT_VERSION=${XK6_IT_VERSION//[[:space:]]/}
else
XK6_IT_VERSION="${XK6_IT_VERSION##*v}"
fi
echo "xk6-version=$XK6_VERSION" >> $GITHUB_OUTPUT
echo "xk6-it-version=$XK6_IT_VERSION" >> $GITHUB_OUTPUT
- name: Summary
shell: bash
env:
XK6_VERSION: ${{ steps.configure.outputs.xk6-version }}
XK6_IT_VERSION: ${{ steps.configure.outputs.xk6-it-version }}
run: |
set -euo pipefail
cat >> $GITHUB_STEP_SUMMARY <<END
### Configuration
Name | Description | Value
---------------|------------------------------------|--------------------------------
xk6-version | The xk6 release version to check | ${XK6_VERSION}
xk6-it-version | The integration test suite version | ${XK6_IT_VERSION}
END
native:
name: Native (${{ matrix.os }})
needs: ["config"]
runs-on: ${{ matrix.runner }}
permissions:
contents: read
strategy:
matrix:
os: [ubuntu, macos, windows]
include:
- os: ubuntu
runner: ubuntu-latest
platform: linux
arch: amd64
extension: tar.gz
- os: macos
runner: macos-latest
platform: darwin
arch: amd64
extension: tar.gz
- os: windows
runner: windows-latest
platform: windows
arch: amd64
extension: zip
env:
XK6_VERSION: ${{ needs.config.outputs.xk6-version }}
XK6_IT_VERSION: ${{ needs.config.outputs.xk6-it-version }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: true
fetch-depth: 0
fetch-tags: true
- name: Setup Bats
uses: bats-core/bats-action@77d6fb60505b4d0d1d73e48bd035b55074bbfb43 # 4.0.0
with:
bats-version: "1.13.0"
support-install: false
assert-install: false
detik-install: false
file-install: false
- name: Change integration test artifact
if: ${{ needs.config.outputs.xk6-it-version != 'submodule' }}
shell: bash
run: |
set -euo pipefail
TAG="v${XK6_IT_VERSION##*v}"
echo "::notice::Checking out xk6-it tag: $TAG"
cd it
git checkout "$TAG"
- name: Download release artifact
shell: bash
run: |
set -euo pipefail
TAG="v${XK6_VERSION##*v}"
PATTERN="xk6_*_${{ matrix.platform }}_${{ matrix.arch }}.${{ matrix.extension }}"
if [ "${{ matrix.extension }}" == "zip" ]; then
gh release download --repo grafana/xk6 --pattern "$PATTERN" -O xk6.zip $TAG
unzip -o xk6.zip xk6.exe
mv xk6.exe it/
VERSION_LINE=$(./it/xk6.exe version)
else
gh release download --repo grafana/xk6 --pattern "$PATTERN" -O - $TAG | tar -xzvf - xk6
mv xk6 it/
VERSION_LINE=$(./it/xk6 version)
fi
echo "::notice::Downloaded xk6 version: ${VERSION_LINE##xk6 version }"
- name: Run liveness tests
shell: bash
run: |
set -euo pipefail
cat >> $GITHUB_STEP_SUMMARY <<END
### Liveness Check (${{ matrix.os }})
xk6 version: $XK6_VERSION
END
bats --filter-tags xk6:liveness it/test | tee -a $GITHUB_STEP_SUMMARY
docker:
name: Docker
needs: ["config"]
runs-on: ubuntu-latest
permissions:
contents: read
env:
XK6_VERSION: ${{ needs.config.outputs.xk6-version }}
XK6_IT_VERSION: ${{ needs.config.outputs.xk6-it-version }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
submodules: true
fetch-depth: 0
fetch-tags: true
- name: Setup Bats
uses: bats-core/bats-action@77d6fb60505b4d0d1d73e48bd035b55074bbfb43 # 4.0.0
with:
bats-version: "1.13.0"
support-install: false
assert-install: false
detik-install: false
file-install: false
- name: Pull Docker image
shell: bash
run: |
set -euo pipefail
echo "::notice::Pulling Docker image: grafana/xk6:$XK6_VERSION"
docker pull grafana/xk6:$XK6_VERSION
cat >> $GITHUB_STEP_SUMMARY <<END
### Liveness Check (docker)
xk6 version: $XK6_VERSION
END
- name: Change integration test artifact
if: ${{ needs.config.outputs.xk6-it-version != 'submodule' }}
shell: bash
run: |
set -euo pipefail
TAG="v${XK6_IT_VERSION##*v}"
echo "::notice::Checking out xk6-it tag: $TAG"
cd it
git checkout "$TAG"
- name: Run liveness tests
shell: bash
run: |
set -euo pipefail
export XK6="docker run --rm -v $(pwd):/work -w /work grafana/xk6:$XK6_VERSION"
bats --filter-tags xk6:liveness it/test | tee -a $GITHUB_STEP_SUMMARY