feat(WIP): result action #2017
This file contains 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: Run tests | |
on: | |
pull_request: | |
branches: | |
- "main" | |
- "**/main" | |
- "!release-please*" | |
types: | |
- opened | |
- reopened | |
- synchronize | |
jobs: | |
run-tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
node: [20] | |
steps: | |
- name: Checkout 🛎 | |
uses: actions/checkout@v4 | |
# necessary for git diff of changed files in the PR | |
with: | |
fetch-depth: 2 | |
- name: Setup node env 🏗 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
check-latest: true | |
- name: Cache node_modules 📦 | |
uses: actions/[email protected] | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies 👨🏻💻 | |
run: npm ci --prefer-offline --no-audit | |
- name: Run component tests 👀 | |
run: | | |
export CI_PATHS_CHANGED=$(git diff --name-only -r HEAD^1 HEAD) | |
npm run test:component | |
- name: Run e2e tests 👀 | |
run: | | |
export CI_PATHS_CHANGED=$(git diff --name-only -r HEAD^1 HEAD) &&npm run test:e2e | |
- name: Code coverage 📈 | |
run: | | |
npm run nyc:report | |
- name: Upload code coverage 📈 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage | |
path: coverage/lcov-report | |
- name: Upload failed test screenshots 📷 | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots |