-
Notifications
You must be signed in to change notification settings - Fork 2
85 lines (81 loc) · 2.1 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
name: CI
on:
push:
branches: ['develop', 'main']
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
container: node:16-buster
steps:
- uses: actions/checkout@v3
- name: Cache npm
uses: actions/cache@v3
with:
path: |
~/cache
!~/cache/exclude
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
# Install deps
- name: Install deps
run: npm ci
# Run linter
- name: Run linter
run: npm run lint:check
# Run Prettier
- name: Run prettier
run: npm run format:check
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16.14.0'
- name: Cache npm
uses: actions/cache@v3
with:
path: |
~/cache
!~/cache/exclude
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
# Install deps
- name: Install deps
run: npm ci
- name: Build
run: npm run build
# run tests
- name: Run tests
run: npm run test-cov
# Upload coverage to Codecov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
release:
name: Release
runs-on: ubuntu-latest
needs: [lint, test]
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16.14.0'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm run release