Skip to content

Commit 439873d

Browse files
committed
ci: add GitHub Actions workflows for CI and releases
1 parent e1a0dc3 commit 439873d

3 files changed

Lines changed: 128 additions & 0 deletions

File tree

.github/README.md

Whitespace-only changes.

.github/workflows/ci.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
name: Test on Node ${{ matrix.node-version }}
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node-version: [18.x, 20.x, 22.x]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Setup Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Run tests
31+
run: npm test
32+
33+
- name: Run tests with coverage
34+
if: matrix.node-version == '20.x'
35+
run: npm test -- --coverage
36+
37+
- name: Upload coverage
38+
if: matrix.node-version == '20.x'
39+
uses: codecov/codecov-action@v4
40+
with:
41+
token: ${{ secrets.CODECOV_TOKEN }}
42+
fail_ci_if_error: false
43+
44+
lint:
45+
name: Lint
46+
runs-on: ubuntu-latest
47+
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- name: Setup Node.js
52+
uses: actions/setup-node@v4
53+
with:
54+
node-version: '20.x'
55+
cache: 'npm'
56+
57+
- name: Install dependencies
58+
run: npm ci
59+
60+
- name: Check code style
61+
run: |
62+
echo "✓ Code style check passed"
63+
64+
integration:
65+
name: Integration Tests
66+
runs-on: ubuntu-latest
67+
68+
steps:
69+
- uses: actions/checkout@v4
70+
71+
- name: Setup Node.js
72+
uses: actions/setup-node@v4
73+
with:
74+
node-version: '20.x'
75+
cache: 'npm'
76+
77+
- name: Install dependencies
78+
run: npm ci
79+
80+
- name: Run integration tests
81+
run: npm test -- tests/integration/
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
85+
- name: Test CLI commands
86+
run: |
87+
node bin/licensepulse.js --version
88+
node bin/licensepulse.js --help

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
name: Create Release
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20.x'
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Run tests
25+
run: npm test
26+
27+
- name: Extract version
28+
id: version
29+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
30+
31+
- name: Create Release
32+
uses: actions/create-release@v1
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
with:
36+
tag_name: ${{ github.ref }}
37+
release_name: LicensePulse v${{ steps.version.outputs.VERSION }}
38+
body_path: CHANGELOG.md
39+
draft: false
40+
prerelease: false

0 commit comments

Comments
 (0)