[#285] Add API Dockerfile #112
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: API Test | |
on: | |
pull_request: | |
branches: | |
- main | |
- 'develop' | |
paths: | |
- 'api/**' | |
- '!api/**.md' | |
workflow_dispatch: | |
jobs: | |
api-test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
.github | |
api | |
fetch-depth: 1 | |
- name: Read .nvmrc | |
working-directory: ./api | |
run: | | |
echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT | |
id: nvm | |
- name: Use Node.js ${{ steps.nvm.outputs.NODE_VERSION }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ steps.nvm.outputs.NODE_VERSION }} | |
- name: Run Docker Compose | |
working-directory: ./api | |
run: | | |
docker compose --env-file .env -p mrc-api up -d | |
- name: Install Dependencies | |
working-directory: ./api | |
run: | | |
npm ci | |
- name: Load Environment Variables | |
working-directory: ./api | |
run: | | |
. ./scripts/load_dotenv.sh | |
- name: Database Migration | |
working-directory: ./api | |
run: | | |
npm run migrate-apply:latest | |
- name: Generate ORM Client Model | |
working-directory: ./api | |
run: | | |
npm run generate-models | |
- name: Run API Unit Tests | |
working-directory: ./api | |
run: | | |
npm run test:cov | |
- name: Stop and Remove Containers | |
working-directory: ./api | |
run: | | |
docker compose -p mrc-api down | |