8000 Merge branch 'master' into fix/typegen-composite-types-not-nullable · nikolubbe/postgres-meta@46c1c60 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 46c1c60

Browse files
committed
Merge branch 'master' into fix/typegen-composite-types-not-nullable
2 parents aa71282 + 0dbbdb6 commit 46c1c60

Some content is hidden

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

64 files changed

+8597
-12332
lines changed

.github/workflows/ci.yml

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,22 @@ on:
77
- master
8 F438 8
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

17-
- uses: actions/setup-node@v3
22+
- 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,25 +31,36 @@ 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

43-
- uses: docker/setup-buildx-action@v2
60+
- uses: docker/setup-buildx-action@v3
4461
name: Set up Docker Buildx
4562

46-
- uses: docker/build-push-action@v4
63+
- uses: docker/build-push-action@v5
4764
with:
4865
push: false
4966
tags: pg-meta:test

.github/workflows/docs.yml

Lines changed: 10 additions & 4 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

16-
- uses: actions/setup-node@v3
22+
- 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/mirror.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ jobs:
1616
packages: write
1717
steps:
1818
- name: configure aws credentials
19-
uses: aws-actions/configure-aws-credentials@v2
19+
uses: aws-actions/configure-aws-credentials@v4
2020
with:
2121
role-to-assume: ${{ secrets.PROD_AWS_ROLE }}
2222
aws-region: us-east-1
23-
- uses: docker/login-action@v2
23+
- uses: docker/login-action@v3
2424
with:
2525
registry: public.ecr.aws
26-
- uses: docker/login-action@v2
26+
- uses: docker/login-action@v3
2727
with:
2828
registry: ghcr.io
2929
username: ${{ github.actor }}
3030
password: ${{ secrets.GITHUB_TOKEN }}
31-
- uses: akhilerm/tag-push-action@v2.1.0
31+
- uses: akhilerm/tag-push-action@v2.2.0
3232
with:
3333
src: docker.io/supabase/postgres-meta:${{ inputs.version }}
3434
dst: |

.github/workflows/publish-deps.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ 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

16-
- uses: actions/setup-node@v3
16+
- 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
2222

23-
- uses: aws-actions/configure-aws-credentials@v2
23+
- uses: aws-actions/configure-aws-credentials@v4
2424
with:
2525
role-to-assume: ${{ secrets.PROD_AWS_ROLE }}
2626
aws-region: us-east-1

.github/workflows/release.yml

Lines changed: 14 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,58 +9,29 @@ 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

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

2323
- run: |
2424
npm clean-install
2525
npm run build
2626
2727
- id: semantic-release
28-
uses: cycjimmy/semantic-release-action@v3
28+
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@v3
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:
@@ -73,7 +44,7 @@ jobs:
7344
packages: write
7445
steps:
7546
- id: meta
76-
uses: docker/metadata-action@v4
47+
uses: docker/metadata-action@v5
7748
with:
7849
images: |
7950
supabase/postgres-meta
@@ -82,36 +53,36 @@ jobs:
8253
tags: |
8354
type=raw,value=v${{ needs.semantic-release.outputs.new-release-version }}
8455
85-
- uses: docker/setup-qemu-action@v2
56+
- uses: docker/setup-qemu-action@v3
8657
with:
8758
platforms: amd64,arm64
88-
- uses: docker/setup-buildx-action@v2
59+
- uses: docker/setup-buildx-action@v3
8960

9061
- name: Login to DockerHub
91-
uses: docker/login-action@v2
62+
uses: docker/login-action@v3
9263
with:
9364
username: ${{ secrets.DOCKER_USERNAME }}
9465
password: ${{ secrets.DOCKER_PASSWORD }}
9566

9667
- name: configure aws credentials
97-
uses: aws-actions/configure-aws-credentials@v2
68+
uses: aws-actions/configure-aws-credentials@v4
9869
with:
9970
role-to-assume: ${{ secrets.PROD_AWS_ROLE }}
10071
aws-region: us-east-1
10172

10273
- name: Login to ECR
103-
uses: docker/login-action@v2
74+
uses: docker/login-action@v3
10475
with:
10576
registry: public.ecr.aws
10677

10778
- name: Login to GHCR
108-
uses: docker/login-action@v2
79+
uses: docker/login-action@v3
10980
with:
11081
registry: ghcr.io
11182
username: ${{ github.actor }}
11283
password: ${{ secrets.GITHUB_TOKEN }}
11384

114-
- uses: docker/build-push-action@v4
85+
- uses: docker/build-push-action@v5
11586
with:
11687
push: true
11788
platforms: linux/amd64,linux/arm64

.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