vercel.deployment.success #58
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: k6 preview tests | |
| on: | |
| repository_dispatch: | |
| types: | |
| - 'vercel.deployment.success' | |
| workflow_dispatch: | |
| inputs: | |
| host: | |
| description: 'Set the host' | |
| required: true | |
| default: '' | |
| jobs: | |
| k6-preview-tests: | |
| runs-on: ubuntu-latest | |
| env: | |
| ENV_HOST: ${{ github.event.inputs.host || github.event.client_payload.url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup k6 browser environment | |
| uses: grafana/setup-k6-action@v1 | |
| with: | |
| k6-version: '1.4.0' | |
| browser: true | |
| - name: Install k6 extensions | |
| working-directory: e2e-tests/k6 | |
| run: | | |
| go install go.k6.io/xk6/cmd/xk6@latest | |
| export PATH=$(go env GOPATH)/bin:$PATH | |
| xk6 build v1.4.0 --with github.com/avitalique/xk6-file@latest | |
| - name: Install dependencies | |
| working-directory: e2e-tests/k6 | |
| run: | | |
| yarn install | |
| - name: Run k6 tests | |
| working-directory: e2e-tests/k6 | |
| run: | | |
| ./k6 run runTest.ts | |
| env: | |
| host: ${{ env.ENV_HOST }} | |
| - name: Request log | |
| run: | | |
| if find e2e-tests/k6/logs -maxdepth 1 -name "requests.log" | grep -q .; then | |
| cat e2e-tests/k6/logs/requests.log | |
| else | |
| echo "### ⚠️ Test errors" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "See more details in the workflow" >> $GITHUB_STEP_SUMMARY | |
| echo "⚠️ No requests log is found, failing the job." | |
| exit 1 | |
| fi | |
| - name: Notify Slack | |
| run: | | |
| ./e2e-tests/k6/integration/slack_notification.sh ${{ secrets.ATB_SLACK_TOKEN }} e2e_tests ${{ github.run_id }} | |
| - name: Fail on any errors | |
| run: | | |
| if find e2e-tests/k6/logs -maxdepth 1 -name "errors.log" | grep -q .; then | |
| echo "### ⚠️ Test errors" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "See more details in the workflow" >> $GITHUB_STEP_SUMMARY | |
| echo "⚠️ Errors are found, failing the job." | |
| cat e2e-tests/k6/logs/errors.log | |
| exit 1 | |
| else | |
| echo "✅ All good!" >> $GITHUB_STEP_SUMMARY | |
| echo "✅ All good!" | |
| fi |