-
Notifications
You must be signed in to change notification settings - Fork 1
118 lines (106 loc) · 4.35 KB
/
taxreport-loadtest-ondemand.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
name: taxreport loadtest ondemand
on:
workflow_dispatch:
inputs:
vus:
description: 'Number of VUS'
required: true
default: 10
type: number
duration:
description: 'Duration of test, ie 30s, 1m, 10m'
required: true
default: 1m
type: string
limit:
description: 'Limit the number of tokens to generate, 0 or less means create for every partyId/userId'
required: true
default: 10
type: number
select-runner:
description: 'Select runner to run the test'
required: true
type: choice
default: "'ubuntu-latest'"
options:
- "'ubuntu-latest'"
- "['self-hosted', 'macOS', 'X64']"
- "['self-hosted', 'X64', 'Windows']"
jobs:
run-taxreport-ondemand:
runs-on: ${{ fromJSON(inputs.select-runner) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate tokens (Linux/Mac)
if: runner.os != 'Windows'
working-directory: ./performance-tests/tax-report/src
run: ../../generate-tokens/src/generate-tokens.sh ../../generate-tokens/src ${{ inputs.limit }}
env:
API_ENVIRONMENT: ${{ secrets.YTENVIRONMENT }}
TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKENGENUSER }}
TOKEN_GENERATOR_PASSWORD: ${{ secrets.TOKENGENPWD }}
- name: Generate tokens (Windows)
if: runner.os == 'Windows'
working-directory: ./performance-tests/tax-report/src
run: pwsh ../../generate-tokens/src/generate-tokens.ps1 `
-testdatafilepath ../../generate-tokens/src `
-limit ${{ inputs.limit }} `
-API_ENVIRONMENT ${{ secrets.YTENVIRONMENT }} `
-TOKEN_GENERATOR_USERNAME ${{ secrets.TOKENGENUSER }} `
-TOKEN_GENERATOR_PASSWORD ${{ secrets.TOKENGENPWD }}
env:
API_ENVIRONMENT: ${{ secrets.YTENVIRONMENT }}
TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKENGENUSER }}
TOKEN_GENERATOR_PASSWORD: ${{ secrets.TOKENGENPWD }}
- name: Generate tokens
working-directory: ./performance-tests/tax-report/src
run: ../../generate-tokens/src/generate-tokens.sh ../../generate-tokens/src ${{ inputs.limit }}
env:
API_ENVIRONMENT: ${{ secrets.YTENVIRONMENT }}
TOKEN_GENERATOR_USERNAME: ${{ secrets.TOKENGENUSER }}
TOKEN_GENERATOR_PASSWORD: ${{ secrets.TOKENGENPWD }}
- name: Setup K6
uses: grafana/setup-k6-action@v1
- name: Run local k6 test
uses: grafana/run-k6-action@v1
with:
path: performance-tests/tax-report/src/tax-report.js
flags: --vus=${{ inputs.vus }} --duration=${{ inputs.duration }}
env:
K6_WEB_DASHBOARD: true
K6_WEB_DASHBOARD_EXPORT: html-report.html
K6_CLOUD_TOKEN: ${{ secrets.K6_CLOUD_TOKEN }}
K6_CLOUD_PROJECT_ID: ${{ secrets.K6_CLOUD_PROJECT_ID }}
serviceowner: ${{ secrets.OWNER }}
- name: Upload summary html report
uses: actions/upload-artifact@v4
if: always()
with:
name: summary-html
path: summary.html
- name: Upload extended html report
uses: actions/upload-artifact@v4
if: always()
with:
name: extended-html
path: html-report.html
- name: Upload summary text report
uses: actions/upload-artifact@v4
if: always()
with:
name: summary-txt
path: stdout.txt
- name: Upload HTML report to Azure
if: always()
shell: bash
run: |
REPORT_DIR='taxreports_ondemand-${{ github.run_number }}-${{ github.run_attempt }}'
azcopy cp --recursive "*.html" "https://altinnloadtests.blob.core.windows.net/\$web/$REPORT_DIR"
echo "::Link to test results summary: title=HTML report url::https://altinnloadtests.z1.web.core.windows.net/$REPORT_DIR/summary.html"
echo "::Link to test results extended: title=HTML report url::https://altinnloadtests.z1.web.core.windows.net/$REPORT_DIR/html-report.html"
env:
AZCOPY_AUTO_LOGIN_TYPE: SPN
AZCOPY_SPA_APPLICATION_ID: ${{ secrets.AZCOPY_SPA_APPLICATION_ID }}
AZCOPY_SPA_CLIENT_SECRET: ${{ secrets.AZCOPY_SPA_CLIENT_SECRET }}
AZCOPY_TENANT_ID: ${{ secrets.AZCOPY_TENANT_ID }}