Repository: CruGlobal/know-god-web
Pull request #224: Making Github CI tests separate so it's easier to see what test failed.
Author: login: dr-bizz
Labels: name: On Staging
description: Will be merged to the staging branch by Github Actions
Created: 2025-03-14T21:20:05Z | Merged: 2025-03-17T13:13:33Z

## Description
In this PR, I've separated the tests into their own tests to make it easier when viewing a PR which test failed.

I've also made this change to the Give site this week, and this change would mean both repo's CI tests look alike.

Once this is approved, I'll update the branch requirements.


Diff:
diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
index 516b1b19c..623823706 100644
--- a/.github/workflows/node.js.yml
+++ b/.github/workflows/node.js.yml
@@ -1,4 +1,4 @@
-name: Build & Deploy
+name: CI
 
 on:
   push:
@@ -17,10 +17,9 @@ concurrency:
   cancel-in-progress: true
 
 jobs:
-  build:
-    name: Checks, Tests & Build
+  lint-and-prettier:
+    name: 🧹 Lint & Prettier Check
     runs-on: ubuntu-latest
-
     steps:
       - name: Repository checkout
         uses: actions/checkout@v4
@@ -31,7 +30,7 @@ jobs:
           node-version-file: .tool-versions
 
       - name: 📦 Install dependencies
-        run: yarn install
+        run: yarn install --immutable --immutable-cache
 
       - name: 💅 Prettier check
         run: yarn prettier:check
@@ -39,19 +38,50 @@ jobs:
       - name: 💨 Lint check
         run: yarn lint
 
+  test:
+    name: ✅ Tests
+    runs-on: ubuntu-latest
+    steps:
+      - name: Repository checkout
+        uses: actions/checkout@v4
+
+      - name: Node.js setup
+        uses: actions/setup-node@v4
+        with:
+          node-version-file: .tool-versions
+
+      - name: 📦 Install dependencies
+        run: yarn install --immutable --immutable-cache
+
       - name: ✅ Run Tests
         run: yarn test --no-watch
 
+  build:
+    name: 🏗️ Build app
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Repository checkout
+        uses: actions/checkout@v4
+
+      - name: Node.js setup
+        uses: actions/setup-node@v4
+        with:
+          node-version-file: .tool-versions
+
+      - name: 📦 Install dependencies
+        run: yarn install --immutable --immutable-cache
+
       - name: 🏗️ Build app
         run: yarn build
 
   deploy:
-    name: Deploy
+    name: 🚀 Deploy app
     if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/development')
     runs-on: ubuntu-latest
     environment:
       name: ${{ (github.ref == 'refs/heads/main' && 'prod') || (github.ref == 'refs/heads/staging' && 'stage') || 'dev' }}
-    needs: build
+    needs: [lint-and-prettier, test, build]
     permissions:
       id-token: write
       contents: read
diff --git a/.github/workflows/update-staging.yml b/.github/workflows/update-staging.yml
index 0d6233d37..0cc244c22 100644
--- a/.github/workflows/update-staging.yml
+++ b/.github/workflows/update-staging.yml
@@ -1,4 +1,4 @@
-name: Update staging and development
+name: Pipeline
 on:
   push:
     branches:
@@ -8,6 +8,7 @@ on:
 
 jobs:
   update-staging:
+    name: 🌱 Merge to Staging
     runs-on: ubuntu-latest
     if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'On Staging')
     steps:
@@ -18,8 +19,9 @@ jobs:
           type: now
           target_branch: 'staging'
           github_token: ${{ github.token }}
-  
+
   update-development:
+    name: 🛠 Merge to Development
     runs-on: ubuntu-latest
     if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'On Staging') || contains(github.event.pull_request.labels.*.name, 'On Development')
     steps:


Reviews:
user: login: frett
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-14T22:08:20Z
user: login: dr-bizz
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-15T00:00:51Z
user: login: frett
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-17T12:48:13Z

Review comments:
diff_hunk: @@ -31,22 +30,53 @@ jobs:
           node-version-file: .tool-versions
 
       - name: 📦 Install dependencies
-        run: yarn install
+        run: yarn install --immutable --immutable-cache
 
       - name: 💅 Prettier check
         run: yarn prettier:check
 
       - name: 💨 Lint check
         run: yarn lint
 
+  test:
+    name: ✅ Tests
+    runs-on: ubuntu-latest
+    steps:
+      - name: Repository checkout
+        uses: actions/checkout@v4
+
+      - name: Node.js setup
+        uses: actions/setup-node@v4
+        with:
+          node-version-file: .tool-versions
+
+      - name: 📦 Install dependencies
+        run: yarn install --immutable --immutable-cache
+
       - name: ✅ Run Tests
         run: yarn test --no-watch
 
+  build:
+    name: 🏗️ Build app
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Repository checkout
+        uses: actions/checkout@v4
+
+      - name: Node.js setup
+        uses: actions/setup-node@v4
+        with:
+          node-version-file: .tool-versions
+
+      - name: 📦 Install dependencies
+        run: yarn install --immutable --immutable-cache
+
       - name: 🏗️ Build app
         run: yarn build
 
   deploy:
-    name: Deploy
+    name: 🚀 Deploy app
path: .github/workflows/node.js.yml
user: login: frett
body: do we want to make Deploy dependent on all the other jobs, or just on `build`?
created_at: 2025-03-14T22:08:20Z
author_association: CONTRIBUTOR
diff_hunk: @@ -31,22 +30,53 @@ jobs:
           node-version-file: .tool-versions
 
       - name: 📦 Install dependencies
-        run: yarn install
+        run: yarn install --immutable --immutable-cache
 
       - name: 💅 Prettier check
         run: yarn prettier:check
 
       - name: 💨 Lint check
         run: yarn lint
 
+  test:
+    name: ✅ Tests
+    runs-on: ubuntu-latest
+    steps:
+      - name: Repository checkout
+        uses: actions/checkout@v4
+
+      - name: Node.js setup
+        uses: actions/setup-node@v4
+        with:
+          node-version-file: .tool-versions
+
+      - name: 📦 Install dependencies
+        run: yarn install --immutable --immutable-cache
+
       - name: ✅ Run Tests
         run: yarn test --no-watch
 
+  build:
+    name: 🏗️ Build app
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Repository checkout
+        uses: actions/checkout@v4
+
+      - name: Node.js setup
+        uses: actions/setup-node@v4
+        with:
+          node-version-file: .tool-versions
+
+      - name: 📦 Install dependencies
+        run: yarn install --immutable --immutable-cache
+
       - name: 🏗️ Build app
         run: yarn build
 
   deploy:
-    name: Deploy
+    name: 🚀 Deploy app
path: .github/workflows/node.js.yml
user: login: dr-bizz
body: Good call
created_at: 2025-03-15T00:00:51Z
author_association: CONTRIBUTOR

PR comments:
user: login: dr-bizz
created_at: 2025-03-14T21:22:14Z
body: Idea -> Maybe the next PR should be to add StyleLint to God Tools
author_association: CONTRIBUTOR
user: login: stage-branch-merger[bot]
created_at: 2025-03-17T13:13:06Z
body: I see you added the "On Staging" label, I'll get this merged to the staging branch!
author_association: CONTRIBUTOR