Merge pull request #98 from CS3219-AY2324S1/test-updated-merge #31
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 Matching Service | |
on: | |
push: | |
paths: | |
- "MatchingService/**" | |
- ".github/workflows/build_and_test_master_matching_service.yaml" | |
pull_request: | |
paths: | |
- "MatchingService/**" | |
- ".github/workflows/build_and_test_master_matching_service.yaml" | |
jobs: | |
build-and-test-matching-service: | |
runs-on: ubuntu-latest | |
env: | |
CONTAINER_NAME: "ay2324s1-course-assessment-g16_matching-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 Matching Service, Matching Service Database and RabbitMQ with Docker Compose | |
run: docker-compose build --no-cache matching-service matching-service-database rabbitmq | |
- name: Run Matching Service, Matching Service Database and RabbitMQ with Docker Compose | |
run: docker-compose up -d matching-service matching-service-database rabbitmq | |
- name: List Docker Containers | |
run: docker ps | |
- name: Logs [For Checking Status Only] | |
run: docker-compose logs | |
- name: Wait For Startup of Containers | |
run: sleep 5 | |
- name: Set up Node.js Environment For Running Tests # Due to dependency issue, have separated test for matching service | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install Node Dependencies For Running Tests | |
run: npm install | |
working-directory: MatchingService | |
- name: Run Test Cases in Matching Service | |
run: npm test | |
working-directory: MatchingService | |
- name: Retrieve and Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: matching-service-test-jest-report-artifacts | |
path: MatchingService/coverage/** | |
- name: Shut Down Containers | |
run: docker-compose down |