-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (56 loc) · 1.6 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
name: CI
on:
pull_request:
branches: [develop, main]
push:
branches: [develop, main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get Code
uses: actions/checkout@v3
- name: Cache node_modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{runner.os}}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{runner.os}}-node-
- name: Install dependencies
run: npm ci
- name: Run lint
run: npm run lint
- name: Run test
run: npm run test
- name: Run coverage
run: npm run coverage
env:
CI: true
- name: Upload tests coverage
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: coverage
- name: Build project
if: github.event_name == 'push'
run: npm run build
- name: Upload build folder
if: github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
name: build
path: build
- name: ZIP Assets
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
zip -r build.zip ./build
zip -r coverage.zip ./coverage
- name: Create a release
if: github.event_name == 'push' && github == 'refs/heads/main'
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
- name: Upload coverage reports
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: npx code-coverage