Test use cases for environment test #12
This file contains hidden or 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: Test Use Cases On environment | |
| on: | |
| push: | |
| workflow_dispatch: | |
| schedule: | |
| inputs: | |
| environment: | |
| description: 'Environment to run tests against' | |
| required: true | |
| default: 'test' | |
| type: choice | |
| options: | |
| - yt01 | |
| - at22 | |
| - at23 | |
| - at24 | |
| - test | |
| - staging | |
| - production | |
| workflow_call: | |
| inputs: | |
| environment: | |
| description: 'Environment to run tests against' | |
| required: true | |
| type: string | |
| run-name: Test use cases for environment ${{ inputs.environment || github.event.inputs.environment || 'test' }} | |
| jobs: | |
| usecase-test: | |
| environment: ${{ inputs.environment || github.event.inputs.environment || 'test' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Run use case tests | |
| uses: grafana/k6-action@e4714b734f2b0afaabeb7b4a69142745548ab9ec # v0.3.1 | |
| env: | |
| base_url: ${{ secrets.BROKER_BASE_URL }} | |
| mp_client_id: ${{ secrets.USECASE_MASKINPORTEN_CLIENT_ID }} | |
| mp_kid: ${{ secrets.USECASE_MASKINPORTEN_KID }} | |
| mp_client_pem: ${{ secrets.USECASE_MASKINPORTEN_PEM }} | |
| with: | |
| filename: tests/Altinn.Broker.UseCaseTests/case_initialize.js | |
| - name: Build failure report | |
| if: failure() | |
| run: | | |
| report=":warning: Broker use case test failure :warning: \n" | |
| report+="\n Environment: ${{ inputs.environment || github.event.inputs.environment || 'test' }}" | |
| report+="\n Workflow: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| echo "stepreport=$report" >> $GITHUB_ENV | |
| - name: Report failure to Slack | |
| if: failure() | |
| id: slack | |
| uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1 | |
| with: | |
| webhook-type: incoming-webhook | |
| webhook: ${{ secrets.USECASE_SLACK_URL || secrets.SLACK_URL }} | |
| payload: | | |
| { | |
| "text": "${{ env.stepreport }}" | |
| } |