User instructions modal (issue #2885 item 3) #3414
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 Application tests | |
| on: pull_request | |
| jobs: | |
| test: | |
| name: Frontend tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: 22 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| package_json_file: frontend/package.json | |
| - name: Install dependencies | |
| working-directory: ./frontend | |
| run: pnpm install | |
| - name: Lint *.js files | |
| working-directory: ./frontend | |
| run: pnpm lint:js | |
| - name: Lint *.gts/*.gjs templates | |
| working-directory: ./frontend | |
| run: pnpm lint:hbs | |
| - name: Run tests | |
| working-directory: ./frontend | |
| run: pnpm test | |
| - name: Run test build | |
| working-directory: ./frontend | |
| run: pnpm build | |
| coverage: | |
| name: Test coverage changes | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: 22 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| package_json_file: frontend/package.json | |
| - name: Install dependencies | |
| working-directory: ./frontend | |
| run: pnpm install | |
| - name: Run coverage on PR branch | |
| working-directory: ./frontend | |
| run: pnpm test:coverage | |
| - name: Save PR coverage | |
| id: pr_coverage | |
| run: | | |
| coverage=$(node -e "const c=require('./frontend/coverage/coverage-summary.json'); console.log(c.total.statements.pct)") | |
| echo "value=$coverage" >> "$GITHUB_OUTPUT" | |
| echo "PR coverage: $coverage%" | |
| - name: Checkout base branch for reference coverage | |
| run: | | |
| git fetch origin ${{ github.event.pull_request.base.ref }} | |
| git checkout origin/${{ github.event.pull_request.base.ref }} | |
| - name: Install base branch dependencies | |
| working-directory: ./frontend | |
| run: pnpm install | |
| - name: Run coverage on base branch | |
| id: base_coverage | |
| working-directory: ./frontend | |
| run: | | |
| rm -rf coverage | |
| pnpm test:coverage || true | |
| if [ -f coverage/coverage-summary.json ]; then | |
| coverage=$(node -e "const c=require('./coverage/coverage-summary.json'); console.log(c.total.statements.pct)") | |
| else | |
| coverage=0 | |
| fi | |
| echo "value=$coverage" >> "$GITHUB_OUTPUT" | |
| echo "Base coverage: $coverage%" | |
| - name: Post coverage comment | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const prCoverage = '${{ steps.pr_coverage.outputs.value }}'; | |
| const baseCoverage = '${{ steps.base_coverage.outputs.value }}'; | |
| const diff = (parseFloat(prCoverage) - parseFloat(baseCoverage)).toFixed(2); | |
| const sign = diff >= 0 ? '+' : ''; | |
| const body = `Frontend test coverage: **${prCoverage}%** (${sign}${diff}% compared to ${baseCoverage}% on base)`; | |
| try { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body, | |
| }); | |
| } catch (e) { | |
| console.log('Could not post comment:', e.message); | |
| console.log(body); | |
| } | |
| # build: | |
| # name: App build | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # with: | |
| # fetch-depth: 0 | |
| # - name: Change dir to frontend | |
| # run: cd frontend | |
| # - uses: simplabs/ember-asset-size-action@v1 | |
| # with: | |
| # working-directory: ./frontend | |
| # repo-token: "${{ secrets.GITHUB_TOKEN }}" |