View completed sessions #555
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: CI | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
build: | |
name: Build | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- image: glemenneo/cs3219-ay2425s1-project-g31-user-service | |
dockerfile: ./backend/user-service/Dockerfile | |
- image: glemenneo/cs3219-ay2425s1-project-g31-question-service | |
dockerfile: ./backend/question-service/Dockerfile | |
- image: glemenneo/cs3219-ay2425s1-project-g31-matching-service | |
dockerfile: ./backend/matching-service/Dockerfile | |
- image: glemenneo/cs3219-ay2425s1-project-g31-collaboration-service | |
dockerfile: ./backend/collaboration-service/Dockerfile | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ${{ matrix.dockerfile }} | |
push: false # Do not push to Docker Hub, only cache the image for later use in CD | |
tags: ${{ matrix.image }}:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
test: | |
name: Test | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
# To use Remote Caching, uncomment the next lines and follow the steps below. | |
# env: | |
# TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
# TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
# TURBO_REMOTE_ONLY: true | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Cache turbo artifacts | |
uses: actions/cache@v4 | |
with: | |
path: .turbo | |
key: ${{ runner.os }}-turbo-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-turbo- | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm install | |
- name: Build | |
run: npm run build # Required to build the internal | |
- name: Test | |
run: npm run test |