From 7e1e324b979433d0d1bbb4d1475d10bed7d56bae 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 | 47 ++++++++++++++++++---------------------- .gitmodules | 3 +++ backend | 1 + codegen.ts | 2 +- 4 files changed, 26 insertions(+), 27 deletions(-) create mode 100644 .gitmodules create mode 160000 backend diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54092b3e..a3408359 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,26 +9,13 @@ 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 + environment: 'CI' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -38,27 +25,31 @@ jobs: cache: 'yarn' - name: Install dependencies - run: yarn install + run: yarn install --frozen-lockfile - name: Run unimported run: yarn unimported lint-js: name: Lint JS + environment: 'CI' 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: 'CI' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -68,28 +59,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: 'CI' 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: 'CI' + needs: [lint-js, css-lint, typecheck] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -99,7 +94,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/backend b/backend new file mode 160000 index 00000000..2ff1195e --- /dev/null +++ b/backend @@ -0,0 +1 @@ +Subproject commit 2ff1195eacef96c2361a909c69a81b6c84630e93 diff --git a/codegen.ts b/codegen.ts index f37f4ac2..c1c96c46 100644 --- a/codegen.ts +++ b/codegen.ts @@ -1,7 +1,7 @@ import { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { - schema: process.env.APP_GRAPHQL_CODEGEN_ENDPOINT, + schema: './backend/schema.graphql', documents: [ 'src/**/*.tsx', 'src/**/*.ts'