From 260fb0846bb28d0358fade69d24247fc4c98cfc7 Mon Sep 17 00:00:00 2001 From: samshara Date: Thu, 11 Apr 2024 13:51:25 +0545 Subject: [PATCH] feat: integrate backend using git submodules to fix CI lint workflows --- .github/workflows/ci.yml | 74 +++++++++++++------------- .gitmodules | 3 ++ .unimportedrc.json | 8 ++- backend | 1 + src/hooks/domain/useCurrentLanguage.ts | 10 ---- 5 files changed, 46 insertions(+), 50 deletions(-) create mode 100644 .gitmodules create mode 160000 backend delete mode 100644 src/hooks/domain/useCurrentLanguage.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54092b3e..61960066 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Lint, Build and Test +name: Lint & Build on: pull_request: @@ -9,56 +9,50 @@ on: env: APP_TITLE: ${{ vars.APP_TITLE }} APP_MAPBOX_ACCESS_TOKEN: ${{ vars.APP_MAPBOX_ACCESS_TOKEN }} + APP_GRAPHQL_CODEGEN_ENDPOINT: ${{ vars.APP_GRAPHQL_CODEGEN_ENDPOINT }} GITHUB_WORKFLOW: true jobs: - test: - name: Run tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'yarn' - - - name: Install dependencies - run: yarn install - - - name: Run test - run: yarn test - unimported: - name: Find unimported files - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'yarn' + # unimported: + # name: Find unimported files + # environment: 'test' + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + # with: + # submodules: true + # - uses: actions/setup-node@v4 + # with: + # node-version: 20 + # cache: 'yarn' - - name: Install dependencies - run: yarn install + # - name: Install dependencies + # run: yarn install --frozen-lockfile - - name: Run unimported - run: yarn unimported + # - name: Run unimported + # run: yarn unimported + # fix use better tool, this is deprecated lint-js: name: Lint JS + environment: 'test' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + submodules: true - uses: actions/setup-node@v4 with: node-version: 20 cache: 'yarn' - name: Install dependencies - run: yarn install + run: yarn install --frozen-lockfile - - name: Lint - run: yarn lint:js + - name: Lint Javascript + run: yarn generate && yarn lint:js css-lint: name: Lint CSS + environment: 'test' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -68,28 +62,32 @@ jobs: cache: 'yarn' - name: Install dependencies - run: yarn install + run: yarn install --frozen-lockfile - name: Css Lint run: yarn lint:css typecheck: name: Typecheck + environment: 'test' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + submodules: true - uses: actions/setup-node@v4 with: node-version: 20 cache: 'yarn' - name: Install dependencies - run: yarn install + run: yarn install --frozen-lockfile - name: Typecheck - run: yarn typecheck + run: yarn generate && yarn typecheck build: name: Build - needs: [lint-js, css-lint, typecheck, test] + environment: 'test' + needs: [lint-js, css-lint, typecheck] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -99,7 +97,7 @@ jobs: cache: 'yarn' - name: Install dependencies - run: yarn install + run: yarn install --frozen-lockfile - name: Build - run: yarn build + run: yarn generate && yarn build diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..d65725b9 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "backend"] + path = backend + url = git@github.com:IFRCGo/alert-hub-backend.git diff --git a/.unimportedrc.json b/.unimportedrc.json index 2baf1ef6..6a496219 100644 --- a/.unimportedrc.json +++ b/.unimportedrc.json @@ -1,7 +1,7 @@ { "entry": ["./src/index.tsx"], "ignorePatterns": ["**/node_modules/**", "build/**"], - "ignoreUnimported": ["**/*.d.ts", "**/*.test.*"], + "ignoreUnimported": ["**/*.d.ts", "**/*.test.*", "**/generated/**"], "ignoreUnused": [ "@apollo/client", "@graphql-codegen/introspection", @@ -9,9 +9,13 @@ "@togglecorp/re-map", "@sentry/react" ], + "ignoreUnresolved": ["@graphql-typed-document-node/core"], "extensions": [".ts", ".js", ".tsx", ".jsx"], "aliases": { "#utils/*": ["./src/utils/*"], - "#views/*": ["./src/views/*"] + "#views/*": ["./src/views/*"], + "#generated/*": ["./generated/*"], + "#components/*": ["./src/components/*"], + "#hooks/*": ["./src/hooks/*"] } } diff --git a/backend b/backend new file mode 160000 index 00000000..8f8391b0 --- /dev/null +++ b/backend @@ -0,0 +1 @@ +Subproject commit 8f8391b0d6b02e37c34fe079441da12033981220 diff --git a/src/hooks/domain/useCurrentLanguage.ts b/src/hooks/domain/useCurrentLanguage.ts deleted file mode 100644 index 7aca9307..00000000 --- a/src/hooks/domain/useCurrentLanguage.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { useContext } from 'react'; -import { LanguageContext } from '@ifrc-go/ui/contexts'; - -function useCurrentLanguage() { - const { currentLanguage } = useContext(LanguageContext); - - return currentLanguage; -} - -export default useCurrentLanguage;