Skip to content

Commit

Permalink
Merge pull request #183 from technologiestiftung/staging
Browse files Browse the repository at this point in the history
staging to master
  • Loading branch information
ff6347 authored Mar 21, 2023
2 parents 9c59729 + 3e67470 commit f8c4a21
Show file tree
Hide file tree
Showing 140 changed files with 98,312 additions and 23,673 deletions.
21 changes: 21 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The values below are taken from the command `supabase start`
# WARNING: Don't use production URLs or tokens here
SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
SUPABASE_URL=http://localhost:54321
SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
SUPABASE_MAX_ROWS=1000

# auth0.com
# also neded for integration tests
# You should have a separate API for production and development/testing
# Using your production API from auth0.com won't do any harm
# since these values are only used to obtain JWT credentials
jwksuri=https://your-fancy-tenant.eu.auth0.com/.well-known/jwks.json
audience=your-audience
issuer=https://your-fancy-tenant.eu.auth0.com/

jwt_secret=
client_secret=
client_id=
# this is for later usage with vscode rest-client
token=
23 changes: 0 additions & 23 deletions .env.sample

This file was deleted.

5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

25 changes: 25 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
env: {
es2021: true,
node: true,
"jest/globals": true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"prettier",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["@typescript-eslint", "jest"],
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{ varsIgnorePattern: "^_", argsIgnorePattern: "^_" },
],
},
};
3 changes: 0 additions & 3 deletions .eslintrc.js

This file was deleted.

2 changes: 0 additions & 2 deletions .github/.keepme

This file was deleted.

2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@fabianmoronzirfas
* @ff6347
29 changes: 29 additions & 0 deletions .github/workflows/deploy-to-supabase-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Deploy Migrations to Production

on:
push:
branches:
- main
workflow_dispatch:

jobs:
deploy:
environment: production
runs-on: ubuntu-22.04
if: "!contains(github.event.head_commit.message, 'skip ci')"

env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
PRODUCTION_PROJECT_ID: ${{ secrets.PROJECT_ID }}

steps:
- uses: actions/checkout@v3

- uses: supabase/setup-cli@v1
with:
version: 1.36.6

- run: |
supabase link --project-ref $PRODUCTION_PROJECT_ID
supabase db push
29 changes: 29 additions & 0 deletions .github/workflows/deploy-to-supabase-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Deploy Migrations to Staging

on:
push:
branches:
- staging
workflow_dispatch:

jobs:
deploy:
environment: staging
runs-on: ubuntu-22.04
if: "!contains(github.event.head_commit.message, 'skip ci')"

env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
STAGING_PROJECT_ID: ${{ secrets.PROJECT_ID }}

steps:
- uses: actions/checkout@v3

- uses: supabase/setup-cli@v1
with:
version: 1.36.6

- run: |
supabase link --project-ref $STAGING_PROJECT_ID
supabase db push
24 changes: 0 additions & 24 deletions .github/workflows/dev-branch-sync.yml

This file was deleted.

82 changes: 32 additions & 50 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,78 +1,60 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

# TODO: adjust ci workflow to use new testing setup (vercel and supabase)
name: Node.js CI

env:
CI: "true"
NODE_ENV: "test"
on:
push:
branches: [master, staging]
branches: [master, dev, staging]
pull_request:
branches: [master, staging]
branches: [master, dev, staging]

jobs:
build:
environment: ci_test
test:
env:
CI: "true"
NODE_ENV: "test"
SUPABASE_INTERNAL_IMAGE_REGISTRY: docker.io
SUPABASE_ANON_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs
SUPABASE_URL: http://localhost:54321
SUPABASE_SERVICE_ROLE_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSJ9.vI9obAHOGyVVKa3pD--kJlyxp-Z2zV9UUMAhKpNLAcU
host: localhost
port: 54322
password: postgres
user: postgres
database: postgres
client_secret: ${{ secrets.CLIENT_SECRET }}
client_id: ${{ secrets.CLIENT_ID }}
issuer: ${{ secrets.ISSUER }}
jwt_secret: ${{ secrets.JWT_SECRET }}
jwksuri: ${{ secrets.JWKSURI }}
audience: ${{ secrets.AUDIENCE }}
SUPABASE_ANON_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
SUPABASE_SERVICE_ROLE_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
SUPABASE_MAX_ROWS: 1000
issuer: ${{ secrets.issuer }}
audience: ${{ secrets.audience }}
jwksuri: ${{ secrets.jwksuri }}
jwt_secret: ${{ secrets.jwt_secret }}
client_secret: ${{ secrets.client_secret }}
client_id: ${{ secrets.client_id }}

runs-on: ubuntu-latest
environment: ci_test
if: "!contains(github.event.head_commit.message, 'skip ci')"
strategy:
matrix:
node-version: [16.x, 18.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Checkout technologiestiftung/giessdenkiez-de-supabase#staging
uses: actions/checkout@v3
# check the supabase setup for staging
if: github.event.pull_request.base.ref == 'staging' || github.ref == 'refs/heads/staging'
with:
repository: technologiestiftung/giessdenkiez-de-supabase
path: gdk-supabase
ref: staging
- name: Checkout technologiestiftung/giessdenkiez-de-supabase#main
uses: actions/checkout@v3
# check the supabase setup for master
if: github.event.pull_request.base.ref == 'master' || github.ref == 'refs/heads/master'
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v2
with:
repository: technologiestiftung/giessdenkiez-de-supabase
path: gdk-supabase
node-version-file: ".nvmrc"
- uses: supabase/setup-cli@v1
with:
version: 1.8.7
- run: cd gdk-supabase && supabase start && cd ..
version: 1.36.6
- run: supabase start
- run: npm ci
- run: npm run build --if-present
# - run: PGPASSWORD=ent psql -h localhost -d trees -U fangorn -q -f test/sql/build-schema.sql
- run: npm test
- run: cd gdk-supabase && supabase stop && cd ..
# Make sure to run tests in band and force exit to avoid hanging tests
# until we know where the open handles are
- run: npm test -- --runInBand --forceExit
- run: supabase stop
- run: npm run lint
release:
name: semantic-release
needs: [build]
needs: [test]
runs-on: ubuntu-latest
outputs:
new-release-published: ${{ steps.semantic-release.outputs.new_release_published }}
Expand All @@ -83,12 +65,12 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@v3
with:
node-version: 18
node-version-file: ".nvmrc"
- run: npm ci
- id: semantic-release
uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 18
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading

1 comment on commit f8c4a21

@vercel
Copy link

@vercel vercel bot commented on f8c4a21 Mar 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.