Skip to content

Implement database infra utilities and tests for api (#118, #122) #5

Implement database infra utilities and tests for api (#118, #122)

Implement database infra utilities and tests for api (#118, #122) #5

name: API CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
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:
- 'api/**'
shared:
- 'shared/**'
- name: Check node_modules cache
id: deps-cache
if: inputs.check-only == 'true'
uses: martijnhols/actions-cache/check@v3
env:
cache-name: deps-cache
with:
path: node_modules
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: Install Dependencies
if: steps.deps-cache.outputs.cache-hit != 'true'
run: |
cd api
npm install
- name: Cache node modules
if: steps.deps-cache.outputs.cache-hit != 'true'
uses: actions/cache@v3
env:
cache-name: deps-cache
with:
path: node_modules
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: Validate API
if: steps.filter.outputs.api == 'true' || steps.filter.outputs.shared == 'true'
run: |
cd api
npm test:unit
- name: Build the Docker image for API
if: steps.filter.outputs.api == 'true' || steps.filter.outputs.shared == 'true'
run: docker build . --file ./api/Dockerfile