-
Notifications
You must be signed in to change notification settings - Fork 54
58 lines (47 loc) · 1.45 KB
/
validate-n-build-api.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: Validate and Build API
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
validate-n-build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check for changes
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
api:
- 'apps/api/**'
- 'packages/database/**'
- name: Setup Node.js
if: steps.filter.outputs.api == 'true'
uses: actions/setup-node@v4
with:
node-version: 20.14.0
- name: Restore root node_modules cache
if: steps.filter.outputs.api == 'true'
uses: martijnhols/actions-cache@v3
id: cache
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.filter.outputs.api == 'true' && steps.cache.outputs.cache-hit != 'true'
run: npm ci
- name: Run static code analysis
if: steps.filter.outputs.api == 'true'
run: npm run lint:api
- name: Run unit tests
if: steps.filter.outputs.api == 'true'
run: npm run test:unit --workspace=apps/api
- name: Build the Docker image for API
if: steps.filter.outputs.api == 'true'
run: npm run dc:build -- api