Skip to content

Merge pull request #1330 from williamw04/AdminDiscardButton-1326 #1946

Merge pull request #1330 from williamw04/AdminDiscardButton-1326

Merge pull request #1330 from williamw04/AdminDiscardButton-1326 #1946

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: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