-
Notifications
You must be signed in to change notification settings - Fork 48
80 lines (66 loc) · 2.02 KB
/
branch.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
69
70
71
72
73
74
75
76
77
78
79
80
name: Branch build
on:
push:
branches:
- main
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs:
build-node-apps:
name: Build and test Node.js apps
runs-on: ubuntu-latest
strategy:
matrix:
component:
- core
- cli
services:
mongo:
image: mongo:latest
ports:
- 27017:27017
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: volta-cli/action@v4
- name: Install dependencies
run: npm install && npm run bootstrap
- name: Lint code
run: npm run lint
- name: Build all applications
run: npm run build-all
- name: Run tests with coverage
working-directory: ./${{ matrix.component }}
run: npm run test:coverage
- name: Upload test coverage
uses: codecov/codecov-action@v3
with:
files: ./${{ matrix.component }}/coverage/lcov.info
flags: ${{ matrix.component }}
fail_ci_if_error: true
verbose: true
build-docker-image:
name: Build and test Docker image
runs-on: ubuntu-latest
env:
DB_URI: mongodb://mongo:27017/dockertest
DB_NAME: dockertest
DATA_IMPORT_PATH: docker-image/test/_importdata
services:
mongo:
image: mongo:latest
ports:
- 27017:27017
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Build image
run: docker build -f ./docker-image/dev.Dockerfile -t mongo-seeding-dev .
- name: Run image
run: docker run --network=${{ job.services.mongo.network }} -e DB_URI -e DB_NAME -e REPLACE_ID=true -e SET_TIMESTAMPS=true -v $(pwd)/${DATA_IMPORT_PATH}:/data -w /data mongo-seeding-dev
- name: Build Tester image
run: docker build -t tester .
working-directory: ./docker-image/test/tester
- name: Run Tester
run: docker run --network=${{ job.services.mongo.network }} -e DB_URI -e DB_NAME tester