Skip to content

Commit 85fe0eb

Browse files
Nick Ficanoclaude
andcommitted
ci: add GitHub Actions test workflow
Runs unit tests on push to main and PRs, with caching, concurrency control, minimal permissions, and pinned action versions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0064463 commit 85fe0eb

1 file changed

Lines changed: 90 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# CI for typescript-sdk (ARCP)
2+
#
3+
# Action pinning policy:
4+
# - First-party actions (actions/*) use major version tags (e.g. @v4).
5+
# - Third-party actions are pinned to a full commit SHA with a version comment.
6+
#
7+
# package.json engines.node: ">=22"
8+
# Matrix covers floor (22), active LTS (22), and latest (24).
9+
10+
name: test
11+
12+
on:
13+
push:
14+
branches: [main]
15+
paths-ignore:
16+
- "**.md"
17+
- "docs/**"
18+
- "LICENSE"
19+
- ".gitignore"
20+
- ".editorconfig"
21+
pull_request:
22+
branches: [main]
23+
paths-ignore:
24+
- "**.md"
25+
- "docs/**"
26+
- "LICENSE"
27+
- ".gitignore"
28+
- ".editorconfig"
29+
workflow_dispatch:
30+
31+
concurrency:
32+
group: ${{ github.workflow }}-${{ github.ref }}
33+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
34+
35+
permissions:
36+
contents: read
37+
38+
jobs:
39+
test:
40+
name: test (node ${{ matrix.node }})
41+
runs-on: ubuntu-latest
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
node: ["22", "24"]
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v4
49+
with:
50+
fetch-depth: 1
51+
52+
- name: Setup pnpm
53+
# pnpm/action-setup v4.0.0
54+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.0.0
55+
with:
56+
version: 9.15.0
57+
run_install: false
58+
59+
- name: Setup Node.js ${{ matrix.node }}
60+
uses: actions/setup-node@v4
61+
with:
62+
node-version: ${{ matrix.node }}
63+
cache: "pnpm"
64+
65+
- name: Install dependencies
66+
run: pnpm install --frozen-lockfile
67+
68+
- name: Lint
69+
run: pnpm run lint
70+
71+
- name: Typecheck
72+
run: pnpm run typecheck
73+
74+
- name: Build
75+
run: pnpm run build
76+
77+
- name: Test
78+
run: pnpm test
79+
80+
- name: Upload test artifacts on failure
81+
if: failure()
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: test-artifacts-node-${{ matrix.node }}
85+
path: |
86+
coverage/
87+
test-results/
88+
*.log
89+
if-no-files-found: ignore
90+
retention-days: 7

0 commit comments

Comments
 (0)