Skip to content

Commit

Permalink
chore: tests++; yarn2; actions; deps++; format; PG>=10; node>=12 (gra…
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie authored May 27, 2020
1 parent f06e85e commit 4eb36fe
Show file tree
Hide file tree
Showing 225 changed files with 63,047 additions and 19,114 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
/.vscode/pnpify
/packages/pg-sql2/examples
/packages/postgraphile/sponsors.json
/packages/postgraphile/postgraphiql
Expand All @@ -8,3 +9,5 @@ node_modules
dist
CHANGELOG.md
_LOCAL
.yarn
.pnp.*
22 changes: 20 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module.exports = {
parser: "babel-eslint",
parserOptions: {
sourceType: "module",
//project: 'tsconfig.json',
},
extends: [
"eslint:recommended",
Expand All @@ -26,6 +25,8 @@ module.exports = {
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "off",
// We need this for our `GraphileEngine` namespace
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-unused-vars": [
"error",
Expand All @@ -36,7 +37,6 @@ module.exports = {
ignoreRestSiblings: true,
},
],

"no-confusing-arrow": 0,
"no-else-return": 0,
"no-underscore-dangle": 0,
Expand Down Expand Up @@ -88,6 +88,24 @@ module.exports = {
},
},

// Stricter rules for source code
{
files: ["packages/*/src/**/*.ts", "packages/*/src/**/*.tsx"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["tsconfig.json", "packages/*/tsconfig.json"],
},
rules: {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-unused-vars-experimental": [
"error",
{
ignoreArgsIfArgsAfterAreUsed: true,
},
],
},
},

// Rules for tests only
{
files: ["**/__tests__/**/*.{ts,js}"],
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Node CI

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

env:
CI: true
PGVERSION: ${{ matrix.postgres-version}}
TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/graphileengine_test
TEST_PG_URL: postgres://postgres:postgres@localhost:5432/postgraphile_test
LDS_TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/lds_test
TERM: xterm
FORCE_COLOR: 1

strategy:
fail-fast: false
matrix:
postgres-version: [10, 11, 12]
node-version: [12.x, 14.x]

services:
postgres:
image: postgres:${{ matrix.postgres-version }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
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 --name postgres

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Configure PostgreSQL
run: |
cat .github/workflows/ci/docker-entrypoint-initdb.d/010-enable_wal.sh | docker exec -i postgres bash
cat .github/workflows/ci/docker-entrypoint-initdb.d/020-wal2json.sh | docker exec -i postgres bash
cat .github/workflows/ci/docker-entrypoint-initdb.d/030-setup.sh | docker exec -i postgres bash
docker restart postgres
- 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-${{ matrix.postgres-version }}
- run: yarn --immutable
- run: ./scripts/ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -e

echo -e 'wal_level = logical\nmax_replication_slots = 10\nmax_wal_senders = 10' >> /var/lib/postgresql/data/postgresql.conf
32 changes: 32 additions & 0 deletions .github/workflows/ci/docker-entrypoint-initdb.d/020-wal2json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -e

# This setup script is heavily inspired by
# https://github.com/debezium/docker-images/blob/master/postgres/11/Dockerfile

PROTOC_VERSION=1.3
WAL2JSON_COMMIT_ID=c54d89649c3fe5e0aa79c3a87493935232e962a7
USE_PGXS=1
export PGUSER=postgres
export PGPASSWORD=postgres
createuser --superuser root

apt-get update
apt-get install -f -y --no-install-recommends \
software-properties-common \
build-essential \
pkg-config \
git \
postgresql-server-dev-$PG_MAJOR
add-apt-repository "deb http://ftp.debian.org/debian testing main contrib"
apt-get update
rm -rf /var/lib/apt/lists/*

cd /
git clone https://github.com/eulerto/wal2json -b master --single-branch
cd wal2json
git checkout $WAL2JSON_COMMIT_ID
make
make install
cd ..
rm -rf wal2json
5 changes: 5 additions & 0 deletions .github/workflows/ci/docker-entrypoint-initdb.d/030-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -e

createdb graphileengine_test
createdb postgraphile_test
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ dist
/pg-omit-archived/
/pg-simplify-inflector/
/operation-hooks/
/.vscode
*.tgz
yarn-error.log
npm-debug.log
tsconfig.tsbuildinfo
.env
_LOCAL
.DS_Store

# yarn2 stuff
.yarn/*
!.yarn/releases
!.yarn/plugins
.pnp.*
File renamed without changes.
58 changes: 0 additions & 58 deletions .travis.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .vscode/pnpify/eslint/bin/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.js";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
// Setup the environment to be able to require eslint/bin/eslint.js
require(absPnpApiPath).setup();
}

// Defer to the real eslint/bin/eslint.js your application uses
module.exports = absRequire(`eslint/bin/eslint.js`);
18 changes: 18 additions & 0 deletions .vscode/pnpify/eslint/lib/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.js";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
// Setup the environment to be able to require eslint/lib/api.js
require(absPnpApiPath).setup();
}

// Defer to the real eslint/lib/api.js your application uses
module.exports = absRequire(`eslint/lib/api.js`);
6 changes: 6 additions & 0 deletions .vscode/pnpify/eslint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "eslint",
"version": "6.8.0-pnpify",
"main": "./lib/api.js",
"type": "commonjs"
}
18 changes: 18 additions & 0 deletions .vscode/pnpify/prettier/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../.pnp.js";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
// Setup the environment to be able to require prettier/index.js
require(absPnpApiPath).setup();
}

// Defer to the real prettier/index.js your application uses
module.exports = absRequire(`prettier/index.js`);
6 changes: 6 additions & 0 deletions .vscode/pnpify/prettier/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "prettier",
"version": "1.19.1-pnpify",
"main": "./index.js",
"type": "commonjs"
}
18 changes: 18 additions & 0 deletions .vscode/pnpify/typescript/bin/tsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.js";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
// Setup the environment to be able to require typescript/bin/tsc
require(absPnpApiPath).setup();
}

// Defer to the real typescript/bin/tsc your application uses
module.exports = absRequire(`typescript/bin/tsc`);
18 changes: 18 additions & 0 deletions .vscode/pnpify/typescript/bin/tsserver
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.js";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
// Setup the environment to be able to require typescript/bin/tsserver
require(absPnpApiPath).setup();
}

// Defer to the real typescript/bin/tsserver your application uses
module.exports = absRequire(`typescript/bin/tsserver`);
18 changes: 18 additions & 0 deletions .vscode/pnpify/typescript/lib/tsc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.js";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
// Setup the environment to be able to require typescript/lib/tsc.js
require(absPnpApiPath).setup();
}

// Defer to the real typescript/lib/tsc.js your application uses
module.exports = absRequire(`typescript/lib/tsc.js`);
18 changes: 18 additions & 0 deletions .vscode/pnpify/typescript/lib/tsserver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.js";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
// Setup the environment to be able to require typescript/lib/tsserver.js
require(absPnpApiPath).setup();
}

// Defer to the real typescript/lib/tsserver.js your application uses
module.exports = absRequire(`typescript/lib/tsserver.js`);
Loading

0 comments on commit 4eb36fe

Please sign in to comment.