-
Notifications
You must be signed in to change notification settings - Fork 3
69 lines (57 loc) · 1.5 KB
/
api-test.yaml
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
name: API Test
on:
pull_request:
branches:
- main
- 'develop'
paths:
- 'api/**'
- '!api/**.md'
workflow_dispatch:
jobs:
api-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github
api
fetch-depth: 1
- name: Read .nvmrc
working-directory: ./api
run: |
echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
id: nvm
- name: Use Node.js ${{ steps.nvm.outputs.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
- name: Run Docker Compose
working-directory: ./api
run: |
docker compose --env-file .env -p mrc-api up -d
- name: Install Dependencies
working-directory: ./api
run: |
npm ci
- name: Load Environment Variables
working-directory: ./api
run: |
. ./scripts/load_dotenv.sh
- name: Database Migration
working-directory: ./api
run: |
npm run migrate-apply:latest
- name: Generate ORM Client Model
working-directory: ./api
run: |
npm run generate-models
- name: Run API Unit Tests
working-directory: ./api
run: |
npm run test:cov
- name: Stop and Remove Containers
working-directory: ./api
run: |
docker compose -p mrc-api down