-
Notifications
You must be signed in to change notification settings - Fork 3
122 lines (102 loc) · 3.22 KB
/
analyses.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: analyses
# Trigger workflow on push and pull request events targeting the main branch.
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
# Step 1: Install dependencies and cache node_modules
install:
runs-on: ubuntu-latest
steps:
# Check out the code from the repository
- uses: actions/checkout@v2
# Install project dependencies using npm ci for clean install
- name: Install Dependencies
run: npm ci
# Cache node_modules for future jobs to speed up workflow
- name: Cache node modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ github.sha }}
build:
needs: install
runs-on: ubuntu-latest
steps:
# Check out the code from the repository
- uses: actions/checkout@v2
# Use cached node_modules to avoid reinstalling dependencies
- name: Cached node modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ github.sha }}
# Run the build command
- name: Build
run: npm run build
# Step 2: Run lint checks with ESLint
lint:
needs: install # Depends on the install job
runs-on: ubuntu-latest
steps:
# Check out the code from the repository
- uses: actions/checkout@v2
# Use cached node_modules to avoid reinstalling dependencies
- name: Cached node modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ github.sha }}
# Run ESLint to check for code quality issues
- name: ESLint
run: npm run lint:check
# Step 3: Run Prettier to check code formatting
prettier:
needs: install # Depends on the install job
runs-on: ubuntu-latest
steps:
# Check out the code from the repository
- uses: actions/checkout@v2
# Use cached node_modules to avoid reinstalling dependencies
- name: Cached node modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ github.sha }}
# Run Prettier to check code formatting
- name: Prettier
run: npm run prettier:check
# Step 4: Run TypeScript checks to ensure there are no type errors
typescript:
needs: install # Depends on the install job
runs-on: ubuntu-latest
steps:
# Check out the code from the repository
- uses: actions/checkout@v2
# Use cached node_modules to avoid reinstalling dependencies
- name: Cached node modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ github.sha }}
# Run TypeScript checks
- name: TypeScript
run: npm run ts:check
# Step 5: Run unit tests
unit_tests:
needs: install # Depends on the install job
runs-on: ubuntu-latest
steps:
# Check out the code from the repository
- uses: actions/checkout@v2
# Use cached node_modules to avoid reinstalling dependencies
- name: Cached node modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ github.sha }}
# Run unit tests
- name: Unit tests
run: npm run test:unit