-
Notifications
You must be signed in to change notification settings - Fork 5
100 lines (84 loc) · 2.9 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, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['16', '18', '20']
steps:
- name: Checkout
uses: actions/checkout@v3
- run: echo "build_status_message=failing" >> $GITHUB_ENV
- run: echo "build_status_color=red" >> $GITHUB_ENV
- name: Install Node JS ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Update NPM
run: npm install -g npm
- name: Show Node/NPM versions
run: |
node --version
npm --version
- name: Install
run: npm ci --engine-strict --strict-peer-deps
- name: Lint
run: |
npm run prettier:check
npm run lint
- name: Run tests
run: |
npm test
npm run coverage
- run: echo "build_status_message=passing" >> $GITHUB_ENV
- run: echo "build_status_color=brightgreen" >> $GITHUB_ENV
- name: Upload coverage report to codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage/cobertura-coverage.xml
- name: Write Coverage badge
uses: action-badges/cobertura-coverage-xml-badges@main
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
with:
badge-branch: badges
file-name: coverage.svg
github-token: '${{ secrets.GITHUB_TOKEN }}'
coverage-file-name: ./coverage/cobertura-coverage.xml
- name: Write Build Status badge
if: ${{ always() && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: action-badges/core@main
with:
badge-branch: badges
file-name: build-status.svg
github-token: "${{ secrets.GITHUB_TOKEN }}"
label: build
message: "${{ env.build_status_message }}"
message-color: "${{ env.build_status_color }}"
package-json-badges:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Write License badge
uses: action-badges/package-json-badges@main
with:
badge-branch: badges
file-name: package-license.svg
github-token: '${{ secrets.GITHUB_TOKEN }}'
integration: license
- name: Write Node Version badge
uses: action-badges/package-json-badges@main
with:
badge-branch: badges
file-name: package-node-version.svg
github-token: '${{ secrets.GITHUB_TOKEN }}'
integration: node-version
- name: Write License badge
uses: action-badges/package-json-badges@main
with:
badge-branch: badges
file-name: package-version.svg
github-token: '${{ secrets.GITHUB_TOKEN }}'
integration: version