Skip to content

Commit

Permalink
Merge branch 'master' into allow-row-type-returns
Browse files Browse the repository at this point in the history
  • Loading branch information
soedirgo committed Mar 13, 2024
2 parents f46bbc4 + ae27189 commit 87bf35a
Show file tree
Hide file tree
Showing 86 changed files with 9,968 additions and 10,675 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @supabase/api
* @supabase/api @supabase/frontend
43 changes: 30 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,22 @@ on:
- master
workflow_dispatch:

# Cancel old builds on new commit for same workflow + branch/PR
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test:
name: Test
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "16"
node-version-file: '.nvmrc'


- run: |
npm clean-install
Expand All @@ -25,25 +31,36 @@ jobs:
prettier-check:
name: Prettier check
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actionsx/prettier@v2
- name: Setup node
uses: actions/setup-node@v4
with:
args: --check "{src,test}/**/*.ts"

node-version-file: '.nvmrc'

# Installing all dependencies takes up to three minutes, hacking around to only installing prettier+deps
- name: Download dependencies
run: |
rm package.json
rm package-lock.json
npm i prettier@3 [email protected]
- name: Run prettier
run: |-
npx prettier -c '{src,test}/**/*.ts'
docker:
name: Build with docker
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
name: Checkout Repo

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

- uses: docker/build-push-action@v4
- uses: docker/build-push-action@v5
with:
push: false
tags: pg-meta:test
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@ on:
- master
workflow_dispatch:


# Cancel old builds on new commit for same workflow + branch/PR
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
docs:
name: Publish docs
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "16"
node-version-file: '.nvmrc'

- run: |
npm clean-install
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ jobs:
packages: write
steps:
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.PROD_AWS_ROLE }}
aws-region: us-east-1
- uses: docker/login-action@v2
- uses: docker/login-action@v3
with:
registry: public.ecr.aws
- uses: docker/login-action@v2
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: akhilerm/tag-push-action@v2.1.0
- uses: akhilerm/tag-push-action@v2.2.0
with:
src: docker.io/supabase/postgres-meta:${{ inputs.version }}
dst: |
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/publish-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ on:

jobs:
publish:
# Must match glibc verison in node:16-bullseye
runs-on: ubuntu-20.04
# Must match glibc verison in node:20
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: 'pyramation/libpg-query-node'
ref: 'v13'
ref: 'v15'

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '16'
node-version-file: '.nvmrc'

- run: npm i
- run: npm run binary:build

- uses: aws-actions/configure-aws-credentials@v2
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.PROD_AWS_ROLE }}
aws-region: us-east-1
Expand Down
57 changes: 14 additions & 43 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,58 +9,29 @@ on:
jobs:
semantic-release:
name: Release
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
outputs:
new-release-published: ${{ steps.semantic-release.outputs.new_release_published }}
new-release-version: ${{ steps.semantic-release.outputs.new_release_version }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '16'
node-version-file: '.nvmrc'

- run: |
npm clean-install
npm run build
- id: semantic-release
uses: cycjimmy/semantic-release-action@v3
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 18
semantic_version: 21
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

upload:
name: Upload assets to GitHub Releases
needs:
- semantic-release
if: needs.semantic-release.outputs.new-release-published == 'true'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: '16'

- name: Prepare release
run: |
npm clean-install
npm run pkg
mv bin/postgres-meta-linux postgres-meta
tar -czvf postgres-meta-${{ needs.semantic-release.outputs.new-release-version }}-x86_64-linux-gnu.tar.gz postgres-meta
mv bin/postgres-meta-macos postgres-meta
tar -czvf postgres-meta-${{ needs.semantic-release.outputs.new-release-version }}-x86_64-apple-darwin.tar.gz postgres-meta
mv bin/postgres-meta-win.exe postgres-meta.exe
tar -czvf postgres-meta-${{ needs.semantic-release.outputs.new-release-version }}-x86_64-pc-windows.tar.gz postgres-meta.exe
- uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.semantic-release.outputs.new-release-version }}
files: postgres-meta-*.tar.gz

docker-hub:
name: Release on Docker Hub
needs:
Expand All @@ -73,7 +44,7 @@ jobs:
packages: write
steps:
- id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
supabase/postgres-meta
Expand All @@ -82,36 +53,36 @@ jobs:
tags: |
type=raw,value=v${{ needs.semantic-release.outputs.new-release-version }}
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-qemu-action@v3
with:
platforms: amd64,arm64
- uses: docker/setup-buildx-action@v2
- uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

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

- name: Login to ECR
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: public.ecr.aws

- name: Login to GHCR
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/build-push-action@v4
- uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20
11 changes: 0 additions & 11 deletions .pkg.config.json

This file was deleted.

13 changes: 13 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/github", {
"successComment": false,
"failTitle": false
}
],
"@semantic-release/npm"
]
}
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Contributing

### Install deps

- docker
- `npm install`

### Start services

1. Run `docker compose up` in `/test/db`
2. Run the tests: `npm run test:run`
3. Make changes in code (`/src`) and tests (`/test/lib` and `/test/server`)
4. Run the tests again: `npm run test:run`
5. Commit + PR
14 changes: 9 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
FROM node:16-bullseye as build
FROM node:20 as build
WORKDIR /usr/src/app
# Do `npm ci` separately so we can cache `node_modules`
# https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
COPY package.json package-lock.json ./
RUN npm clean-install
COPY . .
RUN npm run build
RUN npm run build && npm prune --omit=dev

FROM node:16-bullseye-slim
FROM node:20-slim
RUN apt-get update && apt-get install -y \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/src/app
COPY --from=build /usr/src/app/node_modules node_modules
COPY --from=build /usr/src/app/dist dist
COPY package.json ./
ENV PG_META_PORT=8080
CMD ["npm", "run", "start"]
# `npm run start` does not forward signals to child process
CMD ["node", "dist/server/server.js"]
EXPOSE 8080
# --start-period defaults to 0s, but can't be set to 0s (to be explicit) by now
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)})"
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)})"
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ None. Please don't use this as a standalone server. This should be used behind a

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

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.
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.

To make changes to the TypeScript type generation, run `npm run gen:types:typescript` while you have `npm run dev` running.
To use your own database connection string instead of the provided test database, run:
Expand All @@ -113,3 +113,4 @@ Apache 2.0
We are building the features of Firebase using enterprise-grade, open source products. We support existing communities wherever possible, and if the products don’t exist we build them and open source them ourselves.

[![New Sponsor](https://user-images.githubusercontent.com/10214025/90518111-e74bbb00-e198-11ea-8f88-c9e3c1aa4b5b.png)](https://github.com/sponsors/supabase)

Loading

0 comments on commit 87bf35a

Please sign in to comment.