This repository has been archived by the owner on Apr 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (50 loc) · 1.66 KB
/
test.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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Test
on:
push:
branches:
- main
pull_request:
workflow_call:
jobs:
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 10
env:
REF: ${{ github.ref_name }}
NODE_VERSION: 16.14.0
steps:
- uses: actions/checkout@v3
- name: Setup Cache
uses: actions/cache@v2
with:
path: '**/node_modules'
key: node-modules-${{ github.ref_name }}-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
node-modules-${{ github.ref_name }}-${{ env.NODE_VERSION }}
node-modules-main-${{ env.NODE_VERSION }}
node-modules-${{ github.ref_name }}-
node-modules-main-
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: npm i --no-fund
- name: Build the project
run: npm run build
- name: Check code styles
run: npm run lint
- name: Generate code documents
run: npm run docs:code
- name: Generate Swagger documents
run: npm run docs:swagger
- name: Test the project
run: npm run test:ci
- name: Upload coverage to CodeCov
uses: codecov/codecov-action@v2
with:
env_vars: REF,NODE_VERSION
fail_ci_if_error: true