-
Notifications
You must be signed in to change notification settings - Fork 7
195 lines (159 loc) · 5.19 KB
/
Copy pathbuild.yml
File metadata and controls
195 lines (159 loc) · 5.19 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: build
on:
push:
branches-ignore:
- gh-readonly-queue/**
pull_request:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main' && !startsWith(github.ref_name, 'maint/') && github.event_name == 'push' }}
env:
DRY_RUN: ${{ github.ref_name != github.event.repository.default_branch && !startsWith(github.ref_name, 'maint/') }}
permissions:
contents: read
jobs:
setup:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: ⚙️ Setup
uses: containerbase/internal-tools/setup@ac9e2d089fbe2bcee89ae22055028f54408869c9 # v4.6.64
with:
save-cache: true
test:
needs:
- setup
name: ${{ matrix.node-version == 22 && format('test ({0})', matrix.os) || format('test ({0}, node-{1})', matrix.os, matrix.node-version) }}
runs-on: ${{ matrix.os }}
# tests shouldn't need more time
timeout-minutes: 30
permissions:
id-token: write
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version:
- 22
- 24
env:
coverage: ${{ matrix.os == 'ubuntu-latest' && matrix.node-version == 22 }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 10 # required for coverage
show-progress: false
filter: blob:none # we don't need all blobs
- name: ⚙️ Setup
uses: containerbase/internal-tools/setup@ac9e2d089fbe2bcee89ae22055028f54408869c9 # v4.6.64
with:
checkout: false
node-version: ${{ matrix.node-version }}
save-cache: true
- name: Init platform
shell: bash
run: |
git config --global core.autocrlf false
git config --global core.symlinks true
echo "Node $(node --version)"
echo "pnpm $(pnpm --version)"
- name: Build
run: pnpm build
- name: Unit tests
run: pnpm vitest --coverage ${{ env.coverage }} --logHeapUsage
- name: Upload coverage
if: env.coverage == 'true' && github.event_name != 'merge_group' && !cancelled()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage
path: coverage
- name: Codecov test results
if: github.event_name != 'merge_group' && !cancelled()
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6.0.2
with:
use_oidc: true
report_type: test_results
flags: node${{ matrix.node-version }}-${{ runner.os }}
- name: Codecov coverage results
if: env.coverage == 'true' && github.event_name != 'merge_group'
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6.0.2
with:
use_oidc: true
flags: node${{ matrix.node-version }}-${{ runner.os }}
lint:
needs:
- setup
runs-on: ubuntu-latest
# lint shouldn't need more than 10 min
timeout-minutes: 15
steps:
- name: ⚙️ Setup
uses: containerbase/internal-tools/setup@ac9e2d089fbe2bcee89ae22055028f54408869c9 # v4.6.64
- name: Init platform
run: |
echo "Node $(node --version)"
echo "pnpm $(pnpm --version)"
- name: Lint
run: |
pnpm eslint -f gha
pnpm markdown-lint
pnpm prettier
- name: Type check
run: pnpm type-check
release:
needs:
- lint
- test
runs-on: ubuntu-latest
# release shouldn't need more than 5 min
timeout-minutes: 15
permissions:
contents: write
issues: write
id-token: write
steps:
# full checkout for semantic-release
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
show-progress: false
filter: blob:none # we don't need all blobs
- name: ⚙️ Setup
uses: containerbase/internal-tools/setup@ac9e2d089fbe2bcee89ae22055028f54408869c9 # v4.6.64
with:
checkout: false
- name: semantic-release
run: pnpm semantic-release --dry-run ${{env.DRY_RUN}} --ci ${{env.DRY_RUN != 'true'}}
env:
GITHUB_TOKEN: ${{ github.token }}
# Catch-all required check
success:
needs:
- setup
- lint
- test
- release
runs-on: ubuntu-latest
timeout-minutes: 1
if: always()
steps:
- name: Fail for failed or skipped setup job
if: |
needs.setup.result == 'failure' ||
needs.setup.result == 'skipped'
run: exit 1
- name: Fail for failed or skipped lint job
if: |
needs.lint.result == 'failure' ||
needs.lint.result == 'skipped'
run: exit 1
- name: Fail for failed or skipped lint job
if: |
needs.test.result == 'failure' ||
needs.test.result == 'skipped'
run: exit 1
- name: Fail for failed or skipped release job
if: |
needs.release.result == 'failure' ||
needs.release.result == 'skipped'
run: exit 1