From 66dca6959bbbf0c0ae7736b941891b9699ef4ab1 Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sun, 23 Jun 2024 01:14:12 +0200 Subject: [PATCH 1/5] build(database): target the pr branch when applying migrations --- .github/workflows/build.yml | 19 +++++++++++++++++++ .github/workflows/migration-db-deploy.yml | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a836f893..5d51c033 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,7 +54,26 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Check if frontend files changed + id: frontend-changed + uses: tj-actions/changed-files@v44 + with: + files_yaml: | + apps: + - apps/web/** + packages: + - packages/front/** + + - name: Run step if any file(s) in the docs folder change + if: steps.frontend-changed.outputs.any_changed == 'true' + env: + ALL_CHANGED_FILES: ${{ steps.frontend-changed.outputs.all_changed_files }} + run: | + echo "One or more files in the docs folder has changed." + echo "List all the files that have changed: $ALL_CHANGED_FILES" + - name: Install Yarn 4 + if: steps.frontend-changed.outputs.any_changed == 'true' run: | corepack enable yarn set version 4.2.2 diff --git a/.github/workflows/migration-db-deploy.yml b/.github/workflows/migration-db-deploy.yml index eb310bed..65c9c22e 100644 --- a/.github/workflows/migration-db-deploy.yml +++ b/.github/workflows/migration-db-deploy.yml @@ -20,7 +20,7 @@ jobs: uses: planetscale/setup-pscale-action@v1 - name: Set database branch name - run: echo "PSCALE_BRANCH_NAME=$(echo ${{ github.head_ref }} | tr -cd '[:alnum:]-'| tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + run: echo "PSCALE_BRANCH_NAME=$(echo ${{ github.ref_name }} | tr -cd '[:alnum:]-'| tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV - name: Get the deploy request number in development branch run: | From 0f86e3717a96d47ee313161059f96bf9e35fe1d5 Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sun, 23 Jun 2024 01:30:30 +0200 Subject: [PATCH 2/5] fix: ci --- .github/workflows/build.yml | 12 ++++-------- .../migration.sql | 2 -- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5d51c033..fed4f7a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,14 +64,6 @@ jobs: packages: - packages/front/** - - name: Run step if any file(s) in the docs folder change - if: steps.frontend-changed.outputs.any_changed == 'true' - env: - ALL_CHANGED_FILES: ${{ steps.frontend-changed.outputs.all_changed_files }} - run: | - echo "One or more files in the docs folder has changed." - echo "List all the files that have changed: $ALL_CHANGED_FILES" - - name: Install Yarn 4 if: steps.frontend-changed.outputs.any_changed == 'true' run: | @@ -79,15 +71,19 @@ jobs: yarn set version 4.2.2 - name: Install Vercel CLI + if: ${{ success() }} run: npm install --global vercel@latest - name: Pull Vercel Environment Information + if: ${{ success() }} run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} - name: Build Project Artifacts + if: ${{ success() }} env: APP_VERSION: run: vercel build --token=${{ secrets.VERCEL_TOKEN }} - name: Deploy Project Artifacts to Vercel + if: ${{ success() }} run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} diff --git a/packages/domain/prisma/migrations/20240622222249_remove_is_favorite_in_folders_table/migration.sql b/packages/domain/prisma/migrations/20240622222249_remove_is_favorite_in_folders_table/migration.sql index 24b48a05..3b90ebdf 100644 --- a/packages/domain/prisma/migrations/20240622222249_remove_is_favorite_in_folders_table/migration.sql +++ b/packages/domain/prisma/migrations/20240622222249_remove_is_favorite_in_folders_table/migration.sql @@ -1,8 +1,6 @@ /* Warnings: - - You are about to drop the column `is_favorite` on the `folders` table. All the data in the column will be lost. - */ -- DropIndex DROP INDEX `folders_is_favorite_idx` ON `folders`; From a6a6bfb5fa59ee91a235ef3cd462b35bfc69be6b Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sun, 23 Jun 2024 01:37:45 +0200 Subject: [PATCH 3/5] fix: ci --- .github/workflows/build.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fed4f7a2..899b4dcc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,11 +46,11 @@ jobs: yarn prisma migrate dev --schema=packages/domain/prisma/schema.prisma yarn test -- --runInBand --coverage - preview-frontend: + should-preview-frontend: runs-on: ubuntu-latest environment: 'Preview' - needs: - - build +# needs: +# - build steps: - uses: actions/checkout@v4 @@ -64,8 +64,16 @@ jobs: packages: - packages/front/** + preview-frontend: + runs-on: ubuntu-latest + environment: 'Preview' + needs: + - should-preview-frontend + if: ${{ needs.should-preview-frontend.steps.frontend-changed.outputs.any_changed == 'true' }} + steps: + - uses: actions/checkout@v4 + - name: Install Yarn 4 - if: steps.frontend-changed.outputs.any_changed == 'true' run: | corepack enable yarn set version 4.2.2 From 5bee87a95cf0fea744450ceb4b941459e1100934 Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sun, 23 Jun 2024 01:41:50 +0200 Subject: [PATCH 4/5] fix: ci --- packages/front/{.eslintrc.json => .eslintrc.js} | 10 ++++++---- packages/front/services/index.ts | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) rename packages/front/{.eslintrc.json => .eslintrc.js} (64%) diff --git a/packages/front/.eslintrc.json b/packages/front/.eslintrc.js similarity index 64% rename from packages/front/.eslintrc.json rename to packages/front/.eslintrc.js index 40b7f34b..ae010f6f 100644 --- a/packages/front/.eslintrc.json +++ b/packages/front/.eslintrc.js @@ -1,15 +1,17 @@ -{ +module.exports = { "root": true, "extends": "../../.eslintrc.json", "ignorePatterns": [ "postcss.config.js", "tailwind.config.js", "jest.config.ts", - "generated.ts" + "generated.ts", + '.eslintrc.js' ], "parserOptions": { "ecmaVersion": 2023, "sourceType": "module", - "project": "tsconfig.json" + "project": "tsconfig.json", + tsconfigRootDir: __dirname, } -} +}; diff --git a/packages/front/services/index.ts b/packages/front/services/index.ts index 6641d5b4..fc362082 100644 --- a/packages/front/services/index.ts +++ b/packages/front/services/index.ts @@ -8,6 +8,8 @@ import { useLoginUser } from './users/login-user'; import { useLogoutUser } from './users/logout-user'; import { useSignupUser } from './users/signup-user'; +console.log('test'); + export { formatPublicSnippetsResult, useAuthenticatedUser, From 22f7752ffa77d0359fa3bdb19067bf55b645afe0 Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sun, 23 Jun 2024 01:51:31 +0200 Subject: [PATCH 5/5] fix: ci --- .github/workflows/build.yml | 19 ++++++++++++++----- packages/front/services/index.ts | 2 -- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 899b4dcc..76a6d1fe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,8 +24,6 @@ jobs: DATABASE_URL: mysql://root:root@127.0.0.1:3306/test CONVERTKIT_API_KEY: api_key CONVERTKIT_FORM_ID: form_id - outputs: - releasedPackages: ${{ steps.releasedPackages.outputs.versions }} steps: - uses: actions/checkout@v4 @@ -46,11 +44,14 @@ jobs: yarn prisma migrate dev --schema=packages/domain/prisma/schema.prisma yarn test -- --runInBand --coverage + should-preview-frontend: runs-on: ubuntu-latest environment: 'Preview' -# needs: -# - build + needs: + - build + outputs: + frontendChanged: ${{ steps.frontend-changed.outputs.any_changed }} steps: - uses: actions/checkout@v4 @@ -64,12 +65,20 @@ jobs: packages: - packages/front/** + - name: Run step if test file(s) change + env: + ALL_CHANGED_FILES: ${{ steps.frontend-changed.outputs.all_changed_files }} + run: | + echo "Change state: ${{ steps.frontend-changed.outputs.any_changed }}" + echo "One or more test file(s) has changed." + echo "List all the files that have changed: $ALL_CHANGED_FILES" + preview-frontend: runs-on: ubuntu-latest environment: 'Preview' needs: - should-preview-frontend - if: ${{ needs.should-preview-frontend.steps.frontend-changed.outputs.any_changed == 'true' }} + if: ${{ needs.should-preview-frontend.frontendChanged == 'true' }} steps: - uses: actions/checkout@v4 diff --git a/packages/front/services/index.ts b/packages/front/services/index.ts index fc362082..6641d5b4 100644 --- a/packages/front/services/index.ts +++ b/packages/front/services/index.ts @@ -8,8 +8,6 @@ import { useLoginUser } from './users/login-user'; import { useLogoutUser } from './users/logout-user'; import { useSignupUser } from './users/signup-user'; -console.log('test'); - export { formatPublicSnippetsResult, useAuthenticatedUser,