From 71e0546e65d39f01874f8c015762a67f2c1b7931 Mon Sep 17 00:00:00 2001 From: Ayush Tiwari <ayushtiwari110@yahoo.com> Date: Mon, 4 Mar 2024 01:15:40 +0530 Subject: [PATCH 1/8] feature/ci-workflow: add ci workflow --- .github/workflows/code-checker.yml | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/code-checker.yml diff --git a/.github/workflows/code-checker.yml b/.github/workflows/code-checker.yml new file mode 100644 index 000000000..00b9df131 --- /dev/null +++ b/.github/workflows/code-checker.yml @@ -0,0 +1,45 @@ +name: Code Checker +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + linting_and_type-checking: + name: Linting, Formatting and Type checking + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install dependencies + run: yarn + + - name: Linting and Formatting checks + run: yarn run lint + + - name: Type checking + run: yarn run typecheck + + build: + name: Build check + runs-on: ubuntu-latest + needs: linting_and_type-checking + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install dependencies + run: yarn + + - name: Build + run: yarn run build \ No newline at end of file From a35fa321b1d9efe2a4c722e979d660f24c2e0f52 Mon Sep 17 00:00:00 2001 From: Ayush Tiwari <ayushtiwari110@yahoo.com> Date: Mon, 4 Mar 2024 01:34:17 +0530 Subject: [PATCH 2/8] feature/ci-workflow: checkout submodule in build job --- .github/workflows/code-checker.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/code-checker.yml b/.github/workflows/code-checker.yml index 00b9df131..4aa6c8e1e 100644 --- a/.github/workflows/code-checker.yml +++ b/.github/workflows/code-checker.yml @@ -32,6 +32,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + with: + submodules: recursive - name: Setup Node.js uses: actions/setup-node@v4 From 31efc07b03558a2d65f6f7351c0210851975f0b8 Mon Sep 17 00:00:00 2001 From: Ayush Tiwari <ayushtiwari110@yahoo.com> Date: Mon, 4 Mar 2024 14:09:58 +0530 Subject: [PATCH 3/8] feature/ci-workflow: add caching, fixes --- .../{code-checker.yml => PR-workflow.yml} | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) rename .github/workflows/{code-checker.yml => PR-workflow.yml} (72%) diff --git a/.github/workflows/code-checker.yml b/.github/workflows/PR-workflow.yml similarity index 72% rename from .github/workflows/code-checker.yml rename to .github/workflows/PR-workflow.yml index 4aa6c8e1e..045f6a39d 100644 --- a/.github/workflows/code-checker.yml +++ b/.github/workflows/PR-workflow.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 @@ -17,7 +17,13 @@ jobs: node-version: 20 - name: Install dependencies - run: yarn + run: yarn install --frozen-lockfile + + - name: Cache Node dependencies + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - name: Linting and Formatting checks run: yarn run lint @@ -31,7 +37,7 @@ jobs: needs: linting_and_type-checking steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: recursive @@ -41,7 +47,7 @@ jobs: node-version: 20 - name: Install dependencies - run: yarn + run: yarn install --frozen-lockfile - name: Build run: yarn run build \ No newline at end of file From 2ebc36df3a97d08cf091312c6d764e981cbdd44b Mon Sep 17 00:00:00 2001 From: Ayush Tiwari <ayushtiwari110@yahoo.com> Date: Mon, 4 Mar 2024 14:18:14 +0530 Subject: [PATCH 4/8] feature/ci-workflow: add caching, fixes --- .github/workflows/PR-workflow.yml | 33 ++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/.github/workflows/PR-workflow.yml b/.github/workflows/PR-workflow.yml index 045f6a39d..806086066 100644 --- a/.github/workflows/PR-workflow.yml +++ b/.github/workflows/PR-workflow.yml @@ -10,6 +10,20 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + + - name: Cache Node dependencies + id: cache-npm + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: npm list - name: Setup Node.js uses: actions/setup-node@v4 @@ -19,11 +33,6 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile - - name: Cache Node dependencies - uses: actions/cache@v3 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - name: Linting and Formatting checks run: yarn run lint @@ -41,6 +50,20 @@ jobs: with: submodules: recursive + - name: Cache Node dependencies + id: cache-npm + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: npm list + - name: Setup Node.js uses: actions/setup-node@v4 with: From 847debb187603c71d6872588ffd5250ec59b0b52 Mon Sep 17 00:00:00 2001 From: Ayush Tiwari <ayushtiwari110@yahoo.com> Date: Mon, 4 Mar 2024 18:37:08 +0530 Subject: [PATCH 5/8] feature/ci-workflow: change workflow name --- .github/workflows/PR-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/PR-workflow.yml b/.github/workflows/PR-workflow.yml index 806086066..a60ab2539 100644 --- a/.github/workflows/PR-workflow.yml +++ b/.github/workflows/PR-workflow.yml @@ -1,4 +1,4 @@ -name: Code Checker +name: PR Workflow on: pull_request: types: [opened, reopened, synchronize] From dae2efebf64c75fd481321a9e8db11ff0fb99aa0 Mon Sep 17 00:00:00 2001 From: Ayush Tiwari <ayushtiwari110@yahoo.com> Date: Mon, 4 Mar 2024 19:57:41 +0530 Subject: [PATCH 6/8] feature/ci-workflow: change file name as per conventions --- .github/workflows/{PR-workflow.yml => pull-request.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{PR-workflow.yml => pull-request.yml} (100%) diff --git a/.github/workflows/PR-workflow.yml b/.github/workflows/pull-request.yml similarity index 100% rename from .github/workflows/PR-workflow.yml rename to .github/workflows/pull-request.yml From 73e7830a8973113ea7c7cc13cd2094d09d0c1570 Mon Sep 17 00:00:00 2001 From: Ayush Tiwari <ayushtiwari110@yahoo.com> Date: Mon, 4 Mar 2024 20:31:58 +0530 Subject: [PATCH 7/8] feature/ci-workflow: add next build cache, fixes --- .github/workflows/pull-request.yml | 42 +++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index a60ab2539..43f99d2d4 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -11,19 +11,23 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT + - name: Cache Node dependencies - id: cache-npm uses: actions/cache@v3 + id: yarn-cache with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | - ${{ runner.os }}-node- + ${{ runner.os }}-yarn- - - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + - if: ${{ steps.yarn-cache.outputs.cache-hit != 'true' }} name: List the state of node modules continue-on-error: true - run: npm list + run: yarn list - name: Setup Node.js uses: actions/setup-node@v4 @@ -49,20 +53,34 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Cache Node dependencies - id: cache-npm uses: actions/cache@v3 + id: yarn-cache with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | - ${{ runner.os }}-node- + ${{ runner.os }}-yarn- - - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + - if: ${{ steps.yarn-cache.outputs.cache-hit != 'true' }} name: List the state of node modules continue-on-error: true - run: npm list + run: yarn list + + - name: Cache Next Build + uses: actions/cache@v4 + with: + path: | + ${{ steps.yarn-cache-dir-path.outputs.dir }} + ${{ github.workspace }}/.next/cache + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }} + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}- - name: Setup Node.js uses: actions/setup-node@v4 From 50d01fecb2aa5b3d055e884e3a521275ba6ec98e Mon Sep 17 00:00:00 2001 From: Ayush Tiwari <ayushtiwari110@yahoo.com> Date: Tue, 5 Mar 2024 02:39:24 +0530 Subject: [PATCH 8/8] feature/ci-workflow: update actions/cache to v4 --- .github/workflows/pull-request.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 43f99d2d4..8ea622924 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -16,7 +16,7 @@ jobs: run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Cache Node dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 id: yarn-cache with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -59,7 +59,7 @@ jobs: run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Cache Node dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 id: yarn-cache with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }}