feat(frontend): Utils to check dismissed notifications #61888
Workflow file for this run
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: Frontend Checks | |
| on: | |
| pull_request: | |
| merge_group: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: {} | |
| jobs: | |
| format: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Create GitHub App Token | |
| uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 | |
| continue-on-error: true | |
| id: app-token | |
| with: | |
| app-id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID }} | |
| private-key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }} | |
| - name: Check if commits can be added | |
| id: check_can_add_commit | |
| run: | | |
| echo "can_add_commit=$CAN_ADD_COMMIT" >> $GITHUB_OUTPUT | |
| env: | |
| CAN_ADD_COMMIT: ${{ steps.app-token.outputs.token != '' && github.event_name == 'pull_request' }} | |
| - name: Checkout for pull request | |
| if: steps.check_can_add_commit.outputs.can_add_commit == 'true' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| token: ${{ steps.app-token.outputs.token }} | |
| persist-credentials: false | |
| - name: Checkout | |
| if: steps.check_can_add_commit.outputs.can_add_commit == 'false' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Prepare | |
| uses: ./.github/actions/prepare | |
| - name: Restore Prettier Cache | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| with: | |
| path: ./node_modules/.cache/prettier/.prettier-cache | |
| key: ${{ runner.os }}-prettier-cache-format-${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && format('main-{0}', github.sha) || github.event.pull_request.number || github.event.merge_group.head_sha || github.run_id }} | |
| restore-keys: | | |
| ${{ runner.os }}-prettier-cache-format-main- | |
| ${{ runner.os }}-prettier-cache-format- | |
| - name: Restore ESLint Cache | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| with: | |
| path: .eslintcache | |
| key: ${{ runner.os }}-eslint-cache-format-${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && format('main-{0}', github.sha) || github.event.pull_request.number || github.event.merge_group.head_sha || github.run_id }} | |
| restore-keys: | | |
| ${{ runner.os }}-eslint-cache-format-main- | |
| ${{ runner.os }}-eslint-cache-format- | |
| - name: Format | |
| run: npm run format | |
| - name: Check for Changes | |
| id: check_changes | |
| run: | | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| echo "changes_detected=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changes_detected=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit format | |
| if: steps.check_can_add_commit.outputs.can_add_commit == 'true' && steps.check_changes.outputs.changes_detected == 'true' | |
| uses: ./.github/actions/add-and-commit | |
| with: | |
| message: '🤖 Apply formatting changes' | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: Fail for formatting issues without personal access token | |
| if: steps.check_can_add_commit.outputs.can_add_commit == 'false' && steps.check_changes.outputs.changes_detected == 'true' | |
| run: | | |
| echo "Formatting changes are needed but couldn't be committed because the personal access token isn't available or this isn't a pull request." | |
| exit 1 | |
| lint: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Prepare | |
| uses: ./.github/actions/prepare | |
| - name: Restore Prettier Cache | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| with: | |
| path: ./node_modules/.cache/prettier/.prettier-cache | |
| key: ${{ runner.os }}-prettier-cache-lint-${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && format('main-{0}', github.sha) || github.event.pull_request.number || github.event.merge_group.head_sha || github.run_id }} | |
| restore-keys: | | |
| ${{ runner.os }}-prettier-cache-lint-main- | |
| ${{ runner.os }}-prettier-cache-lint- | |
| - name: Restore ESLint Cache | |
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | |
| with: | |
| path: .eslintcache | |
| key: ${{ runner.os }}-eslint-cache-lint-${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && format('main-{0}', github.sha) || github.event.pull_request.number || github.event.merge_group.head_sha || github.run_id }} | |
| restore-keys: | | |
| ${{ runner.os }}-eslint-cache-lint-main- | |
| ${{ runner.os }}-eslint-cache-lint- | |
| - name: Lint | |
| run: npm run lint -- --max-warnings 0 | |
| check: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Prepare | |
| uses: ./.github/actions/prepare | |
| - name: Check | |
| run: npm run check | |
| - name: Check tests | |
| run: npm run check:tests | |
| test: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| shardIndex: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] | |
| shardTotal: [20] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Prepare | |
| uses: ./.github/actions/prepare | |
| - name: Set Environment Variables | |
| run: echo "VITE_ALCHEMY_API_KEY=${{ secrets.VITE_ALCHEMY_API_KEY_TEST_FE }}" >> $GITHUB_ENV | |
| - name: Test | |
| # We disable the thresholds since we will check them in the next step, when all sharded reports are merged | |
| run: npm run test:coverage -- --reporter=blob --reporter=default --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --coverage.thresholds.0 --coverage.thresholds.autoUpdate=false | |
| - name: Upload Blob Coverage Report | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| if: always() | |
| with: | |
| name: vitest-coverage-${{ github.event_name }}-${{ github.run_id }}-${{ github.run_attempt }}-shard-${{ matrix.shardIndex }} | |
| path: .vitest-reports/* | |
| include-hidden-files: true | |
| retention-days: 1 | |
| test-coverage: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| needs: [test] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Prepare | |
| uses: ./.github/actions/prepare | |
| - name: Download Blob Coverage Reports | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| path: .vitest-reports | |
| pattern: vitest-coverage-${{ github.event_name }}-${{ github.run_id }}-${{ github.run_attempt }}-shard-* | |
| merge-multiple: true | |
| - name: Merge Coverage Reports | |
| run: npm run test:merge | |
| - name: Upload Coverage Report | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| if: always() | |
| with: | |
| name: vitest-coverage-merged-${{ github.event_name }}-${{ github.run_id }}-${{ github.run_attempt }} | |
| path: coverage/ | |
| retention-days: 3 | |
| config-preparation: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| outputs: | |
| network-matrix: ${{ steps.set-matrix.outputs.network-matrix }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Prepare | |
| uses: ./.github/actions/prepare | |
| - name: Set Network Matrix | |
| id: set-matrix | |
| run: | | |
| NETWORKS=$(scripts/build.ic-domains.test.list | jq -R . | jq -s -c .) | |
| echo "network-matrix=$NETWORKS" >> $GITHUB_OUTPUT | |
| config-build: | |
| runs-on: ubuntu-24.04 | |
| needs: config-preparation | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| network: ${{ fromJson(needs.config-preparation.outputs.network-matrix) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Prepare | |
| uses: ./.github/actions/prepare | |
| - name: Install dfx | |
| uses: dfinity/setup-dfx@e50c04f104ee4285ec010f10609483cf41e4d365 # main | |
| - name: Check ic-domains | |
| continue-on-error: true | |
| run: | | |
| FILE="ic-domain.$NETWORK.txt" | |
| echo "" > "$FILE" | |
| dfx build frontend --network "$NETWORK" >/dev/null 2>/dev/null && \ | |
| cat build/.well-known/ic-domains > "$FILE" && \ | |
| echo " $NETWORK" >> "$FILE" | |
| env: | |
| NETWORK: ${{ matrix.network }} | |
| - name: Upload Domain File | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: ic-domains-${{ matrix.network }} | |
| path: ic-domain.${{ matrix.network }}.txt | |
| retention-days: 1 | |
| config: | |
| runs-on: ubuntu-24.04 | |
| needs: config-build | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Prepare | |
| uses: ./.github/actions/prepare | |
| - name: Download All Domain Files | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| path: ic-domains | |
| pattern: ic-domains-* | |
| merge-multiple: true | |
| - name: Merge All Domain Files | |
| run: | | |
| cat ic-domains/*.txt > combined.ic-domains.txt | |
| - name: Run Domain Validation | |
| run: scripts/build.ic-domains.test combined.ic-domains.txt | |
| lockfile: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Prepare | |
| uses: ./.github/actions/prepare | |
| - name: Lint lock file | |
| run: npm run lint:lockfile | |
| frontend-checks-pass: | |
| if: always() | |
| needs: ['format', 'lint', 'check', 'test', 'test-coverage', 'config', 'lockfile'] | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/needs_success | |
| with: | |
| needs: '${{ toJson(needs) }}' |