-
Notifications
You must be signed in to change notification settings - Fork 317
136 lines (116 loc) · 3.66 KB
/
ci.yml
File metadata and controls
136 lines (116 loc) · 3.66 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: ci
on:
merge_group:
push:
branches:
- main
pull_request:
branches:
- main
permissions: {}
jobs:
changes:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
src: ${{ steps.filter.outputs.src }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: filter
with:
base: ${{ github.event.merge_group.base_sha || github.event.pull_request.base.sha || github.event.before }}
ref: ${{ github.event.merge_group.head_sha || github.sha }}
filters: |
src:
- 'src/**'
- 'test/**'
- 'scripts/**'
- 'playground/**'
- 'example/**'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- 'package.json'
- 'tsconfig.json'
- 'vitest.config.mts'
- 'build.config.ts'
- 'eslint.config.mjs'
- '.github/workflows/ci.yml'
lint:
needs: changes
if: needs.changes.outputs.src == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- run: corepack enable
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 22
cache: "pnpm"
- name: 📦 Install dependencies
run: pnpm install
- run: pnpm dev:prepare
- name: 🔠 Lint project
run: pnpm lint
- name: ✂️ Knip project
run: pnpm knip --workspace .
- name: ⚙️ Check package engines
run: pnpm installed-check -d --no-workspaces
ci:
needs: changes
if: needs.changes.outputs.src == 'true'
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- run: corepack enable
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: lts/-1
cache: "pnpm"
- name: 📦 Install dependencies
run: pnpm install
- name: Install Playwright
# does not need to explicitly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved
run: pnpm playwright-core install chromium
- run: pnpm dev:prepare
- name: 💪 Type check
run: pnpm test:types
- name: 🛠 Build project
run: pnpm build
- name: 🧪 Test project
run: pnpm test
- name: 💪 Type check (built)
run: pnpm test:built:types
- run: pnpm dev:build
- name: 🟩 Coverage
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
if: matrix.os != 'windows-latest'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
ci-ok:
if: always()
runs-on: ubuntu-latest
needs:
- changes
- lint
- ci
steps:
- name: Check required jobs
run: |
results=( \
"${{ needs.changes.result }}" \
"${{ needs.lint.result }}" \
"${{ needs.ci.result }}" \
)
for result in "${results[@]}"; do
if [[ "$result" == "failure" || "$result" == "cancelled" ]]; then
echo "One or more required jobs failed or were cancelled: $result"
exit 1
fi
done
echo "All required jobs passed or were skipped."