Repository navigation
122 lines (106 loc) · 4.07 KB
/
Copy pathtest.yml
File metadata and controls
122 lines (106 loc) · 4.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: CI
on:
push:
branches: [dev]
pull_request:
types: [opened, synchronize, reopened]
# Merge queue: the required checks must also report on the temporary
# merge-group branch or every queue entry fails.
merge_group:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ci:
name: ${{ matrix.task.name }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
id-token: write
strategy:
fail-fast: false
matrix:
task:
- { name: "Lint", cmd: "CHANGED=$(git diff --name-only --diff-filter=d origin/${BASE_REF#refs/heads/}...HEAD -- '*.ts' '*.tsx' | head -200); if [ -n \"$CHANGED\" ]; then echo \"$CHANGED\" | xargs -d '\\n' pnpm eslint --; else echo 'No TS/TSX files changed'; fi" }
- { name: "Typecheck", cmd: "pnpm tsc" }
- { name: "Unit Tests", cmd: "pnpm test run --coverage --passWithNoTests" }
- { name: "Browser Tests", cmd: "NODE_ENV=production CI=1 pnpm build && pnpm test:browser" }
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
run_install: false
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: '.node-version'
cache: 'pnpm'
registry-url: 'https://npm.pkg.github.com'
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Setup Python for runtime integration
if: matrix.task.name == 'Unit Tests' || matrix.task.name == 'Browser Tests'
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Setup uv for runtime integration
if: matrix.task.name == 'Unit Tests' || matrix.task.name == 'Browser Tests'
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: Install locked runtime integration dependencies
if: matrix.task.name == 'Unit Tests' || matrix.task.name == 'Browser Tests'
working-directory: modules/piezo-processor
run: uv sync --locked --no-install-project
- name: Install browser
if: matrix.task.name == 'Browser Tests'
run: pnpm exec playwright install --with-deps chromium
- name: Cache Assets (Vitest)
id: asset-cache
uses: actions/cache@v5
with:
path: |
.vitest
key: assets-${{ runner.os }}-${{ hashFiles('src/db/schema.ts', 'vitest.config.ts') }}
- name: Run Task
run: ${{ matrix.task.cmd }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_ENV: test
# A PR carries base.ref; a merge-group run carries refs/heads/<base>.
BASE_REF: ${{ github.event.pull_request.base.ref || github.event.merge_group.base_ref }}
- name: Upload coverage reports to Codecov
if: github.repository == 'sleepypod/core' && matrix.task.name == 'Unit Tests' && !cancelled()
uses: codecov/codecov-action@v5
with:
use_oidc: true
# Avoid the cli.codecov.io binary CDN, which fails TLS on fork runners.
use_pypi: true
fail_ci_if_error: false
slug: sleepypod/core
flags: javascript
- name: Upload test results to Codecov
if: github.repository == 'sleepypod/core' && matrix.task.name == 'Unit Tests' && !cancelled()
uses: codecov/codecov-action@v5
with:
report_type: test_results
use_oidc: true
# Avoid the cli.codecov.io binary CDN, which fails TLS on fork runners.
use_pypi: true
fail_ci_if_error: false
slug: sleepypod/core
files: test-results/junit.xml
flags: javascript
- name: Upload browser evidence
if: matrix.task.name == 'Browser Tests' && !cancelled()
uses: actions/upload-artifact@v6
with:
name: calibration-browser-results
path: test-results/browser
retention-days: 7