Skip to content

Commit

Permalink
Merge pull request #6 from nitic-pbl-p8/4/auth
Browse files Browse the repository at this point in the history
4/auth
  • Loading branch information
dino3616 authored Feb 25, 2024
2 parents 2279bf3 + d7d8e59 commit 5f95be7
Show file tree
Hide file tree
Showing 411 changed files with 16,596 additions and 4,991 deletions.
2 changes: 2 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"mikestead.dotenv",
"ms-ossdata.vscode-postgresql",
"orta.vscode-jest",
"prisma.prisma",
"Prettier-SQL.SQLFlavourOverride",
"stylelint.vscode-stylelint",
"usernamehw.errorlens",
"vincaslt.highlight-matching-tag",
Expand Down
172 changes: 9 additions & 163 deletions .github/workflows/app-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,164 +28,6 @@ jobs:
token: ${{ github.token }}
filters: .github/filter.yaml

install:
runs-on: ubuntu-latest
needs: filter
if: needs.filter.outputs.app == 'true'
outputs:
STORE_PATH: ${{ steps.pnpm-env.outputs.STORE_PATH }}
steps:
- name: checkout
uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v3
with:
node-version-file: "package.json"

- name: setup pnpm
uses: pnpm/action-setup@v2
with:
run_install: false

- name: setup pnpm environment variable
id: pnpm-env
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- name: cache pnpm dependencies
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-env.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-dependencies-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-dependencies-

- name: install dependencies
run: pnpm install --frozen-lockfile

format:
runs-on: ubuntu-latest
needs: install
steps:
- name: checkout
uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v3
with:
node-version-file: "package.json"

- name: setup pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
run_install: false

