feat: inline SQL scripts for bundlers (#345) #854
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 | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [14.x, 16.x, 18.x] | |
postgres-version: [12, 13, 14] | |
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 jest -i --ci | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Use Node.js 14.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14.x | |
- run: yarn --frozen-lockfile | |
- run: yarn lint | |
altschema: | |
runs-on: ubuntu-latest | |
env: | |
GRAPHILE_WORKER_SCHEMA: custom_schema | |
services: | |
postgres: | |
image: postgres:12 | |
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@v1 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16.x | |
- run: yarn --frozen-lockfile | |
# - run: yarn lint # No need to lint altschema | |
- run: yarn jest -i --ci | |
database_updated: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:12 | |
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@v1 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16.x | |
- run: yarn --frozen-lockfile | |
- name: Install pg_dump | |
run: | | |
sudo bash -c "echo deb http://apt.postgresql.org/pub/repos/apt/ bionic-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: "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) |