8000 Merge branch 'master' into chore/refactor-generator-metadata-collection · zhudy/supabase-postgres-meta@62c254c · GitHub
[go: up one dir, main page]

Skip to content

Commit 62c254c

Browse files
committed
Merge branch 'master' into chore/refactor-generator-metadata-collection
2 parents 0cbadf6 + 1fd19a2 commit 62c254c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+5769
-11119
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,22 @@ on:
77
- master
88
workflow_dispatch:
99

10+
# Cancel old builds on new commit for same workflow + branch/PR
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
1015
jobs:
1116
test:
1217
name: Test
13-
runs-on: ubuntu-20.04
18+
runs-on: ubuntu-22.04
1419
steps:
15-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
1621

1722
- uses: actions/setup-node@v4
1823
with:
19-
node-version: "18"
24+
node-version-file: '.nvmrc'
25+
2026

2127
- run: |
2228
npm clean-install
@@ -25,19 +31,30 @@ jobs:
2531
2632
prettier-check:
2733
name: Prettier check
28-
runs-on: ubuntu-20.04
34+
runs-on: ubuntu-22.04
2935
steps:
30-
- uses: actions/checkout@v3
36+
- uses: actions/checkout@v4
3137

32-
- uses: actionsx/prettier@v2
38+
- name: Setup node
39+
uses: actions/setup-node@v4
3340
with:
34-
args: --check "{src,test}/**/*.ts"
35-
41+
node-version-file: '.nvmrc'
42+
43+
# Installing all dependencies takes up to three minutes, hacking around to only installing prettier+deps
44+
- name: Download dependencies
45+
run: |
46+
rm package.json
47+
rm package-lock.json
48+
npm i prettier@3 prettier-plugin-sql@0.17.0
49+
- name: Run prettier
50+
run: |-
51+
npx prettier -c '{src,test}/**/*.ts'
52+
3653
docker:
3754
name: Build with docker
38-
runs-on: ubuntu-20.04
55+
runs-on: ubuntu-22.04
3956
steps:
40-
- uses: actions/checkout@v3
57+
- uses: actions/checkout@v4
4158
name: Checkout Repo
4259

4360
- uses: docker/setup-buildx-action@v3

.github/workflows/docs.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,22 @@ on:
66
- master
77
workflow_dispatch:
88

9+
10+
# Cancel old builds on new commit for same workflow + branch/PR
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
915
jobs:
1016
docs:
1117
name: Publish docs
12-
runs-on: ubuntu-20.04
18+
runs-on: ubuntu-22.04
1319
steps:
14-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
1521

1622
- uses: actions/setup-node@v4
1723
with:
18-
node-version: "18"
24+
node-version-file: '.nvmrc'
1925

2026
- run: |
2127
npm clean-install

.github/workflows/publish-deps.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ on:
55

66
jobs:
77
publish:
8-
# Must match glibc verison in node:18
8+
# Must match glibc verison in node:20
99
runs-on: ubuntu-22.04
1010
steps:
11-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@v4
1212
with:
1313
repository: 'pyramation/libpg-query-node'
14-
ref: 'v13'
14+
ref: 'v15'
1515

1616
- uses: actions/setup-node@v4
1717
with:
18-
node-version: '18'
18+
node-version-file: '.nvmrc'
1919

2020
- run: npm i
2121
- run: npm run binary:build

.github/workflows/release.yml

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ on:
99
jobs:
1010
semantic-release:
1111
name: Release
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-22.04
1313
outputs:
1414
new-release-published: ${{ steps.semantic-release.outputs.new_release_published }}
1515
new-release-version: ${{ steps.semantic-release.outputs.new_release_version }}
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818

1919
- uses: actions/setup-node@v4
2020
with:
21-
node-version: '18'
21+
node-version-file: '.nvmrc'
2222

2323
- run: |
2424
npm clean-install
@@ -27,40 +27,11 @@ jobs:
2727
- id: semantic-release
2828
uses: cycjimmy/semantic-release-action@v4
2929
with:
30-
semantic_version: 18
30+
semantic_version: 21
3131
env:
3232
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3333
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3434

