diff --git a/.github/workflows/performance-tests.yml b/.github/workflows/performance-tests.yml index 019068f58..7a839b5da 100644 --- a/.github/workflows/performance-tests.yml +++ b/.github/workflows/performance-tests.yml @@ -20,50 +20,93 @@ jobs: tar -xzf k6-v0.49.0-linux-amd64.tar.gz sudo cp k6-v0.49.0-linux-amd64/k6 /usr/local/bin/k6 export PATH=$PATH:/usr/local/bin - - name: Run k6 and upload results to Prometheus - run: | - K6_PROMETHEUS_RW_USERNAME=${{ secrets.K6_PROMETHEUS_RW_USERNAME }} K6_PROMETHEUS_RW_PASSWORD=${{ secrets.K6_PROMETHEUS_RW_PASSWORD }} K6_PROMETHEUS_RW_SERVER_URL=${{ secrets.K6_PROMETHEUS_RW_SERVER_URL }} K6_PROMETHEUS_RW_TREND_STATS=avg k6 run -o experimental-prometheus-rw --tag testid=DataCubeComponents --env ENV=test --env ENDPOINT=https://test.visualize.admin.ch/api/graphql --env CUBE_IRI=https://energy.ld.admin.ch/sfoe/bfe_ogd84_einmalverguetung_fuer_photovoltaikanlagen/9 --env CUBE_LABEL=Photovoltaikanlagen/9 --env CHECK_TIMING=false --env WORKSPACE=${{ github.workspace }} --quiet - { - const commands = envs - .flatMap((env) => - queries.flatMap((query) => - cubes.map( - (cube) => - "K6_PROMETHEUS_RW_USERNAME=${{ secrets.K6_PROMETHEUS_RW_USERNAME }} K6_PROMETHEUS_RW_PASSWORD=${{ secrets.K6_PROMETHEUS_RW_PASSWORD }} K6_PROMETHEUS_RW_SERVER_URL=${{ secrets.K6_PROMETHEUS_RW_SERVER_URL }} K6_PROMETHEUS_RW_TREND_STATS=avg " + - getRunCommand( - env, - query, - cube, - `https://${ - env === "prod" ? "" : `${env}.` - }visualize.admin.ch/api/graphql`, - true, - false - ) - ) + const commands = envs.flatMap((env) => + queries.flatMap((query) => + cubes.map( + (cube) => + "K6_PROMETHEUS_RW_USERNAME=${{ secrets.K6_PROMETHEUS_RW_USERNAME }} K6_PROMETHEUS_RW_PASSWORD=${{ secrets.K6_PROMETHEUS_RW_PASSWORD }} K6_PROMETHEUS_RW_SERVER_URL=${{ secrets.K6_PROMETHEUS_RW_SERVER_URL }} K6_PROMETHEUS_RW_TREND_STATS=avg " + + getRunCommand( + env, + query, + cube, + `https://${ + env === "prod" ? "" : `${env}.` + }visualize.admin.ch/api/graphql`, + true, + false + ) ) ) - .join(" &&\n "); + ); const file = `# GENERATED FILE, DO NOT EDIT MANUALLY - use yarn run github:codegen instead name: GraphQL performance tests (auto) @@ -54,10 +52,12 @@ jobs: tar -xzf k6-v0.49.0-linux-amd64.tar.gz sudo cp k6-v0.49.0-linux-amd64/k6 /usr/local/bin/k6 export PATH=$PATH:/usr/local/bin - - name: Run k6 and upload results to Prometheus - run: | - ${commands} -`; +${commands + .map( + (command, i) => ` - name: Run k6 test (iteration ${i + 1}) + run: ${command}` + ) + .join("\n")}`; fs.writeFileSync("./.github/workflows/performance-tests.yml", file); };