Skip to content

Commit b1fbaf8

Browse files
committed
(#15) Configure CI workflow for GitHub Actions
Configure GitHub Actions CI pipeline that runs on push and PR to main/develop branches. Includes linting, test coverage, and build across Node.js 20.x and 22.x. Coverage and build artifacts are uploaded and retained for 7 days. Closes #15
1 parent 8690851 commit b1fbaf8

2 files changed

Lines changed: 118 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
permissions:
10+
contents: read
11+
packages: read
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
lint:
19+
name: Lint
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Install pnpm
26+
uses: pnpm/action-setup@v4
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 20.x
32+
cache: pnpm
33+
registry-url: https://npm.pkg.github.com
34+
scope: '@nciocpl'
35+
36+
- name: Install dependencies
37+
run: pnpm install --frozen-lockfile
38+
env:
39+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Run linter
42+
run: pnpm run lint
43+
44+
test:
45+
name: Test (Node ${{ matrix.node-version }})
46+
runs-on: ubuntu-latest
47+
strategy:
48+
matrix:
49+
node-version: [20.x, 22.x]
50+
steps:
51+
- name: Checkout code
52+
uses: actions/checkout@v4
53+
54+
- name: Install pnpm
55+
uses: pnpm/action-setup@v4
56+
57+
- name: Setup Node.js ${{ matrix.node-version }}
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: ${{ matrix.node-version }}
61+
cache: pnpm
62+
registry-url: https://npm.pkg.github.com
63+
scope: '@nciocpl'
64+
65+
- name: Install dependencies
66+
run: pnpm install --frozen-lockfile
67+
env:
68+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
70+
- name: Run tests with coverage
71+
run: pnpm run test:coverage
72+
73+
- name: Upload coverage report
74+
if: matrix.node-version == '20.x'
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: coverage-report
78+
path: coverage/
79+
retention-days: 7
80+
81+
build:
82+
name: Build (Node ${{ matrix.node-version }})
83+
runs-on: ubuntu-latest
84+
strategy:
85+
matrix:
86+
node-version: [20.x, 22.x]
87+
steps:
88+
- name: Checkout code
89+
uses: actions/checkout@v4
90+
91+
- name: Install pnpm
92+
uses: pnpm/action-setup@v4
93+
94+
- name: Setup Node.js ${{ matrix.node-version }}
95+
uses: actions/setup-node@v4
96+
with:
97+
node-version: ${{ matrix.node-version }}
98+
cache: pnpm
99+
registry-url: https://npm.pkg.github.com
100+
scope: '@nciocpl'
101+
102+
- name: Install dependencies
103+
run: pnpm install --frozen-lockfile
104+
env:
105+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106+
107+
- name: Build
108+
run: pnpm run build
109+
110+
- name: Upload build artifacts
111+
if: matrix.node-version == '20.x'
112+
uses: actions/upload-artifact@v4
113+
with:
114+
name: build-output
115+
path: dist/
116+
retention-days: 7

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@
115115
"vitest": "^3.0.0",
116116
"vitest-axe": "^0.1.0"
117117
},
118+
"packageManager": "pnpm@8.6.12",
118119
"engines": {
119-
"node": ">=18.0.0"
120+
"node": ">=20.0.0"
120121
}
121122
}

0 commit comments

Comments
 (0)