Skip to content

Commit a0fb8a7

Browse files
committed
ci: add test & release workflows
1 parent 6b02da4 commit a0fb8a7

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test & Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
lint-and-test:
10+
uses: ./.github/workflows/test.yml
11+
secrets: inherit
12+
13+
release:
14+
needs: lint-and-test
15+
16+
runs-on: ubuntu-latest
17+
env:
18+
node-version: 18
19+
20+
steps:
21+
- name: Checkout project
22+
uses: actions/checkout@v3
23+
with:
24+
persist-credentials: false
25+
- name: Use Node.js ${{ env.node-version }}
26+
uses: actions/setup-node@v3
27+
with:
28+
node-version: ${{ env.node-version }}
29+
- name: Install packages
30+
run: npm ci
31+
- name: Run Semantic Release
32+
run: npm run release
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
35+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Lint & Test
2+
3+
on:
4+
workflow_call:
5+
pull_request:
6+
branches:
7+
- main
8+
9+
jobs:
10+
lint-and-test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
node-version: [16, 18, 20]
15+
os: [ubuntu-latest, windows-latest, macos-latest]
16+
17+
steps:
18+
- name: Checkout project
19+
uses: actions/checkout@v3
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
- name: Install packages
25+
run: npm ci
26+
- name: Check codestyle compliance
27+
run: npm run lint
28+
- name: Run tests
29+
run: npm run test

0 commit comments

Comments
 (0)