-
Notifications
You must be signed in to change notification settings - Fork 1.3k
74 lines (68 loc) · 2.35 KB
/
xk6.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
name: xk6
on:
# Enable manually triggering this workflow via the API or web UI
workflow_dispatch:
push:
branches:
- master
pull_request:
defaults:
run:
shell: bash
jobs:
test-xk6:
strategy:
matrix:
go: [stable, tip]
platform: [ubuntu-latest, windows-2019, macos-latest]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.21.x
check-latest: true
- name: Install Go tip
if: matrix.go == 'tip'
run: |
go install golang.org/dl/gotip@latest
gotip download
echo "GOROOT=$HOME/sdk/gotip" >> "$GITHUB_ENV"
echo "GOPATH=$HOME/go" >> "$GITHUB_ENV"
echo "$HOME/go/bin" >> "$GITHUB_PATH"
echo "$HOME/sdk/gotip/bin" >> "$GITHUB_PATH"
- name: Run tests
run: |
set -x
which go
go version
export CGO_ENABLED=0
COMMIT_ID="${{ github.event.pull_request.head.sha }}"
if [[ "$COMMIT_ID" == "" ]]; then
COMMIT_ID="$(git rev-parse HEAD)" # branch, not PR merge commit
fi
echo "COMMIT_ID=$COMMIT_ID"
cd .github/workflows/xk6-tests
go install go.k6.io/xk6/cmd/xk6@master
if [ "${{ github.event_name }}" == "pull_request" -a \
"${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then
export XK6_K6_REPO="github.com/${{ github.event.pull_request.head.repo.full_name }}"
fi
GOPRIVATE="go.k6.io/k6" xk6 build "$COMMIT_ID" \
--output ./k6ext \
--with github.com/grafana/xk6-js-test="$(pwd)/xk6-js-test" \
--with github.com/grafana/xk6-output-test="$(pwd)/xk6-output-test"
./k6ext version
./k6ext run --out outputtest=output-results.txt xk6-test.js
OUTPUT_RESULT="$(cat output-results.txt)"
if [[ "$OUTPUT_RESULT" != "10" ]]; then
echo "output result was not as expected: $OUTPUT_RESULT"
exit 11
fi
SUMMARY_RESULT="$(cat summary-results.txt)"
if [[ "$SUMMARY_RESULT" != "10" ]]; then
echo "summary result was not as expected: $SUMMARY_RESULT"
exit 12
fi