Skip to content

Commit

Permalink
feat: use supabase for question comments (#4006)
Browse files Browse the repository at this point in the history
feat: use supabase for question comments
  • Loading branch information
mariojsnunes authored Nov 30, 2024
1 parent fa10f7e commit 02bfc46
Show file tree
Hide file tree
Showing 61 changed files with 15,715 additions and 13,417 deletions.
67 changes: 38 additions & 29 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,6 @@ examples:
# Jobs - Independently specified lists of tasks and environments for execution
######################################################################################################
jobs:
spellcheck:
docker: *docker
resource_class: small
steps:
- checkout
- attach_workspace:
at: '.'
- run:
name: Check spelling on documentation
command: |
npx cspell "**/*.md" --config ./.cspell.json
lint:
docker: *docker
resource_class: medium+
Expand Down Expand Up @@ -305,7 +294,7 @@ jobs:
command: yarn storybook:build
deploy:
docker:
- image: cimg/node:20.7.0
- image: cimg/node:20.7.0
resource_class: medium+
parameters:
# optional environment variables to set during build process
Expand Down Expand Up @@ -337,7 +326,7 @@ jobs:
- run:
name: Add fly to PATH
command: echo "export PATH=\"/home/circleci/.fly/bin:$PATH\"" >> $BASH_ENV
- run:
- run:
name: Login fly
command: flyctl auth token $FLY_API_TOKEN --debug --verbose
- run:
Expand Down Expand Up @@ -372,6 +361,20 @@ jobs:
--build-secret VITE_HOWTOS_HEADING="$VITE_HOWTOS_HEADING" \
--build-secret VITE_COMMUNITY_PROGRAM_URL="$VITE_COMMUNITY_PROGRAM_URL" \
--build-secret VITE_QUESTIONS_GUIDELINES_URL="$VITE_QUESTIONS_GUIDELINES_URL"
- run:
name: Set Supabase Secrets
command: flyctl -a << parameters.FLY_APP_NAME >> secrets set SUPABASE_API_URL=$SUPABASE_API_URL SUPABASE_KEY=$SUPABASE_KEY FIREBASE_PROJECT_ID=$FIREBASE_PROJECT_ID FIREBASE_PRIVATE_KEY="$FIREBASE_PRIVATE_KEY" FIREBASE_CLIENT_EMAIL=$FIREBASE_CLIENT_EMAIL
deploy-supabase:
environment:
SUPABASE_ACCESS_TOKEN: $SUPABASE_ACCESS_TOKEN
SUPABASE_DB_PASSWORD: $SUPABASE_DB_PASSWORD
docker:
- image: supabase/cli:latest
steps:
- checkout
- run: supabase login --token
- run: supabase link --project-ref $SUPABASE_PROJECT_ID
- run: supabase db push
# Run cypress e2e tests on chrome
test_e2e:
docker: *docker
Expand Down Expand Up @@ -421,7 +424,7 @@ jobs:
at: '.'
- run:
command: yarn build-storybook

release:
docker: *docker
resource_class: medium+
Expand All @@ -442,12 +445,8 @@ workflows:
main_workflow:
# by default jobs will run concurrently, so specify requires if want to run sequentially
jobs:
- spellcheck:
name: Check documentation spelling
- lint:
name: Lint code
requires:
- 'Check documentation spelling'
#---------------------- Test ----------------------
# Note - when calling test we also let the test script handle building as it injects random variables for seeding the DB
- build:
Expand Down Expand Up @@ -501,24 +500,25 @@ workflows:
context:
- e2e-tests
<<: *filter_only_default_branch
#---------------------- Development Instances Build and Deploy ----------------------
#---------------------- Approval ----------------------
- approve:
type: approval
name: 'Approve Production deployment'
requires:
- test_e2e
#---------------------- Development Instances Build and Deploy ----------------------
- release:
name: Release new version to GitHub
context:
- release-context
<<: *filter_only_default_branch
#---------------------- Deploy ----------------------
- deploy-supabase:
name: 'Deploy to Supabase'
requires:
- "Approve Production deployment"
- 'Approve Production deployment'
<<: *filter_only_default_branch
context:
- supabase-deploy
- deploy:
name: 'Deploy: community.fixing.fashion'
requires:
- 'Release new version to GitHub'
- 'Deploy to Supabase'
<<: *filter_only_default_branch
DEPLOY_ALIAS: fixing-fashion-prod
FLY_APP_NAME: community-platform-ff
Expand All @@ -527,10 +527,11 @@ workflows:
- circle-ci-patreon-context
- fixing-fashion-prod
- fly-deploy
- supabase-deploy
- deploy:
name: 'Deploy: community.preciousplastic.com'
requires:
- 'Release new version to GitHub'
- 'Deploy to Supabase'
<<: *filter_only_default_branch
DEPLOY_ALIAS: 'production'
FLY_APP_NAME: community-platform-pp
Expand All @@ -539,10 +540,11 @@ workflows:
- circle-ci-patreon-context
- community-platform-production
- fly-deploy
- supabase-deploy
- deploy:
name: 'Deploy: community.projectkamp.com'
requires:
- 'Release new version to GitHub'
- 'Deploy to Supabase'
<<: *filter_only_default_branch
DEPLOY_ALIAS: project-kamp-production
FLY_APP_NAME: community-platform-pk
Expand All @@ -551,4 +553,11 @@ workflows:
- circle-ci-patreon-context
- project-kamp-production
- fly-deploy

- supabase-deploy
- release:
name: Release new version to GitHub
context:
- release-context
requires:
- 'Deploy: community.preciousplastic.com'
<<: *filter_only_default_branch
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ VITE_QUESTIONS_GUIDELINES_URL=https://community.preciousplastic.com/academy/guid
# For testing, VITE_PLATFORM_PROFILES in localStorage is prioritised over this value
# All valid options for VITE_PLATFORM_PROFILES: "member,workspace,community-builder,space,collection-point,machine-builder"
VITE_PLATFORM_PROFILES="member,workspace,community-builder,collection-point,machine-builder"
# SUPABASE_API_URL=create a file ".env.local" and set this key there
# SUPABASE_KEY=create a file ".env.local" and set this key there
TENANT_ID=precious-plastic
3 changes: 1 addition & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
{
"order": [
"[static-properties]",
"[static-methods]",
"[properties]",
"[conventional-private-properties]",
"constructor",
"[static-methods]",
"[methods]",
"[conventional-private-methods]"
],
Expand All @@ -49,7 +49,6 @@
],
"import/newline-after-import": "error",
"import/no-named-as-default": "off",
"max-classes-per-file": "error",
"no-useless-escape": "error",
"react/display-name": "error",
"react/jsx-no-target-blank": "warn",
Expand Down
36 changes: 34 additions & 2 deletions .github/workflows/pr-preview-fly-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Deploy Fly PR Preview
on:
# Run this workflow on every PR event. Existing review apps will be updated when the PR is updated.
pull_request_target:
pull_request:
# Trigger when labels are changed or more commits added to a PR that contains labels
types: [labeled, synchronize]
# Only create a preview if changes have been made to the main src code or backend functions
Expand Down Expand Up @@ -36,16 +36,48 @@ jobs:
name: preview
# The script in the `deploy` sets the URL output for each review app.
url: ${{ steps.deploy.outputs.url }}

env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.PREVIEW_DB_PASSWORD }}
SUPABASE_PROJECT_ID: ${{ secrets.PREVIEW_PROJECT_ID }}
steps:
- name: Get code
uses: actions/checkout@v4
with:
# pull the repo from the pull request source, not the default local repo
ref: ${{ github.event.pull_request.head.sha }}

