Periodic End-to-End Test #1747
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: Periodic End-to-End Test | |
| on: | |
| schedule: | |
| # Run this every hour to see if all is well | |
| - cron: "0 * * * *" | |
| workflow_dispatch: | |
| # Add `workflow_dispatch` so this can be run manually in case it was not run as scheduled | |
| env: | |
| issue_title_prefix: "Probleem op productie:" | |
| MAINTAINERS: "matijs,eslook,Robbert" | |
| jobs: | |
| test-e2e: | |
| runs-on: ubuntu-latest | |
| environment: Issues | |
| env: | |
| E2E_RETRIES: 3 | |
| E2E_TIMEOUT_GLOBAL: 250000 | |
| E2E_TIMEOUT_TEST: 30000 | |
| E2E_TIMEOUT_EXPECT: 10000 | |
| E2E_TARGET_URL: https://theme-wizard.nl-design-system-community.nl/ | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Install pnpm package manager | |
| uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0 | |
| - name: Set up Node.js version and cache | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| cache: "pnpm" | |
| node-version-file: .nvmrc | |
| - name: Check for known security issues with npm packages | |
| run: | | |
| echo "Auditing npm dependencies before installing them. For more information, see: https://nldesignsystem.nl/pnpm-audit" | |
| pnpm audit --audit-level critical | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Install headless browsers for end-to-end testing | |
| run: pnpm run test-install-browsers | |
| - name: End-to-end tests | |
| run: pnpm run test-e2e | |
| - name: Notify Slack channel of failure | |
| if: failure() | |
| uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1 | |
| with: | |
| method: chat.postMessage | |
| token: ${{ secrets.SLACK_BOT_TOKEN }} | |
| payload: | | |
| channel: ${{ secrets.SLACK_CHANNEL_ID }} | |
| text: | | |
| *Theme Wizard E2E failed* | |
| Workflow: ${{ github.workflow }} (run #${{ github.run_number }}) | |
| <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run> | |
| create-issue: | |
| if: ${{ failure() }} | |
| runs-on: ubuntu-latest | |
| needs: test-e2e | |
| environment: Issues | |
| steps: | |
| - name: Create GitHub App Token | |
| id: app-token | |
| uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # 3.0.0 | |
| with: | |
| app-id: ${{ vars.NL_DESIGN_SYSTEM_BOT_APP_ID }} | |
| private-key: ${{ secrets.NL_DESIGN_SYSTEM_BOT_PRIVATE_KEY }} | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup nl_NL locale | |
| run: | | |
| sudo locale-gen nl_NL.UTF-8 | |
| sudo update-locale LC_TIME=nl_NL.UTF-8 LC_ALL | |
| - name: Find existing issue | |
| id: find-existing-issue | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| run: | | |
| ISSUE=$(gh issue list --author "${{ steps.app-token.outputs.app-slug }}[bot]" --state open --search "${{ env.issue_title_prefix }}" --limit 1 --json number --jq first.number) | |
| echo "issue=${ISSUE}" | tee -a $GITHUB_OUTPUT | |
| - name: Close existing issue | |
| if: ${{ steps.find-existing-issue.outputs.issue != '' }} | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| run: gh issue close ${{ steps.find-existing-issue.outputs.issue }} | |
| - name: Create new issue | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| run: gh issue create --title "${{ env.issue_title_prefix }} Falende test op $(LC_TIME=nl_NL.UTF-8 date -u +'%e %B %Y om %H:%M')" --assignee "${MAINTAINERS}" --body-file .github/workflows/periodic-e2e.md |