Skip to content

chore: setup prod and dev docker with compose #295

chore: setup prod and dev docker with compose

chore: setup prod and dev docker with compose #295

name: Validate and Build API
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
validate-n-build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check for changes
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
api:
- 'apps/api/**'
- 'packages/database/**'
- name: Setup Node.js
if: steps.filter.outputs.api == 'true'
uses: actions/setup-node@v4
with:
node-version: 20.14.0
- name: Restore root node_modules cache
if: steps.filter.outputs.api == 'true'
uses: martijnhols/actions-cache@v3
id: cache
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.filter.outputs.api == 'true' && steps.cache.outputs.cache-hit != 'true'
run: npm ci
- name: Run static code analysis
if: steps.filter.outputs.api == 'true'
run: npm run lint:api
- name: Run unit tests
if: steps.filter.outputs.api == 'true'
run: npm run test:unit --workspace=apps/api
- name: Build the Docker image for API
if: steps.filter.outputs.api == 'true'
run: npm run dc:build -- api