Skip to content

Commit b3eb88f

Browse files
authored
ci: add test (#99)
issues: * ci: add test (#98) commits: * ci: add test (2c72db9)
1 parent 023b2ee commit b3eb88f

File tree

4 files changed

+170
-125
lines changed

4 files changed

+170
-125
lines changed

.github/workflows/release.yml

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ on:
66
- '[0-9].[0-9].x'
77
- '[0-9].x.x'
88
- '[0-9].x'
9-
# - master
109
- main
1110
- next
12-
# - next-major
1311
- rc
1412
- beta
1513
- alpha
@@ -22,48 +20,52 @@ jobs:
2220
contents: write
2321
issues: write
2422
steps:
25-
# Checkout
23+
2624
- name: Checkout
2725
uses: actions/checkout@v4
2826
with:
2927
fetch-depth: 0
3028
token: ${{ secrets.TOKEN }}
31-
# Import GPG Key
32-
- name: Import GPG key
29+
30+
- name: Import GPG
3331
uses: crazy-max/ghaction-import-gpg@v6
3432
with:
3533
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
3634
passphrase: ${{ secrets.PASSPHRASE }}
3735
git_user_signingkey: true
3836
git_commit_gpgsign: true
39-
# Setup NodeJs
40-
- name: Setup NodeJs
37+
38+
- name: Setup Node
4139
uses: actions/setup-node@v4
4240
with:
4341
node-version: "lts/*"
44-
# Install dependencies
45-
- name: Install dependencies
42+
43+
- name: Install Dependencies
4644
run: npm ci
47-
# Build source code
48-
- name: Build source code
45+
46+
- name: Build Source Code
4947
run: npm run build
50-
# Release
51-
- name: Release
48+
49+
- name: Run Test and Generate Coverage
50+
run: npm test
51+
52+
- name: Upload Coverage Reports to Codecov
53+
uses: codecov/codecov-action@v5
54+
with:
55+
token: ${{ secrets.CODECOV_TOKEN }}
56+
57+
- name: Release and Publish to NPM
5258
env:
53-
# variables
5459
GIT_AUTHOR_NAME: ${{ vars.GIT_AUTHOR_NAME }}
5560
GIT_AUTHOR_EMAIL: ${{ vars.GIT_AUTHOR_EMAIL }}
5661
GIT_COMMITTER_NAME: ${{ vars.GIT_COMMITTER_NAME }}
5762
GIT_COMMITTER_EMAIL: ${{ vars.GIT_COMMITTER_EMAIL }}
58-
# secrets
5963
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6064
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
61-
# node environments
62-
# NODE_ENV: 'production'
6365
run: npx semantic-release
64-
# Rebase to 'dev'
66+
6567
- name: Rebase to 'dev'
6668
run: |
6769
git checkout dev
6870
git pull --rebase origin main
69-
git push --force
71+
git push --force origin dev

.github/workflows/test.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- '[0-9].[0-9].x'
7+
- '[0-9].x.x'
8+
- '[0-9].x'
9+
- main
10+
- next
11+
- rc
12+
- beta
13+
- alpha
14+
15+
jobs:
16+
test:
17+
name: Test
18+
runs-on: ubuntu-latest
19+
steps:
20+
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 2 # At least fetch the last two commits for comparison
25+
26+
- name: Setup Node
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: "lts/*"
30+
31+
- name: Install Dependencies
32+
run: npm ci
33+
34+
- name: Build Source Code
35+
run: npm run build
36+
37+
- name: Run Test and Generate Coverage
38+
run: npm test
39+
40+
- name: Upload Coverage Reports to Codecov
41+
uses: codecov/codecov-action@v5
42+
with:
43+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)