- name: restore pnpm dependencies
uses: actions/cache/restore@v3
with:
path: ${{ needs.install.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-dependencies-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-dependencies-

- name: install dependencies
run: pnpm install --frozen-lockfile

- name: format
run: pnpm turbo run fmt

lint:
runs-on: ubuntu-latest
needs: install
steps:
- name: checkout
uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v3
with:
node-version-file: "package.json"

- name: setup pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
run_install: false

- name: restore pnpm dependencies
uses: actions/cache/restore@v3
with:
path: ${{ needs.install.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-dependencies-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-dependencies-

- name: install
run: pnpm install --frozen-lockfile

- name: lint
run: pnpm turbo run lint -- --max-warnings=0

style-lint:
runs-on: ubuntu-latest
needs: install
steps:
- name: checkout
uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v3
with:
node-version-file: "package.json"

- name: setup pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
run_install: false

- name: restore pnpm dependencies
uses: actions/cache/restore@v3
with:
path: ${{ needs.install.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-dependencies-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-dependencies-

- name: install dependencies
run: pnpm install --frozen-lockfile

- name: lint styles
run: pnpm turbo run style -- --max-warnings=0

build:
runs-on: ubuntu-latest
needs: install
steps:
- name: checkout
uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v3
with:
node-version-file: "package.json"

- name: setup pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
run_install: false

- name: restore pnpm dependencies
uses: actions/cache/restore@v3
with:
path: ${{ needs.install.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-dependencies-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-dependencies-

- name: install dependencies
run: pnpm install --frozen-lockfile

- name: build
run: pnpm turbo run build

test:
runs-on: ubuntu-latest
env:
Expand All @@ -194,7 +36,7 @@ jobs:
SUPABASE_AUTH_EXTERNAL_GOOGLE_SECRET: ${{ secrets.SUPABASE_AUTH_EXTERNAL_GOOGLE_SECRET }}
SUPABASE_AUTH_EXTERNAL_GOOGLE_URL: ${{ secrets.SUPABASE_AUTH_EXTERNAL_GOOGLE_URL }}
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }}
needs: [install, build]
needs: filter
steps:
- name: checkout
uses: actions/checkout@v4
Expand All @@ -215,10 +57,14 @@ jobs:
with:
run_install: false

- name: restore pnpm dependencies
uses: actions/cache/restore@v3
- name: setup pnpm environment variable
id: pnpm-env
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- name: cache pnpm dependencies
uses: actions/cache@v3
with:
path: ${{ needs.install.outputs.STORE_PATH }}
path: ${{ steps.pnpm-env.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-dependencies-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-dependencies-

Expand All @@ -233,7 +79,7 @@ jobs:

app-test-check:
runs-on: ubuntu-latest
needs: [format, lint, style-lint, build, test]
needs: test
if: ${{ ! failure() }}
steps:
- name: check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/catalog-deploy-chromatic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
workingDir: apps/catalog/
buildScriptName: sb:build

app-test-check:
catalog-deploy-chromatic-check:
runs-on: ubuntu-latest
needs: deploy-chromatic
if: ${{ ! failure() }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: db commit migration
name: db push migration

on: push
on:
push:
branches:
- main

env:
DATABASE_URL: postgresql://postgres:postgres@localhost:54322/postgres
Expand Down Expand Up @@ -31,13 +34,12 @@ jobs:
token: ${{ github.token }}
filters: .github/filter.yaml

commit:
push:
runs-on: ubuntu-latest
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID: ${{ secrets.SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID }}
SUPABASE_AUTH_EXTERNAL_GOOGLE_SECRET: ${{ secrets.SUPABASE_AUTH_EXTERNAL_GOOGLE_SECRET }}
SUPABASE_AUTH_EXTERNAL_GOOGLE_URL: ${{ secrets.SUPABASE_AUTH_EXTERNAL_GOOGLE_URL }}
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }}
needs: filter
if: needs.filter.outputs.db == 'true'
Expand Down Expand Up @@ -82,38 +84,18 @@ jobs:
- name: authenticate to supabase
run: pnpm supabase link --project-ref ${{ secrets.SUPABASE_REFERENCE_ID }}

- name: update migration file
run: echo y | (pnpm supabase db pull --schema public && pnpm supabase migration squash)
continue-on-error: true

- name: commit migration file update
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
if git diff --name-only --diff-filter=D | grep -q "supabase/migrations/.*_remote_schema.sql"; then \
git add $(git diff --name-only --diff-filter=D); \
OLD_VERSION=$(git diff --name-only --diff-filter=D --staged | grep "supabase/migrations/.*_remote_schema.sql" | cut -d/ -f3 | cut -d_ -f1); \
git add supabase/migrations/*_remote_schema.sql -N; \
NEW_VERSION=$(git diff --name-only --diff-filter=A | grep "supabase/migrations/.*_remote_schema.sql" | cut -d/ -f3 | cut -d_ -f1); \
pnpm supabase migration repair ${OLD_VERSION} --status reverted; \
pnpm supabase migration repair ${NEW_VERSION} --status reverted; \
pnpm supabase migration repair ${NEW_VERSION} --status applied; \
git add supabase/migrations/*_remote_schema.sql; \
git commit -m "actions: 🤖 (supabase) updated migration file"; \
git push origin HEAD:${GITHUB_REF} --force; \
echo "Committed changes to migration history"; \
elif ls "./supabase/migrations" | grep ".*_remote_schema.sql"; then \
git add supabase/migrations/*_remote_schema.sql; \
git commit -m "actions: 🤖 (supabase) created migration file"; \
git push origin HEAD:${GITHUB_REF} --force; \
echo "Committed changes to migration history"; \
else \
echo "No changes detected in migration history"; \
fi
db-commit-migration-check:
- name: start local supabase
run: pnpm supabase start

- name: lint local db
run: pnpm supabase db lint

- name: deploy migration file to remote db
run: pnpm supabase db push

db-push-migration-check:
runs-on: ubuntu-latest
needs: commit
needs: push
if: ${{ ! failure() }}
steps:
- name: check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/graphql-deploy-apollo-studio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
- name: publish graphs
run: pnpm api apollo:rover

app-test-check:
graphql-deploy-apollo-check:
runs-on: ubuntu-latest
needs: deploy-apollo-studio
if: ${{ ! failure() }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/script/graphql-commit-schema.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
if [ "$1" = 1 ]; then
pnpm api dev
elif [ "$1" = 2 ]; then
sleep 15 && pnpm --filter='@shio/website' gql:introspect
sleep 15 && pnpm --filter='@lockerai/website' gql:introspect
fi
16 changes: 13 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"eslint.workingDirectories": [
"apps/api/",
"apps/catalog/",
"apps/locker-dashboard/",
"apps/website/",
"packages/core/",
"packages/design-token/",
Expand All @@ -174,9 +175,18 @@
"files.encoding": "utf8",
"files.eol": "\n",
"jest.jestCommandLine": "pnpm all -- test",
"tailwindCSS.classAttributes": ["class", "className"],
"Prettier-SQL.SQLFlavourOverride": "postgresql",
"Prettier-SQL.keywordCase": "upper",
"tailwindCSS.classAttributes": ["class", "className", "classNames"],
"tailwindCSS.experimental.classRegex": [
["tv\\(([^)]*)\\)", "[\"']([^\"']*).*?[\"']"],
["className:.*cn\\(([^)]*)\\)", "[\"']([^\"']*).*?[\"']"]
]
["className:.*cn\\(([^)]*)\\)", "[\"']([^\"']*).*?[\"']"],
["classNames:.*cn\\(([^)]*)\\)", "[\"']([^\"']*).*?[\"']"]
],
"[prisma]": {
"editor.defaultFormatter": "Prisma.prisma"
},
"[sql]": {
"editor.defaultFormatter": "inferrinizzard.prettier-sql-vscode"
}
}
1 change: 1 addition & 0 deletions apps/api/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ coverage/
dist/
generated/
node_modules/
src/infra/drizzle/migrations/meta/
34 changes: 0 additions & 34 deletions apps/api/drizzle.config.ts

This file was deleted.

Loading

0 comments on commit 5f95be7

Please sign in to comment.