- name: Install supabase CLI
uses: supabase/setup-cli@v1
with:
version: latest

- name: Link Supabase project
run: supabase link --project-ref $SUPABASE_PROJECT_ID

- name: Push Supabase DB
run: supabase db push

- name: Install Fly CLI
run: |
curl -L https://fly.io/install.sh | sh
echo "$HOME/.fly/bin" >> "$GITHUB_PATH"
- name: Deploy PR app to Fly.io
id: deploy
uses: superfly/fly-pr-review-apps@1.3.0
with:
config: fly-preview.toml
name: community-platform-pr-${{ github.event.number }}
name: community-platform-pr-${{ github.event.number }}

- name: Set Fly.io Secrets
env:
SUPABASE_API_URL: ${{ secrets.SUPABASE_API_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
FIREBASE_PRIVATE_KEY: ${{ secrets.FIREBASE_PRIVATE_KEY }}
FIREBASE_CLIENT_EMAIL: ${{ secrets.FIREBASE_CLIENT_EMAIL }}
FLY_APP_NAME: community-platform-pr-${{ github.event.number }}
run: |
fly -a $FLY_APP_NAME secrets set SUPABASE_API_URL=$SUPABASE_API_URL SUPABASE_KEY=$SUPABASE_KEY FIREBASE_PROJECT_ID=$FIREBASE_PROJECT_ID FIREBASE_PRIVATE_KEY="$FIREBASE_PRIVATE_KEY" FIREBASE_CLIENT_EMAIL=$FIREBASE_CLIENT_EMAIL
28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

Loading

0 comments on commit 02bfc46

Please sign in to comment.