Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport preset and plugins functionality plus graceful shutdown to 0.15.1 #398

Merged
merged 8 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
node_modules
dist
src/generated
/node_modules
/dist
/src/generated
/rewired
/website/build
/website/.docusaurus
/_LOCAL
/graphile-pro-worker
24 changes: 24 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module.exports = {
parser: "@typescript-eslint/parser",
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/typescript",
"prettier",
Expand All @@ -20,6 +22,7 @@ module.exports = {
NodeJS: false, // For TypeScript
},
rules: {
"no-unused-vars": 0,
"@typescript-eslint/no-unused-vars": [
"error",
{
Expand Down Expand Up @@ -65,5 +68,26 @@ module.exports = {

"import/no-deprecated": "warn",
"import/no-duplicates": "error",
// Doesn't support 'exports'?
"import/no-unresolved": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-namespace": "off",
},
overrides: [
{
files: ["__tests__/**/*", "test.js"],
rules: {
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/ban-ts-comment": 0,
},
},
{
files: ["perfTest/**/*", "examples/**/*"],
rules: {
"@typescript-eslint/no-var-requires": 0,
},
},
],
};
52 changes: 35 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:

strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
postgres-version: [12, 13, 14]
node-version: [20.x]
postgres-version: [12, 13, 14, 15]

services:
postgres:
Expand All @@ -39,17 +39,21 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: yarn --frozen-lockfile
- run: yarn jest -i --ci
- 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@v1
- name: Use Node.js 14.x
uses: actions/setup-node@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: ${{ matrix.node-version }}
- run: yarn --frozen-lockfile
- run: yarn lint

Expand All @@ -58,9 +62,14 @@ jobs:
env:
GRAPHILE_WORKER_SCHEMA: custom_schema

strategy:
matrix:
node-version: [20.x]
postgres-version: [12]

services:
postgres:
image: postgres:12
image: postgres:${{ matrix.postgres-version }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand All @@ -73,21 +82,26 @@ jobs:
--health-retries 5

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: ${{ matrix.node-version }}
- run: yarn --frozen-lockfile
# - run: yarn lint # No need to lint altschema
- run: yarn jest -i --ci
- 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:12
image: postgres:${{ matrix.postgres-version }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand All @@ -100,18 +114,22 @@ jobs:
--health-retries 5

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 16.x
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/ bionic-pgdg main >> /etc/apt/sources.list.d/pgdg.list"
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
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/docker-hub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Publish Docker image

on:
push:
branches:
- main
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: graphile/worker
flavor: |
latest=${{ github.ref == 'refs/heads/main' }}
tags: |
type=raw,value=next
type=semver,pattern={{version}}
type=semver,pattern={{major}}-{{minor}}
type=semver,pattern={{major}}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64/v8
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ yarn-error.log*
.vscode
node_modules/
/tasks/
/rewired/
_LOCAL/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-alpine as builder
FROM node:18-alpine as builder

WORKDIR /worker/

Expand All @@ -8,19 +8,20 @@ RUN yarn install --frozen-lockfile --production=false --no-progress

COPY tsconfig.json .eslintrc.js .eslintignore .prettierrc.js ./
COPY ./sql ./sql
COPY ./src ./src
COPY ./src ./src
COPY ./scripts ./scripts

RUN yarn run prepack

FROM node:14-alpine as clean
FROM node:18-alpine as clean

COPY package.json yarn.lock /worker/

COPY *.md /worker/
COPY --from=builder /worker/dist/ /worker/dist/
COPY --from=builder /worker/sql/ /worker/sql/

FROM node:14-alpine
FROM node:18-alpine
LABEL description="High performance Node.js/PostgreSQL job queue "

WORKDIR /worker/
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-alpine
FROM node:18-alpine
RUN apk add --no-cache bash

ENTRYPOINT ["yarn"]
Expand All @@ -12,6 +12,7 @@ RUN yarn install --frozen-lockfile && yarn cache clean
COPY ./__tests__ ./__tests__
COPY ./sql ./sql
COPY ./src ./src
COPY ./scripts ./scripts
COPY ./perfTest ./perfTest
COPY ./tsconfig.json ./
COPY ./jest.config.js ./
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<img width="120" height="120" title="Graphile Worker logo" src="https://cdn.rawgit.com/graphile/worker/2c8091e0bcce5d39e46a1b3833daf20b59097d1e/website/static/img/logo.optimized.svg" />

# graphile-worker

[![Patreon sponsor button](https://img.shields.io/badge/sponsor-via%20Patreon-orange.svg)](https://patreon.com/benjie)
Expand Down
Loading