Bootcamp update 2023 #29
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: CI | |
on: | |
# push: | |
# branches: [ main ] | |
# paths: [ 'hangman-api/**' ] | |
workflow_dispatch: | |
pull_request: | |
branches: [main] | |
paths: ["hangman-api/**"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16 | |
cache: "npm" | |
cache-dependency-path: hangman-api/package-lock.json | |
- name: build | |
working-directory: ./hangman-api | |
run: | | |
npm ci | |
npm run build --if-present | |
test: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16 | |
- name: test | |
working-directory: ./hangman-api | |
run: | | |
npm ci | |
npm test | |
test-integration: | |
runs-on: ubuntu-latest | |
needs: test | |
services: | |
postgres: | |
image: postgres:14-alpine | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: hangman_db | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 16 | |
# - name: Create database relationships | |
- name: Running integration tests | |
working-directory: ./hangman-api | |
env: | |
DATABASE_PORT: 5432 | |
DATABASE_HOST: localhost | |
DATABASE_NAME: hangman_db | |
DATABASE_USER: postgres | |
DATABASE_PASSWORD: postgres | |
DATABASE_POOL_MIN: 2 | |
DATABASE_POOL_MAX: 10 | |
run: | | |
npm ci | |
npx knex migrate:latest --env development | |
npm run test:integration |