Skip to content

Bump pg from 8.12.0 to 8.13.0 #4125

Bump pg from 8.12.0 to 8.13.0

Bump pg from 8.12.0 to 8.13.0 #4125

Workflow file for this run

name: CI
on: push
jobs:
build:
# You must use a Linux environment when using service containers or container jobs
runs-on: ubuntu-latest
env:
ADMIN_CLIENT_ID: shortvaluefullofnumbersandlettersinlowercase
AIRBRAKE_HOST: https://my-errbit-instance.com
AIRBRAKE_KEY: longvaluefullofnumbersandlettersinlowercase
PORT: 3000
# These need to be duplicated in services section for postgres. Unfortunately, there is not a way to reuse them
POSTGRES_USER: charge
POSTGRES_PASSWORD: pinafore
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_DB: sroc_charge_test
POSTGRES_DB_TEST: sroc_charge_test
ENVIRONMENT: dev
RULES_SERVICE_URL: http://example.com
RULES_SERVICE_USER: admin
RULES_SERVICE_PASSWORD: password
CFD_APP: cfd_RuleApp
CFD_RULESET: cfd_RuleSet
WML_APP: wml_RuleApp
WML_RULESET: wml_RuleSet
PAS_APP: pas_RuleApp
PAS_RULESET: pas_RuleSet
WRLS_APP: wrls_RuleApp
WRLS_RULESET: wrls_RuleSet
WRLS_SROC_APP: TEST_WRLS_SRoC_RuleApp
WRLS_SROC_RULESET: WRLS_SRoC_RuleSet
RULES_SERVICE_TIMEOUT: 1000
# 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: charge
POSTGRES_PASSWORD: pinafore
POSTGRES_DB: sroc_charge_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
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 `describe.only()` or `it.only(` statements in the
# tests
#
# Reworking of https://stackoverflow.com/a/21788642/6117745
- name: Temporary tag check
run: |
! grep -R 'describe.only(\|it.only(' test
# Our projects use .nvmrc files to specify the node version to use. We can read and then output it as the result
# this step. Subsequent steps can then access the value
- name: Read Node version
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
# Give the step an ID to make it easier to refer to
id: nvm
# Gets the version to use by referring to the previous step
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: "${{ steps.nvm.outputs.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 --legacy-peer-deps
# 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-test-db
# 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/\/home\/runner\/work\/sroc-charging-module-api\/sroc-charging-module-api\//\/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