-
Notifications
You must be signed in to change notification settings - Fork 14
65 lines (52 loc) · 1.8 KB
/
test_k6.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
# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: 'Test: k6'
on:
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/test_k6.yml'
- 'k6/**'
- 'services/.env.example'
- 'services/**'
- '!services/**.test.ts'
- '!services/**.spec.ts'
- '!**.md'
env:
k6TestsPath: 'k6/'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Node.js version
uses: actions/setup-node@v4
with:
node-version-file: '${{ env.k6TestsPath }}/.node-version'
cache: 'npm'
cache-dependency-path: '${{ env.k6TestsPath }}/package-lock.json'
- name: Set ENV-variables for test-environment
run: |
cp ./services/.env.example services/.env
- name: Run Services with Docker
working-directory: ./services
run: |
docker --log-level 'warn' compose -f docker-compose.yml up -d --quiet-pull --wait --wait-timeout 300
- name: Install k6 dependencies
working-directory: ${{ env.k6TestsPath }}
run: |
npm ci --omit=optional --no-fund --no-audit
- name: Lint k6 tests
working-directory: ${{ env.k6TestsPath }}
run: 'npm run lint'
- name: Download k6
working-directory: ${{ env.k6TestsPath }}
run: |
curl https://github.com/grafana/k6/releases/download/v0.51.0/k6-v0.51.0-linux-amd64.tar.gz -L | tar xvz --strip-components 1
- name: Run k6 tests
working-directory: ${{ env.k6TestsPath }}
run: |
npx dotenv -e ../services/.env -- ./k6 run tests/getProgramWithManyAttributes.js
- name: Docker logs
if: always()
uses: jwalton/gh-docker-logs@v2