35-
upload:
36-
name: Upload assets to GitHub Releases
37-
needs:
38-
- semantic-release
39-
if: needs.semantic-release.outputs.new-release-published == 'true'
40-
runs-on: ubuntu-20.04
41-
steps:
42-
- uses: actions/checkout@v3
43-
44-
- uses: actions/setup-node@v4
45-
with:
46-
node-version: '18'
47-
48-
- name: Prepare release
49-
run: |
50-
npm clean-install
51-
npm run pkg
52-
mv bin/postgres-meta-linux postgres-meta
53-
tar -czvf postgres-meta-${{ needs.semantic-release.outputs.new-release-version }}-x86_64-linux-gnu.tar.gz postgres-meta
54-
mv bin/postgres-meta-macos postgres-meta
55-
tar -czvf postgres-meta-${{ needs.semantic-release.outputs.new-release-version }}-x86_64-apple-darwin.tar.gz postgres-meta
56-
mv bin/postgres-meta-win.exe postgres-meta.exe
57-
tar -czvf postgres-meta-${{ needs.semantic-release.outputs.new-release-version }}-x86_64-pc-windows.tar.gz postgres-meta.exe
58-
59-
- uses: softprops/action-gh-release@v1
60-
with:
61-
tag_name: v${{ needs.semantic-release.outputs.new-release-version }}
62-
files: postgres-meta-*.tar.gz
63-
6435
docker-hub:
6536
name: Release on Docker Hub
6637
needs:

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v20

.pkg.config.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Contributing
2+
3+
### Install deps
4+
5+
- docker
6+
- `npm install`
7+
8+
### Start services
9+
10+
1. Run `docker compose up` in `/test/db`
11+
2. Run the tests: `npm run test:run`
12+
3. Make changes in code (`/src`) and tests (`/test/lib` and `/test/server`)
13+
4. Run the tests again: `npm run test:run`
14+
5. Commit + PR

Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:18 as build
1+
FROM node:20 as build
22
WORKDIR /usr/src/app
33
# Do `npm ci` separately so we can cache `node_modules`
44
# https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
@@ -7,13 +7,17 @@ RUN npm clean-install
77
COPY . .
88
RUN npm run build && npm prune --omit=dev
99

10-
FROM node:18-slim
10+
FROM node:20-slim
11+
RUN apt-get update && apt-get install -y \
12+
ca-certificates \
13+
&& rm -rf /var/lib/apt/lists/*
1114
WORKDIR /usr/src/app
1215
COPY --from=build /usr/src/app/node_modules node_modules
1316
COPY --from=build /usr/src/app/dist dist
1417
COPY package.json ./
1518
ENV PG_META_PORT=8080
16-
CMD ["npm", "run", "start"]
19+
# `npm run start` does not forward signals to child process
20+
CMD ["node", "dist/server/server.js"]
1721
EXPOSE 8080
1822
# --start-period defaults to 0s, but can't be set to 0s (to be explicit) by now
19-
HEALTHCHECK --interval=5s --timeout=5s --retries=3 CMD node -e "require('http').get('http://localhost:8080/health', (r) => {if (r.statusCode !== 200) throw new Error(r.statusCode)})"
23+
HEALTHCHECK --interval=5s --timeout=5s --retries=3 CMD node -e "fetch('http://localhost:8080/health').then((r) => {if (r.status !== 200) throw new Error(r.status)})"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ None. Please don't use this as a standalone server. This should be used behind a
9898

9999
To start developing, run `npm run dev`. It will set up the database with Docker for you. The server will restart on file change.
100100

101-
If you are fixing a bug, you should create a new test case. To test your changes, add the `-u/--updateSnapshot` flag to `jest` on the `test:run` script, run `npm run test`, and then review the git diff of the snapshots. Depending on your change, you may see `id` fields being changed - this is expected and you are free to commit it, as long as it passes the CI. Don't forget to remove the `-u/--updateSnapshot` flag when committing.
101+
If you are fixing a bug, you should create a new test case. To test your changes, add the `-u` flag to `vitest` on the `test:run` script, run `npm run test`, and then review the git diff of the snapshots. Depending on your change, you may see `id` fields being changed - this is expected and you are free to commit it, as long as it passes the CI. Don't forget to remove the `-u` flag when committing.
102102

103103
To make changes to the TypeScript type generation, run `npm run gen:types:typescript` while you have `npm run dev` running.
104104
To use your own database connection string instead of the provided test database, run:

0 commit comments

Comments
 (0)
0