-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (73 loc) · 2.18 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: CI
on:
pull_request:
branches: [main]
paths-ignore:
- .gitignore
- LICENSE
- README.md
- .github/dependabot.yml
- .github/workflows/deploy.yml
- .github/workflows/bump.yml
env:
node_version: "22.x"
jobs:
test:
name: Test Module
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: npm install
- name: npm test
run: npm run test
- name: npm test with coverage
if: ${{ matrix.node-version == env.node_version }} # just run coverage if node 16
run: npm run coverage
- name: Upload coverage to Codecov
if: ${{ matrix.node-version == env.node_version }} # just run coverage if node 16
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
lint:
name: Lint Module
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.node_version }}
- name: npm install
run: npm install
- name: npm lint
run: npm run lint
# https://github.com/marketplace/actions/release-drafter
draft_release:
name: Draft Release
runs-on: ubuntu-latest
needs: [test, lint]
steps:
- uses: actions/checkout@v4
- id: version
run: echo ::set-output name=version::$(node -p 'require("./package.json").version')
- name: Draft release
id: draft
uses: release-drafter/release-drafter@v6
with:
version: ${{ steps.version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Link to Release
run: |
echo "Release draft create/updated: ${{ steps.draft.outputs.html_url }}"
# ENH: maybe look into adding a comment to the PR with a link to the release draft?