Skip to content

Commit 75215cc

Browse files
authored
Add CI/CD quality gates and Dependabot config
* Add CI/CD quality gates and Dependabot config Enforce coverage thresholds in CI and publish, add security audit, version-tag validation, GitHub Release creation, and Dependabot for automated dependency updates targeting develop. * Split CI into separate lint, audit, and test jobs * Remove redundant push trigger for develop in CI * Add Node.js version label to test job names
1 parent 388ad77 commit 75215cc

5 files changed

Lines changed: 93 additions & 15 deletions

File tree

.github/dependabot.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: npm
5+
directory: /
6+
schedule:
7+
interval: weekly
8+
day: monday
9+
target-branch: develop
10+
open-pull-requests-limit: 10
11+
groups:
12+
dev-deps:
13+
dependency-type: development
14+
update-types:
15+
- minor
16+
- patch
17+
prod-deps:
18+
dependency-type: production
19+
update-types:
20+
- minor
21+
- patch
22+
23+
- package-ecosystem: github-actions
24+
directory: /
25+
schedule:
26+
interval: weekly
27+
day: monday
28+
target-branch: develop
29+
open-pull-requests-limit: 10

.github/pull_request_template.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Implementation approach.
1212

1313
## Checklist
1414

15-
- [ ] Tests pass (`pnpm test`)
15+
- [ ] Tests pass (`pnpm test:coverage`)
1616
- [ ] Linting passes (`pnpm lint`)
17+
- [ ] Formatting passes (`pnpm format:check`)
1718
- [ ] Build succeeds (`pnpm build`)
1819
- [ ] Documentation updated (if applicable)

.github/workflows/ci.yml

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,45 @@ on:
44
push:
55
branches: [main]
66
pull_request:
7-
branches: [main]
7+
branches: [main, develop]
88

99
jobs:
10-
build-and-test:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: pnpm/action-setup@v4
16+
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: 22
20+
cache: pnpm
21+
22+
- run: pnpm install --frozen-lockfile
23+
24+
- run: pnpm lint
25+
26+
- run: pnpm format:check
27+
28+
audit:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- uses: pnpm/action-setup@v4
34+
35+
- uses: actions/setup-node@v4
36+
with:
37+
node-version: 22
38+
cache: pnpm
39+
40+
- run: pnpm install --frozen-lockfile
41+
42+
- run: pnpm audit --prod --audit-level=high
43+
44+
test:
45+
name: test (Node.js ${{ matrix.node-version }})
1146
runs-on: ubuntu-latest
1247
strategy:
1348
matrix:
@@ -27,11 +62,7 @@ jobs:
2762

2863
- run: pnpm build
2964

30-
- run: pnpm test
31-
32-
- run: pnpm lint
33-
34-
- run: pnpm format:check
65+
- run: pnpm test:coverage
3566

3667
- name: Verify probe size
3768
run: |

.github/workflows/publish.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
publish:
1010
runs-on: ubuntu-latest
1111
permissions:
12-
contents: read
12+
contents: write
1313
id-token: write
1414

1515
steps:
@@ -27,8 +27,25 @@ jobs:
2727

2828
- run: pnpm build
2929

30-
- run: pnpm test
30+
- run: pnpm test:coverage
31+
32+
- run: pnpm lint
33+
34+
- run: pnpm format:check
35+
36+
- name: Validate version matches tag
37+
run: |
38+
TAG_VERSION="${GITHUB_REF_NAME#v}"
39+
PKG_VERSION=$(node -p "require('./package.json').version")
40+
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
41+
echo "Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)"
42+
exit 1
43+
fi
3144
3245
- run: pnpm -r publish --no-git-checks --access public
3346
env:
3447
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
48+
49+
- uses: softprops/action-gh-release@v2
50+
with:
51+
generate_release_notes: true

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ pnpm install
1313
# Build all packages
1414
pnpm build
1515

16-
# Run tests
17-
pnpm test
16+
# Run tests with coverage
17+
pnpm test:coverage
1818
```
1919

2020
## Development Workflow
2121

22-
1. Create a feature branch from `main`
22+
1. Create a feature branch from `develop`
2323
2. Make your changes
2424
3. Ensure all checks pass:
2525
```bash
2626
pnpm build
27-
pnpm test
27+
pnpm test:coverage
2828
pnpm lint
2929
pnpm format:check
3030
```
31-
4. Open a pull request
31+
4. Open a pull request against `develop`
3232

3333
## Project Structure
3434

0 commit comments

Comments
 (0)