Merge pull request #450 from rit-construct-makerspace/old-state #802
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: Backend | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [master, heroku-deploy] | |
paths: ["server/**"] | |
pull_request: | |
branches: [master, heroku-deploy] | |
paths: ["server/**"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Service containers to run with `container-job` | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5433:5432 | |
env: | |
POSTGRES_USER: pguser | |
POSTGRES_PASSWORD: pgpassword | |
POSTGRES_DB: pgdb | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
cache: npm | |
cache-dependency-path: client/package-lock.json | |
- name: Install Node modules | |
run: npm ci | |
- name: Run Knex migrations | |
run: npm run build:server && npm run knex:migrate:latest DEBUG=knex:tx | |
env: | |
DATABASE_URL: postgresql://pguser:pgpassword@localhost:5433/pgdb | |
- name: Run Tests | |
run: npm run test:server:watch | |
env: | |
DATABASE_URL: postgresql://pguser:pgpassword@localhost:5433/pgdb |