name: "CI: Frontend" defaults: run: shell: bash on: pull_request: paths: - 'frontend/**' - 'common/**' - 'render-wasm/**' types: - opened - synchronize - ready_for_review push: branches: - develop - staging paths: - 'frontend/**' - 'common/**' - 'render-wasm/**' concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true permissions: contents: read jobs: test-frontend: if: ${{ !github.event.pull_request.draft }} permissions: contents: read pull-requests: write # coverage comment on the PR name: "Frontend Tests" runs-on: penpot-extended-runner container: image: penpotapp/devenv:latest volumes: - /var/cache/github-runner/m2:/root/.m2 - /var/cache/github-runner/gitlib:/root/.gitlibs steps: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Lint working-directory: ./frontend run: | pnpm install; pnpm run check-fmt:js pnpm run check-fmt:clj pnpm run check-fmt:scss pnpm run lint:clj pnpm run lint:js pnpm run lint:scss - name: Unit Tests working-directory: ./frontend run: | ./scripts/test - name: Coverage summary if: ${{ !cancelled() && hashFiles('frontend/coverage/lcov.info') != '' }} run: | node scripts/coverage-summary.mjs \ --title "Frontend unit test coverage" \ --note "Logic namespaces under \`frontend/src/app\`, without \`app/main/ui\`." \ --lcov frontend/coverage/lcov.info \ --unloaded frontend/coverage/unloaded.txt \ > frontend/coverage/summary.md cat frontend/coverage/summary.md >> "$GITHUB_STEP_SUMMARY" - name: Coverage comment # Fork PRs get a read-only token, so only branches of this repo comment. if: ${{ !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && hashFiles('frontend/coverage/lcov.info') != '' }} continue-on-error: true env: GITHUB_TOKEN: ${{ github.token }} PR_NUMBER: ${{ github.event.pull_request.number }} HEAD_SHA: ${{ github.event.pull_request.head.sha }} run: | node scripts/coverage-comment.mjs \ --project Frontend \ --lcov frontend/coverage/lcov.info \ --json-summary frontend/coverage/coverage-summary.json \ --unloaded frontend/coverage/unloaded.txt - name: Upload coverage report uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 if: ${{ !cancelled() }} with: name: frontend-coverage path: frontend/coverage/ overwrite: true if-no-files-found: ignore retention-days: 7 - name: Component Tests working-directory: ./frontend env: VITEST_BROWSER_TIMEOUT: 120000 run: | ./scripts/test-components