From eaa1780e1a0309de4ed909c6abe54217a15b992e Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Mon, 19 Feb 2024 14:50:22 +0100 Subject: [PATCH 1/2] fix: Revert condition --- k6/performance-tests/generate-github-actions.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/k6/performance-tests/generate-github-actions.mjs b/k6/performance-tests/generate-github-actions.mjs index 8e377862f..d4d7594d3 100644 --- a/k6/performance-tests/generate-github-actions.mjs +++ b/k6/performance-tests/generate-github-actions.mjs @@ -88,7 +88,7 @@ env: jobs: run_tests: - if: github.event.deployment_status.state == 'success' && github.event_name == 'pull_request' + if: github.event.deployment_status.state == 'success' name: Run tests runs-on: ubuntu-latest steps: @@ -151,3 +151,5 @@ function getRunCommand( checkTiming ? "true" : "false" } - Date: Mon, 19 Feb 2024 15:22:13 +0100 Subject: [PATCH 2/2] fix: PR GQL GitHub Action --- .github/workflows/performance-tests-pr.yml | 18 +--- .github/workflows/performance-tests.yml | 90 +++++++++---------- .../generate-github-actions.mjs | 9 +- 3 files changed, 50 insertions(+), 67 deletions(-) diff --git a/.github/workflows/performance-tests-pr.yml b/.github/workflows/performance-tests-pr.yml index 9bdce4cd6..844cb9bc1 100644 --- a/.github/workflows/performance-tests-pr.yml +++ b/.github/workflows/performance-tests-pr.yml @@ -7,7 +7,7 @@ env: jobs: run_tests: - if: github.event.deployment_status.state == 'success' && github.event_name == 'pull_request' + if: github.event.deployment_status.state == 'success' name: Run tests runs-on: ubuntu-latest steps: @@ -22,21 +22,7 @@ jobs: image: grafana/k6:latest options: -v ${{ github.workspace }}:/root run: | - echo "SUMMARY=${SUMMARY}$(k6 run --tag testid=DataCubeComponents --env ENV=PR --env ENDPOINT=${{ github.event.deployment_status.target_url }}/api/graphql --env CUBE_IRI=https://energy.ld.admin.ch/sfoe/bfe_ogd84_einmalverguetung_fuer_photovoltaikanlagen/9 --env CUBE_LABEL=Photovoltaikanlagen/9 --env ROOT_PATH=/root/ --env CHECK_TIMING=true - > $GITHUB_ENV && - echo "SUMMARY=${SUMMARY}$(k6 run --tag testid=DataCubeComponents --env ENV=PR --env ENDPOINT=${{ github.event.deployment_status.target_url }}/api/graphql --env CUBE_IRI=https://environment.ld.admin.ch/foen/nfi/nfi_C-20/cube/2023-3 --env CUBE_LABEL=NFI/2023-3 --env ROOT_PATH=/root/ --env CHECK_TIMING=true - > $GITHUB_ENV && - echo "SUMMARY=${SUMMARY}$(k6 run --tag testid=DataCubeComponents --env ENV=PR --env ENDPOINT=${{ github.event.deployment_status.target_url }}/api/graphql --env CUBE_IRI=https://energy.ld.admin.ch/elcom/electricityprice --env CUBE_LABEL=Elcom --env ROOT_PATH=/root/ --env CHECK_TIMING=true - > $GITHUB_ENV && - echo "SUMMARY=${SUMMARY}$(k6 run --tag testid=DataCubeMetadata --env ENV=PR --env ENDPOINT=${{ github.event.deployment_status.target_url }}/api/graphql --env CUBE_IRI=https://energy.ld.admin.ch/sfoe/bfe_ogd84_einmalverguetung_fuer_photovoltaikanlagen/9 --env CUBE_LABEL=Photovoltaikanlagen/9 --env ROOT_PATH=/root/ --env CHECK_TIMING=true - > $GITHUB_ENV && - echo "SUMMARY=${SUMMARY}$(k6 run --tag testid=DataCubeMetadata --env ENV=PR --env ENDPOINT=${{ github.event.deployment_status.target_url }}/api/graphql --env CUBE_IRI=https://environment.ld.admin.ch/foen/nfi/nfi_C-20/cube/2023-3 --env CUBE_LABEL=NFI/2023-3 --env ROOT_PATH=/root/ --env CHECK_TIMING=true - > $GITHUB_ENV && - echo "SUMMARY=${SUMMARY}$(k6 run --tag testid=DataCubeMetadata --env ENV=PR --env ENDPOINT=${{ github.event.deployment_status.target_url }}/api/graphql --env CUBE_IRI=https://energy.ld.admin.ch/elcom/electricityprice --env CUBE_LABEL=Elcom --env ROOT_PATH=/root/ --env CHECK_TIMING=true - > $GITHUB_ENV && - echo "SUMMARY=${SUMMARY}$(k6 run --tag testid=DataCubeObservations --env ENV=PR --env ENDPOINT=${{ github.event.deployment_status.target_url }}/api/graphql --env CUBE_IRI=https://energy.ld.admin.ch/sfoe/bfe_ogd84_einmalverguetung_fuer_photovoltaikanlagen/9 --env CUBE_LABEL=Photovoltaikanlagen/9 --env ROOT_PATH=/root/ --env CHECK_TIMING=true - > $GITHUB_ENV && - echo "SUMMARY=${SUMMARY}$(k6 run --tag testid=DataCubeObservations --env ENV=PR --env ENDPOINT=${{ github.event.deployment_status.target_url }}/api/graphql --env CUBE_IRI=https://environment.ld.admin.ch/foen/nfi/nfi_C-20/cube/2023-3 --env CUBE_LABEL=NFI/2023-3 --env ROOT_PATH=/root/ --env CHECK_TIMING=true - > $GITHUB_ENV && - echo "SUMMARY=${SUMMARY}$(k6 run --tag testid=DataCubeObservations --env ENV=PR --env ENDPOINT=${{ github.event.deployment_status.target_url }}/api/graphql --env CUBE_IRI=https://energy.ld.admin.ch/elcom/electricityprice --env CUBE_LABEL=Elcom --env ROOT_PATH=/root/ --env CHECK_TIMING=true - > $GITHUB_ENV && - echo "SUMMARY=${SUMMARY}$(k6 run --tag testid=DataCubePreview --env ENV=PR --env ENDPOINT=${{ github.event.deployment_status.target_url }}/api/graphql --env CUBE_IRI=https://energy.ld.admin.ch/sfoe/bfe_ogd84_einmalverguetung_fuer_photovoltaikanlagen/9 --env CUBE_LABEL=Photovoltaikanlagen/9 --env ROOT_PATH=/root/ --env CHECK_TIMING=true - > $GITHUB_ENV && - echo "SUMMARY=${SUMMARY}$(k6 run --tag testid=DataCubePreview --env ENV=PR --env ENDPOINT=${{ github.event.deployment_status.target_url }}/api/graphql --env CUBE_IRI=https://environment.ld.admin.ch/foen/nfi/nfi_C-20/cube/2023-3 --env CUBE_LABEL=NFI/2023-3 --env ROOT_PATH=/root/ --env CHECK_TIMING=true - > $GITHUB_ENV && - echo "SUMMARY=${SUMMARY}$(k6 run --tag testid=DataCubePreview --env ENV=PR --env ENDPOINT=${{ github.event.deployment_status.target_url }}/api/graphql --env CUBE_IRI=https://energy.ld.admin.ch/elcom/electricityprice --env CUBE_LABEL=Elcom --env ROOT_PATH=/root/ --env CHECK_TIMING=true - > $GITHUB_ENV && - echo "SUMMARY=${SUMMARY}$(k6 run --tag testid=PossibleFilters --env ENV=PR --env ENDPOINT=${{ github.event.deployment_status.target_url }}/api/graphql --env CUBE_IRI=https://energy.ld.admin.ch/sfoe/bfe_ogd84_einmalverguetung_fuer_photovoltaikanlagen/9 --env CUBE_LABEL=Photovoltaikanlagen/9 --env ROOT_PATH=/root/ --env CHECK_TIMING=true - > $GITHUB_ENV && - echo "SUMMARY=${SUMMARY}$(k6 run --tag testid=PossibleFilters --env ENV=PR --env ENDPOINT=${{ github.event.deployment_status.target_url }}/api/graphql --env CUBE_IRI=https://environment.ld.admin.ch/foen/nfi/nfi_C-20/cube/2023-3 --env CUBE_LABEL=NFI/2023-3 --env ROOT_PATH=/root/ --env CHECK_TIMING=true - > $GITHUB_ENV && - echo "SUMMARY=${SUMMARY}$(k6 run --tag testid=PossibleFilters --env ENV=PR --env ENDPOINT=${{ github.event.deployment_status.target_url }}/api/graphql --env CUBE_IRI=https://energy.ld.admin.ch/elcom/electricityprice --env CUBE_LABEL=Elcom --env ROOT_PATH=/root/ --env CHECK_TIMING=true - > $GITHUB_ENV + echo "SUMMARY=$(k6 run --tag testid=DataCubeComponents --env ENV=PR --env ENDPOINT=${{ github.event.deployment_status.target_url }}/api/graphql --env CUBE_IRI=https://energy.ld.admin.ch/sfoe/bfe_ogd84_einmalverguetung_fuer_photovoltaikanlagen/9 --env CUBE_LABEL=Photovoltaikanlagen/9 --env ROOT_PATH=/root/ --env CHECK_TIMING=true - > $GITHUB_ENV - name: GQL performance tests ✅ if: ${{ env.SUMMARY == '' }} run: | diff --git a/.github/workflows/performance-tests.yml b/.github/workflows/performance-tests.yml index 37556426e..21de26a3c 100644 --- a/.github/workflows/performance-tests.yml +++ b/.github/workflows/performance-tests.yml @@ -23,48 +23,48 @@ jobs: -e K6_PROMETHEUS_RW_SERVER_URL=${{ secrets.K6_PROMETHEUS_RW_SERVER_URL }} -e K6_PROMETHEUS_RW_TREND_STATS=avg run: | - 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 ROOT_PATH=/root/ --env CHECK_TIMING=false - { ) ) ) - .map((command) => `echo "SUMMARY=\${SUMMARY}$(${command})" >> $GITHUB_ENV`) - .join(" &&\n "); + .join(" && "); const file = `name: GraphQL performance tests (PR) on: [deployment_status] @@ -103,7 +102,7 @@ jobs: image: grafana/k6:latest options: -v \${{ github.workspace }}:/root run: | - ${commands} + echo "SUMMARY=$(${commands})" >> $GITHUB_ENV - name: GQL performance tests ✅ if: \${{ env.SUMMARY == '' }} run: | @@ -149,7 +148,5 @@ function getRunCommand( cube.iri } --env CUBE_LABEL=${cube.label} --env ROOT_PATH=/root/ --env CHECK_TIMING=${ checkTiming ? "true" : "false" - } -