Skip to content

Merge pull request #957 from dzheng13341/testingreadings #1084

Merge pull request #957 from dzheng13341/testingreadings

Merge pull request #957 from dzheng13341/testingreadings #1084

Workflow file for this run

name: Build
on:
pull_request:
branches: [ development ]
push:
branches: [ development ]
jobs:
run-checks-tests:
env:
OED_DB_USER: test
OED_DB_PASSWORD: travisTest
OED_DB_DATABASE: travis_ci_dummy
OED_DB_TEST_DATABASE: travis_ci_test
OED_DB_HOST: postgres
OED_DB_PORT: 5432
OED_TOKEN_SECRET: travis
OED_SERVER_PORT: 3000
OED_TEST_SITE_READING_RATE: 00:15:00
POSTGRES_PASSWORD: travisTest
runs-on: ubuntu-latest
# Make sure the node version here matches containers/web/Dockerfile for the standard OED build.
container: node:16.13.2
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: travisTest
POSTGRES_DB: travis_ci_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Check out repository code
uses: actions/checkout@v3
# It is unclear why this does not work but the container: above for node works fine.
# This causes an exception when Postgres starts. One guess is that Postgres is starting
# before node is specified.
# - name: Use Node.js
# uses: actions/setup-node@v3
# with:
# # Make sure the node version here matches containers/web/Dockerfile for the standard OED build.
# node-version: '16.13.2'
# TODO This seems like a weird hack and there may be a better way to avoid the error that
# cannot write onto these directories.
- name: make testing directory writeable
run: |
chmod 777 src/server/tmp
chmod 777 src/server/tmp/uploads
- name: Install dependencies
run: npm ci
- name: Connect to PostgreSQL
run: node client.js
env:
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
- name: node tests
run: |
npm run check:header
npm run check:typescript
npm run check:types
npm run check:lint
npm run test