Skip to content

feat: implement npm workspaces #169

feat: implement npm workspaces

feat: implement npm workspaces #169

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/shared/**'
- name: Setup Node.js
if: steps.filter.outputs.api == 'true'
uses: actions/setup-node@v4
with:
node-version: 18.20.2
cache: npm
cache-dependency-path: package-lock.json
- name: Setup Local Deps
if: steps.filter.outputs.api == 'true'
uses: actions/setup-node@v4
with:
node-version: 18.20.2
cache: npm
cache-dependency-path: apps/api/package-lock.json
- name: Install dependencies
if: steps.filter.outputs.api == 'true'
run: npm ci --workspace=apps/api
- name: Run static code analysis
if: steps.filter.outputs.api == 'true'
run: npm run lint --workspace=apps/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: docker build -f Dockerfile.api -t cloudmos-api .