-
Notifications
You must be signed in to change notification settings - Fork 6
80 lines (69 loc) · 2.23 KB
/
Copy pathtest.yml
File metadata and controls
80 lines (69 loc) · 2.23 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
name: CI
on:
push:
branches: [dev]
pull_request:
types: [opened, synchronize, reopened]
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/${{ github.event.pull_request.base.ref }}...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" }
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: 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
- name: Upload coverage reports to Codecov
if: matrix.task.name == 'Unit Tests' && !cancelled()
uses: codecov/codecov-action@v5
with:
use_oidc: true
slug: sleepypod/core
flags: javascript
- name: Upload test results to Codecov
if: matrix.task.name == 'Unit Tests' && !cancelled()
uses: codecov/test-results-action@v1
with:
use_oidc: true
slug: sleepypod/core
files: test-results/junit.xml
flags: javascript