Skip to content

Commit 4a66ba1

Browse files
committed
Merge branch 'master' into feat/pg-meta-cache
2 parents 106814f + dccf73b commit 4a66ba1

Some content is hidden

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

95 files changed

+14463
-19071
lines changed

.dockerignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
*
2-
!bin
2+
!src
3+
!package*.json
4+
!tsconfig*.json

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @supabase/api

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
- package-ecosystem: "npm"
8+
directory: "/"
9+
schedule:
10+
interval: "daily"

.github/workflows/automerge.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Dependabot auto-merge
2+
on: pull_request
3+
4+
permissions:
5+
contents: write
6+
pull-requests: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
if: ${{ github.actor == 'dependabot[bot]' }}
12+
steps:
13+
- name: Dependabot metadata
14+
id: metadata
15+
uses: dependabot/fetch-metadata@v1
16+
with:
17+
github-token: "${{ secrets.GITHUB_TOKEN }}"
18+
19+
- name: Approve a PR
20+
if: ${{ steps.metadata.outputs.update-type != 'version-update:semver-major' && !startswith(steps.metadata.outputs.new_version, '0.') }}
21+
run: gh pr review --approve "$PR_URL"
22+
env:
23+
PR_URL: ${{ github.event.pull_request.html_url }}
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Enable auto-merge for Dependabot PRs
27+
if: ${{ steps.metadata.outputs.update-type != 'version-update:semver-major' && !startswith(steps.metadata.outputs.new_version, '0.') }}
28+
run: gh pr merge --auto --squash "$PR_URL"
29+
env:
30+
PR_URL: ${{ github.event.pull_request.html_url }}
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yml

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,60 @@ jobs:
1212
name: Test
1313
runs-on: ubuntu-20.04
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v3
1616

17-
- uses: actions/setup-node@v2
17+
- uses: actions/setup-node@v3
1818
with:
19-
node-version: "14"
19+
node-version: "16"
2020

2121
- run: |
2222
npm clean-install
23+
npm run check
2324
npm run test
2425
2526
prettier-check:
2627
name: Prettier check
2728
runs-on: ubuntu-20.04
2829
steps:
29-
- uses: actions/checkout@v2
30+
- uses: actions/checkout@v3
3031

3132
- uses: actionsx/prettier@v2
3233
with:
3334
args: --check "{src,test}/**/*.ts"
35+
36+
docker:
37+
name: Build with docker
38+
runs-on: ubuntu-20.04
39+
steps:
40+
- uses: actions/checkout@v3
41+
name: Checkout Repo
42+
43+
- uses: docker/setup-buildx-action@v2
44+
name: Set up Docker Buildx
45+
46+
- uses: docker/build-push-action@v4
47+
with:
48+
push: false
49+
tags: pg-meta:test
50+
load: true
51+
cache-from: type=gha
52+
cache-to: type=gha,mode=max
53+
54+
- name: Check Health status
55+
run: |
56+
docker run -d --name pg-meta-test pg-meta:test
57+
state=$(docker inspect -f '{{ .State.Health.Status}}' pg-meta-test)
58+
if [ $state != "starting" ]; then
59+
exit 1
60+
fi
61+
sleep 10
62+
state=$(docker inspect -f '{{ .State.Health.Status}}' pg-meta-test)
63+
docker stop pg-meta-test
64+
if [ $state == "healthy" ]; then
65+
exit 0
66+
else
67+
exit 1
68+
fi
69+
70+
71+

.github/workflows/docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111
name: Publish docs
1212
runs-on: ubuntu-20.04
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515

16-
- uses: actions/setup-node@v2
16+
- uses: actions/setup-node@v3
1717
with:
18-
node-version: "14"
18+
node-version: "16"
1919

2020
- run: |
2121
npm clean-install

.github/workflows/mirror.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Mirror Image
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Image tag'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
mirror:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
steps:
18+
- name: configure aws credentials
19+
uses: aws-actions/configure-aws-credentials@v1
20+
with:
21+
role-to-assume: ${{ secrets.PROD_AWS_ROLE }}
22+
aws-region: us-east-1
23+
- uses: docker/login-action@v2
24+
with:
25+
registry: public.ecr.aws
26+
- uses: docker/login-action@v2
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
- uses: akhilerm/[email protected]
32+
with:
33+
src: docker.io/supabase/postgres-meta:${{ inputs.version }}
34+
dst: |
35+
public.ecr.aws/supabase/postgres-meta:${{ inputs.version }}
36+
ghcr.io/supabase/postgres-meta:${{ inputs.version }}

