Skip to content

Bump pg from 8.12.0 to 8.13.0 #933

Bump pg from 8.12.0 to 8.13.0

Bump pg from 8.12.0 to 8.13.0 #933

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
JWT_SECRET: ItsNoSecretBecauseYouToldEverybody
JWT_TOKEN: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwibmFtZSI6InRlc3QiLCJpYXQiOjE1MDMzMTg0NDV9.eWghqjYlPrb8ZjWacYzTCTh1PBtr2BeSv-_ZIwrtmwE
# 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
PGHOST: localhost
PGPORT: 5432
# 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
# 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
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 sonarcloud 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
# This includes an extra run step. The sonarcloud analysis will be run in a docker container with the current
# folder mounted as `/github/workspace`. The problem is when the lcov.info file is generated it will reference the
# code in the current folder. So to enable sonarcloud to matchup code coverage with the files we use sed to update
# the references in lcov.info
# https://community.sonarsource.com/t/code-coverage-doesnt-work-with-github-action/16747/6
- name: Run unit tests
run: |
npm test
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage/lcov.info
- name: Analyze with SonarCloud
if: github.actor != 'dependabot[bot]'
uses: sonarsource/sonarcloud-github-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