Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: E2E Tests

on:
push:
branches:
- main
pull_request:
merge_group:

permissions:
contents: read

jobs:
changes:
runs-on: ubuntu-latest
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Detect relevant file changes
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: filter
with:
filters: |
code:
- '**/*.js'
- '**/*.ts'
- '**/*.css'
- 'tests/**'
- 'package*.json'

test-e2e:
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup

- name: Install Playwright browsers
run: npx playwright install --with-deps chromium

- name: Build generated files
run: npm run build

- name: Run E2E tests
run: npm run test:e2e

e2e-test-status:
needs: [changes, test-e2e]
if: always()
runs-on: ubuntu-latest
steps:
- name: Report status
run: |
if [[ "${{ needs.test-e2e.result }}" == "failure" ]]; then
echo "E2E tests failed"
exit 1
fi
echo "E2E tests passed or were skipped (no relevant files changed)"
32 changes: 1 addition & 31 deletions .github/workflows/ci.yml → .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Unit Tests

on:
schedule:
Expand Down Expand Up @@ -61,23 +61,6 @@ jobs:
verbose: true
fail_ci_if_error: false

test-e2e:
needs: changes
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/setup

- name: Install Playwright browsers
run: npx playwright install --with-deps chromium

- name: Build generated files
run: npm run build

- name: Run E2E tests
run: npm run test:e2e

unit-test-status:
needs: [changes, test]
if: always()
Expand All @@ -90,16 +73,3 @@ jobs:
exit 1
fi
echo "Unit tests passed or were skipped (no relevant files changed)"

e2e-test-status:
needs: [changes, test-e2e]
if: always()
runs-on: ubuntu-latest
steps:
- name: Report status
run: |
if [[ "${{ needs.test-e2e.result }}" == "failure" ]]; then
echo "E2E tests failed"
exit 1
fi
echo "E2E tests passed or were skipped (no relevant files changed)"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Unit Tests](https://github.com/nitrocode/token-deathclock/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/nitrocode/token-deathclock/actions/workflows/unit-tests.yml)
[![E2E Tests](https://github.com/nitrocode/token-deathclock/actions/workflows/e2e-tests.yml/badge.svg)](https://github.com/nitrocode/token-deathclock/actions/workflows/e2e-tests.yml)
[![Deploy](https://github.com/nitrocode/token-deathclock/actions/workflows/deploy.yml/badge.svg)](https://github.com/nitrocode/token-deathclock/actions/workflows/deploy.yml)
[![codecov](https://codecov.io/gh/nitrocode/token-deathclock/branch/main/graph/badge.svg)](https://codecov.io/gh/nitrocode/token-deathclock)
[![codecov](https://codecov.io/gh/nitrocode/token-deathclock/graph/badge.svg)](https://codecov.io/gh/nitrocode/token-deathclock)

> 🌐 **Live site:** [nitrocode.github.io/token-deathclock](https://nitrocode.github.io/token-deathclock/)

Expand Down Expand Up @@ -66,7 +66,7 @@ Unit-test coverage is tracked by [Codecov](https://codecov.io/gh/nitrocode/token

| Unit test coverage | Coverage breakdown |
|---|---|
| [![Codecov icicle](https://codecov.io/gh/nitrocode/token-deathclock/branch/main/graphs/icicle.svg)](https://codecov.io/gh/nitrocode/token-deathclock) | [![Codecov sunburst](https://codecov.io/gh/nitrocode/token-deathclock/branch/main/graphs/sunburst.svg)](https://codecov.io/gh/nitrocode/token-deathclock) |
| [![Codecov icicle](https://codecov.io/gh/nitrocode/token-deathclock/graphs/icicle.svg)](https://codecov.io/gh/nitrocode/token-deathclock) | [![Codecov sunburst](https://codecov.io/gh/nitrocode/token-deathclock/graphs/sunburst.svg)](https://codecov.io/gh/nitrocode/token-deathclock) |

E2E tests run in CI via Playwright (Chromium). Their pass/fail status is shown by the **E2E Tests** badge above.

Expand Down
15 changes: 14 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,26 @@
"/tests/e2e/"
],
"collectCoverageFrom": [
"death-clock-core.js"
"death-clock-core.js",
"script.js"
],
"coverageThreshold": {
"global": {
"lines": 80,
"functions": 80,
"branches": 70
},
"./death-clock-core.js": {
"statements": 80,
"functions": 80,
"branches": 70,
"lines": 80
},
"./script.js": {
"statements": 60,
"functions": 60,
"branches": 50,
"lines": 90
}
}
}
Expand Down
Loading
Loading