From b4ec3957a55232ad0178b72a21137e46eb631836 Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Mon, 19 Feb 2024 14:38:09 +0100 Subject: [PATCH 1/2] fix: Do not run PR GQL tests on main branch --- k6/performance-tests/generate-github-actions.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k6/performance-tests/generate-github-actions.mjs b/k6/performance-tests/generate-github-actions.mjs index 0524ca3c6..23f2a2d5f 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' + if: github.event.deployment_status.state == 'success' && github.event_name == 'pull_request' name: Run tests runs-on: ubuntu-latest steps: From 50050356ee2769f46b5de45a41d237743fff84fa Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Mon, 19 Feb 2024 14:38:29 +0100 Subject: [PATCH 2/2] fix: Codegen command --- .github/workflows/performance-tests-pr.yml | 32 +++++++++---------- .../generate-github-actions.mjs | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/performance-tests-pr.yml b/.github/workflows/performance-tests-pr.yml index 166c1be60..9bdce4cd6 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' + if: github.event.deployment_status.state == 'success' && github.event_name == 'pull_request' name: Run tests runs-on: ubuntu-latest steps: @@ -22,21 +22,21 @@ 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=${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 - name: GQL performance tests ✅ if: ${{ env.SUMMARY == '' }} run: | diff --git a/k6/performance-tests/generate-github-actions.mjs b/k6/performance-tests/generate-github-actions.mjs index 23f2a2d5f..8e377862f 100644 --- a/k6/performance-tests/generate-github-actions.mjs +++ b/k6/performance-tests/generate-github-actions.mjs @@ -77,7 +77,7 @@ const generatePRTests = () => { ) ) ) - .map((command) => `echo "SUMMARY=$SUMMARY$(${command})" >> $GITHUB_ENV`) + .map((command) => `echo "SUMMARY=\${SUMMARY}$(${command})" >> $GITHUB_ENV`) .join(" &&\n "); const file = `name: GraphQL performance tests (PR)