-
-
Notifications
You must be signed in to change notification settings - Fork 149
51 lines (38 loc) · 1.06 KB
/
api-build-and-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
name: Build and Test API
on:
push:
branches: [main]
pull_request:
branches: [main]
defaults:
run:
working-directory: mobile-api
jobs:
build-and-test:
name: Build and Test API
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout source code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Lint source files
run: npm run lint
- name: Build and start container
run: docker compose -f docker-compose.dev.yml up -d
- name: Sleep for 1 minute
run: sleep 60
- name: Ping container
run: curl localhost:3000/ping
- name: Create .env file
run: cp sample.env .env
- name: Run tests
run: npm test