generated from CS3219-AY2324S1/course-assessment-template
-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (41 loc) · 1.61 KB
/
build_and_test_master_user_service.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
name: Build And Test User Service
on:
push:
paths:
- "UserService/**"
- ".github/workflows/build_and_test_master_user_service.yaml"
pull_request:
paths:
- "UserService/**"
- ".github/workflows/build_and_test_master_user_service.yaml"
jobs:
build-and-test-user-service:
runs-on: ubuntu-latest
env:
CONTAINER_NAME: "ay2324s1-course-assessment-g16_user-service_1" # Here _ is being used after file directory and service name vs -
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Docker Environment
uses: docker/setup-buildx-action@v3
- name: Build User Service and User Service Database with Docker Compose
run: docker-compose build --no-cache user-service user-service-database
- name: Run User Service and User Service Database with Docker Compose
run: docker-compose up -d user-service user-service-database
# - name: Wait For Startup
# run: sleep 30
- name: List Docker Containers
run: docker ps
- name: Logs [For Checking Status Only]
run: docker-compose logs
- name: Run Test Cases in User Service
run: docker exec $CONTAINER_NAME npm test
- name: Retrieve Artifacts [JEST Test Reports]
run: docker cp $CONTAINER_NAME:/app/coverage ./user-service-test-jest-reports
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: user-service-test-jest-report-artifacts
path: ./user-service-test-jest-reports/*
- name: Shut Down Containers
run: docker-compose down