Merge pull request #1398 from lukeckk/development #2203
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: 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:18.17.1 | |
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 | |
# This is a hack/fix from https://github.com/actions/runner/issues/2033 that (hopefully) fixes | |
# fatal: detected dubious ownership in repository at '/__w/OED/OED' | |
# Other refs: https://github.com/crytic/slither-action/pull/50, https://github.com/actions/checkout/issues/1169, | |
# https://github.com/actions/checkout/issues/1048 | |
# TODO Remove once final fix is in for GitHub workflows. | |
- name: make git permissions ok | |
run: chown -R $(id -u):$(id -g) $PWD | |
- 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 |