Skip to content

Doh! Add change_date field #5705

Doh! Add change_date field

Doh! Add change_date field #5705

Workflow file for this run

name: CI
on: push
jobs:
build:
runs-on: ubuntu-latest
env:
ENVIRONMENT: dev
DATABASE_URL: postgres://water_user:password@localhost:5432/wabs_test
TEST_DATABASE_URL: postgres://water_user:password@localhost:5432/wabs_test
JWT_SECRET: ItsNoSecretBecauseYouToldEverybody
JWT_TOKEN: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwibmFtZSI6InRlc3QiLCJpYXQiOjE1MDMzMTg0NDV9.eWghqjYlPrb8ZjWacYzTCTh1PBtr2BeSv-_ZIwrtmwE
COGNITO_HOST: https://mycognitoinstance.amazoncognito.com
COGNITO_USERNAME: random5letters6and2numbers7
COGNITO_PASSWORD: longer0random9letters1and6numbers8
# These need to be duplicated in services section for postgres. Unfortunately, there is not a way to reuse them
PGUSER: water_user
PGPASSWORD: password
PGDATABASE: wabs_test
PGHOST: localhost
PGPORT: 5432
# Additional config needed by the service
NALD_SERVICE_MAILBOX: some@mailbox.com
# Dummy keys as they need to be present but we shouldn't be hitting Notify in CI
TEST_NOTIFY_KEY: b3b02fe4-9b30-4bac-bd0d-6c9b83f1e171
WHITELIST_NOTIFY_KEY: b3b02fe4-9b30-4bac-bd0d-6c9b83f1e171
# Service containers to run with `runner-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:12-alpine
# Provide the password for postgres
env:
POSTGRES_USER: water_user
POSTGRES_PASSWORD: password
POSTGRES_DB: wabs_test
# Maps tcp port 5432 on service container to the host
ports:
- 5432:5432
# Set health checks to wait until postgres has started. You must have this so the runner knows to wait till
# postgres is up and running before proceeding
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis
ports:
- 6379:6379
steps:
# Downloads a copy of the code in your repository before running CI tests
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of SonarQube analysis
# Before we do anything, check we haven't accidentally left any `experiment.only()` or `test.only(` statements in
# the tests
#
# Reworking of https://stackoverflow.com/a/21788642/6117745
- name: Temporary tag check
run: |
! grep -R 'experiment.only(\|test.only(' test
- name: Install Node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
# Speeds up workflows by reading the node modules from cache. Obviously you need to run it at least once, and the
# cache will be updated should the package-lock.json file change
- name: Cache Node modules
uses: actions/cache@v4
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
# Performs a clean installation of all dependencies in the `package.json` file
# For more information, see https://docs.npmjs.com/cli/ci.html
- name: Install dependencies
run: npm ci
# Run linting first. No point running the tests if there is a linting issue
- name: Run lint check
run: |
npm run lint
- name: Database migrations
run: |
npm run migrate
- name: Run unit tests
run: |
npm test
- name: Analyze with SonarQube
if: github.actor != 'dependabot[bot]'
uses: sonarsource/sonarqube-scan-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This is provided automatically by GitHub
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # This needs to be set in your repo; settings -> secrets