.github/workflows/publish-deps.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish Dependencies
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
publish:
8+
# Must match glibc verison in node:16-bullseye
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- uses: actions/checkout@v3
12+
with:
13+
repository: 'pyramation/libpg-query-node'
14+
ref: 'v13'
15+
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version: '16'
19+
20+
- run: npm i
21+
- run: npm run binary:build
22+
23+
- uses: aws-actions/configure-aws-credentials@v1
24+
with:
25+
role-to-assume: ${{ secrets.PROD_AWS_ROLE }}
26+
aws-region: us-east-1
27+
28+
- run: npx node-pre-gyp publish

.github/workflows/release.yml

Lines changed: 48 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ jobs:
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@v2
17+
- uses: actions/checkout@v3
1818

19-
- uses: actions/setup-node@v2
19+
- uses: actions/setup-node@v3
2020
with:
21-
node-version: "14"
21+
node-version: '16'
2222

2323
- run: |
2424
npm clean-install
2525
npm run build
2626
2727
- id: semantic-release
28-
uses: cycjimmy/semantic-release-action@v2
28+
uses: cycjimmy/semantic-release-action@v3
2929
with:
30-
semantic_version: 17
30+
semantic_version: 18
3131
env:
3232
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3333
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -39,11 +39,11 @@ jobs:
3939
if: needs.semantic-release.outputs.new-release-published == 'true'
4040
runs-on: ubuntu-20.04
4141
steps:
42-
- uses: actions/checkout@v2
42+
- uses: actions/checkout@v3
4343

44-
- uses: actions/setup-node@v2
44+
- uses: actions/setup-node@v3
4545
with:
46-
node-version: "14"
46+
node-version: '16'
4747

4848
- name: Prepare release
4949
run: |
@@ -66,33 +66,55 @@ jobs:
6666
needs:
6767
- semantic-release
6868
if: needs.semantic-release.outputs.new-release-published == 'true'
69-
runs-on: ubuntu-20.04
69+
runs-on: ubuntu-latest
70+
permissions:
71+
id-token: write # This is required for requesting the JWT from AWS
72+
contents: read
73+
packages: write
7074
steps:
71-
- uses: actions/checkout@v2
72-
73-
- uses: actions/setup-node@v2
75+
- id: meta
76+
uses: docker/metadata-action@v4
7477
with:
75-
node-version: "14"
76-
77-
- name: Prepare build
78-
run: |
79-
npm clean-install
80-
npm run pkg
81-
82-
- uses: docker/setup-qemu-action@v1
78+
images: |
79+
supabase/postgres-meta
80+
public.ecr.aws/supabase/postgres-meta
81+
ghcr.io/supabase/postgres-meta
82+
tags: |
83+
type=raw,value=v${{ needs.semantic-release.outputs.new-release-version }}
84+
85+
- uses: docker/setup-qemu-action@v2
8386
with:
8487
platforms: amd64,arm64
88+
- uses: docker/setup-buildx-action@v2
8589

86-
- uses: docker/setup-buildx-action@v1
87-
88-
- uses: docker/login-action@v1
90+
- name: Login to DockerHub
91+
uses: docker/login-action@v2
8992
with:
9093
username: ${{ secrets.DOCKER_USERNAME }}
9194
password: ${{ secrets.DOCKER_PASSWORD }}
9295

93-
- uses: docker/build-push-action@v2
96+
- name: configure aws credentials
97+
uses: aws-actions/configure-aws-credentials@v1
98+
with:
99+
role-to-assume: ${{ secrets.PROD_AWS_ROLE }}
100+
aws-region: us-east-1
101+
102+
- name: Login to ECR
103+
uses: docker/login-action@v2
104+
with:
105+
registry: public.ecr.aws
106+
107+
- name: Login to GHCR
108+
uses: docker/login-action@v2
109+
with:
110+
registry: ghcr.io
111+
username: ${{ github.actor }}
112+
password: ${{ secrets.GITHUB_TOKEN }}
113+
114+
- uses: docker/build-push-action@v4
94115
with:
95-
context: .
96116
push: true
97-
tags: supabase/postgres-meta:latest,supabase/postgres-meta:v${{ needs.semantic-release.outputs.new-release-version }}
98117
platforms: linux/amd64,linux/arm64
118+
tags: ${{ steps.meta.outputs.tags }}
119+
cache-from: type=gha
120+
cache-to: type=gha,mode=max

.pkg.config.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"name": "@supabase/postgres-meta",
33
"bin": {
4-
"postgres-meta": "bin/src/server/app.js"
4+
"postgres-meta": "dist/server/server.js"
55
},
66
"pkg": {
7-
"assets": ["bin/**/*.sql"],
7+
"outputPath": "bin",
8+
"assets": ["dist/**/*.sql"],
89
"scripts": ["node_modules/pg-format/lib/reserved.js"]
910
}
1011
}

0 commit comments

Comments
 (0)