-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Rename + readme example * Reduce performance requirements * Fix ci pnpm cache * Init changeset * Add ci/cd * Fix cd * rename * Fix cicd
- Loading branch information
Showing
14 changed files
with
221 additions
and
68 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Changesets | ||
|
||
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works | ||
with multi-package repos, or single-package repos to help you version and publish your code. You can | ||
find the full documentation for it [in our repository](https://github.com/changesets/changesets) | ||
|
||
We have a quick list of common questions to get you started engaging with this project in | ||
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": "@changesets/cli/changelog", | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "restricted", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'pg-task': patch | ||
--- | ||
|
||
Add initial version |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: integration | ||
|
||
on: | ||
workflow_call: | ||
pull_request: | ||
branches: | ||
- "main" | ||
paths-ignore: | ||
- 'docs/**' | ||
- 'example/**' | ||
- '**/*.md' | ||
|
||
jobs: | ||
# Label of the container job | ||
test: | ||
# Containers must run in Linux based operating systems | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [18.x, 20.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
id: setup-node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: 8 | ||
|
||
# See https://github.com/actions/setup-node/issues/641#issuecomment-1358859686 | ||
- name: pnpm cache path | ||
id: pnpm-cache-path | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
- name: pnpm cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.pnpm-cache-path.outputs.STORE_PATH }} | ||
key: ${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
- name: typecheck | ||
run: pnpm run typecheck | ||
- name: test | ||
run: pnpm run test | ||
- name: ✅ Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: cicd | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
test: | ||
uses: ./.github/workflows/ci.yml | ||
release: | ||
name: Release | ||
needs: test | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: write | ||
packages: write | ||
pull-requests: write | ||
issues: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v4 | ||
id: setup-node | ||
with: | ||
node-version: 20.x | ||
- name: Install pnpm | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: 8 | ||
# See https://github.com/actions/setup-node/issues/641#issuecomment-1358859686 | ||
- name: pnpm cache path | ||
id: pnpm-cache-path | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
- name: pnpm cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.pnpm-cache-path.outputs.STORE_PATH }} | ||
key: ${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Create Release Pull Request | ||
uses: changesets/action@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,50 @@ | ||
# pg-task | ||
|
||
A SQS like solution build on top of Postgres and NodeJS. | ||
|
||
## Usage | ||
|
||
``` | ||
npm install pg-task | ||
``` | ||
|
||
```typescript | ||
import { createManager, executeQuery, createPlans, createTaskQueueFactory } from 'pg-task'; | ||
import { Pool } from 'pg'; | ||
|
||
const pool = new Pool({}); | ||
|
||
const manager = createManager({ | ||
pgClient: pool, | ||
schema, | ||
}); | ||
await manager.start(); | ||
|
||
// Register a worker for `worker-queue` task queue | ||
const workerId = await manager.work<MyTask>({ | ||
queue: 'worker-queue', | ||
async handler(data) { | ||
await Promise.resolve(); | ||
}, | ||
}); | ||
|
||
// enqueue tasks | ||
const plans = createPlans(schema); | ||
const taskFactory = createTaskQueueFactory('worker-queue'); | ||
await executeQuery( | ||
pool, | ||
plans.enqueueTasks( | ||
taskFactory([ | ||
{ | ||
data: { somepayload: 'test' }, | ||
}, | ||
{ | ||
data: { somepayload: 'test' }, | ||
}, | ||
]) | ||
) | ||
); | ||
|
||
// On application shutdown | ||
await manager.stop(); | ||
``` |
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
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
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
Oops, something went wrong.