generated from vidavidorra/repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (100 loc) · 3.41 KB
/
build.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
90
91
92
93
94
95
96
97
98
99
100
name: Build
on:
push:
branches:
- main
- 'renovate/**'
- 'github-renovate/**'
pull_request:
jobs:
lint:
uses: vidavidorra/.github/.github/workflows/node-lint.yml@dc51b746f22c1852be005d71f102feb29cf425cf # v2.2.3
build:
name: Build (Node.js v${{ matrix.node }})
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
node: [12, 14, 16]
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Setup node
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: ${{ matrix.node }}
- name: Install project
run: npm ci --ignore-scripts
- name: Build
run: npm run build
test:
name: Test (Node.js v${{ matrix.node }})
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
node: [12, 14, 16]
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Setup node
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: ${{ matrix.node }}
- name: Install project
run: npm ci --ignore-scripts
- name: Test
run: npm run test:ci
code-coverage:
needs: [lint, build, test]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Setup node
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: 14
- name: Install project
run: npm ci --ignore-scripts
- name: Test
run: npm test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/cobertura-coverage.xml
release:
needs: [lint, build, test, code-coverage]
runs-on: ubuntu-latest
# GitHub API requests can easy take a couple of seconds and the release can
# make lots of API requests when a release has a lot of commits. If every
# requests takes five seconds, which is on the high side for a request, this
# could perform 180 requests. This should be enough for most use cases.
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
# Make sure the release step uses its own credentials.
persist-credentials: false
- name: Setup node
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: 18
- name: Install project
run: npm ci --ignore-scripts
- name: Build
run: npm run build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
GIT_AUTHOR_NAME: vidavidorra-release
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: vidavidorra-release
GIT_COMMITTER_EMAIL: [email protected]
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: npx --no-install semantic-release