Single job different statement, plus disabled alternative approach #1481
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: CI | |
on: [push, pull_request] | |
env: | |
CI: true | |
PGUSER: postgres | |
PGPASSWORD: postgres | |
PGHOST: "127.0.0.1" | |
PGPORT: 5432 | |
NODE_OPTIONS: "--disable-proto=delete" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
postgres-version: [12, 13, 14, 15] | |
services: | |
postgres: | |
image: postgres:${{ matrix.postgres-version }} | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: graphile_worker_test | |
ports: | |
- "0.0.0.0:5432:5432" | |
# needed because the postgres container does not provide a healthcheck | |
options: | |
--health-cmd pg_isready --health-interval 10s --health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: yarn --frozen-lockfile | |
- run: yarn node --experimental-vm-modules node_modules/.bin/jest -i --ci | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: yarn --frozen-lockfile | |
- run: yarn lint | |
altschema: | |
runs-on: ubuntu-latest | |
env: | |
GRAPHILE_WORKER_SCHEMA: custom_schema | |
strategy: | |
matrix: | |
node-version: [20.x] | |
postgres-version: [12] | |
services: | |
postgres: | |
image: postgres:${{ matrix.postgres-version }} | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: graphile_worker_test | |
ports: | |
- "0.0.0.0:5432:5432" | |
# needed because the postgres container does not provide a healthcheck | |
options: | |
--health-cmd pg_isready --health-interval 10s --health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: yarn --frozen-lockfile | |
# - run: yarn lint # No need to lint altschema | |
- run: yarn node --experimental-vm-modules node_modules/.bin/jest -i --ci | |
database_updated: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
postgres-version: [12] | |
services: | |
postgres: | |
image: postgres:${{ matrix.postgres-version }} | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: graphile_worker_test | |
ports: | |
- "0.0.0.0:5432:5432" | |
# needed because the postgres container does not provide a healthcheck | |
options: | |
--health-cmd pg_isready --health-interval 10s --health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: yarn --frozen-lockfile | |
- name: Install pg_dump | |
run: | | |
sudo bash -c "echo deb http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main >> /etc/apt/sources.list.d/pgdg.list" | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get -yqq install postgresql-client-11 | |
- name: "Build code" | |
run: | | |
yarn prepack | |
ln -s .. node_modules/graphile-worker || true | |
- name: "Check schema hasn't changed" | |
run: | | |
yarn db:dump | |
git update-index -q --refresh | |
git diff-index --quiet HEAD -- || (git diff && echo "^^^ The database schema has changed, please run 'yarn db:dump'" && exit 1) |