Skip to content

Commit 6b762f5

Browse files
feat(CI.yml): add CI workflow for running tests, collecting coverage, and uploading to Codecov
feat(CI.yml): add workflow for publishing releases using semantic-release feat(release.config.js): add semantic-release configuration for npm and GitHub plugins
1 parent bf138ff commit 6b762f5

2 files changed

Lines changed: 72 additions & 0 deletions

File tree

.github/workflows/CI.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- "*"
9+
jobs:
10+
Test_and_Coverage:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Use Node.js
15+
uses: actions/setup-node@v2
16+
with:
17+
node-version: 20.x
18+
registry-url: https://registry.npmjs.org
19+
20+
- uses: actions/cache@v2
21+
with:
22+
path: "**/node_modules"
23+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
24+
25+
- name: Install dependencies
26+
run: yarn install --frozen-lockfile
27+
28+
- name: Run tests and collect coverage
29+
run: yarn coverage
30+
31+
- name: Upload coverage to Codecov
32+
uses: codecov/codecov-action@v4
33+
with:
34+
files: coverage/lcov.info
35+
flags: unittests
36+
verbose: true
37+
env:
38+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
39+
40+
Publish:
41+
runs-on: ubuntu-latest
42+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
43+
steps:
44+
- uses: actions/checkout@v2
45+
- name: Use Node.js
46+
uses: actions/setup-node@v2
47+
with:
48+
node-version: 20.x
49+
registry-url: https://registry.npmjs.org
50+
- uses: actions/cache@v2
51+
with:
52+
path: "**/node_modules"
53+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
54+
- name: Install dependencies
55+
run: yarn install --frozen-lockfile
56+
- name: Publish 🚀
57+
working-directory: ./
58+
run: npx semantic-release
59+
env:
60+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
61+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
62+
permissions:
63+
contents: write

release.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
plugins: [
3+
'@semantic-release/commit-analyzer',
4+
'@semantic-release/release-notes-generator',
5+
'@semantic-release/npm',
6+
'@semantic-release/github',
7+
],
8+
branches: ['master'],
9+
};

0 commit comments

Comments
 (0)