GraphQL performance tests (PR) #24
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: GraphQL performance tests (PR) | |
on: [deployment_status] | |
env: | |
SUMMARY: '' | |
jobs: | |
run_tests: | |
if: github.event.deployment_status.state == 'success' | |
name: Run tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out | |
uses: actions/checkout@v2 | |
- name: Send an HTTP request to start up the server | |
run: | | |
curl '${{ github.event.deployment_status.target_url }}/api/graphql' -X 'POST' -H 'Content-Type: application/json' -d '{"operationName":"DataCubeObservations","variables":{"locale":"en","sourceType":"sparql","sourceUrl":"https://lindas.admin.ch/query","cubeFilter":{"iri":"https://energy.ld.admin.ch/sfoe/bfe_ogd84_einmalverguetung_fuer_photovoltaikanlagen/9","filters":{"https://energy.ld.admin.ch/sfoe/bfe_ogd84_einmalverguetung_fuer_photovoltaikanlagen/Kanton":{"type":"single","value":"https://ld.admin.ch/canton/1"}}}},"query":"query DataCubeObservations($sourceType: String!, $sourceUrl: String!, $locale: String!, $cubeFilter: DataCubeObservationFilter!) { dataCubeObservations(sourceType: $sourceType, sourceUrl: $sourceUrl, locale: $locale, cubeFilter: $cubeFilter) }"}' | |
- name: Run k6 | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: grafana/k6:latest | |
options: -v ${{ github.workspace }}:/root | |
run: | | |
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 - </root/k6/performance-tests/graphql/DataCubeComponents.js --quiet && 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 - </root/k6/performance-tests/graphql/DataCubeComponents.js --quiet && 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 - </root/k6/performance-tests/graphql/DataCubeComponents.js --quiet && 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 - </root/k6/performance-tests/graphql/DataCubeMetadata.js --quiet && 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 - </root/k6/performance-tests/graphql/DataCubeMetadata.js --quiet && 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 - </root/k6/performance-tests/graphql/DataCubeMetadata.js --quiet && 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 - </root/k6/performance-tests/graphql/DataCubeObservations.js --quiet && 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 - </root/k6/performance-tests/graphql/DataCubeObservations.js --quiet && 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 - </root/k6/performance-tests/graphql/DataCubeObservations.js --quiet && 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 - </root/k6/performance-tests/graphql/DataCubePreview.js --quiet && 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 - </root/k6/performance-tests/graphql/DataCubePreview.js --quiet && 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 - </root/k6/performance-tests/graphql/DataCubePreview.js --quiet && 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 - </root/k6/performance-tests/graphql/PossibleFilters.js --quiet && 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 - </root/k6/performance-tests/graphql/PossibleFilters.js --quiet && 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 - </root/k6/performance-tests/graphql/PossibleFilters.js --quiet)" >> $GITHUB_ENV | |
- name: GQL performance tests ✅ | |
if: ${{ env.SUMMARY == '' }} | |
run: | | |
curl --request POST --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' --header 'content-type: application/json' --data '{ | |
"context": "GQL performance tests", | |
"state": "success", | |
"description": "GQL performance tests passed" | |
}' | |
- name: GQL performance tests 🚨 | |
if: ${{ env.SUMMARY != '' }} | |
run: | | |
curl --request POST --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' --header 'content-type: application/json' --data '{ | |
"context": "GQL performance tests", | |
"state": "failure", | |
"description": "GQL performance tests failed for the following queries: ${{ env.SUMMARY }}" | |
}' |