Merge pull request #102 from CS3219-AY2324S1/assignment-4-final #50
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |