From 4ed3f6a175cb7347182dc58df900fc186030faa5 Mon Sep 17 00:00:00 2001 From: "Alec M." Date: Thu, 6 Aug 2026 09:55:53 -0400 Subject: [PATCH 01/10] feat: Add filtering for unchanged apps in unit tests --- .github/workflows/unit-test.yml | 70 +++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 2f330cd15..3022bb158 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -33,24 +33,28 @@ jobs: test-command: npm run test prisma: false node-version: "24" + filter-regex: "apps/authn|lib/db-driver" - name: backend context: apps/backend test-command: npm run test:ci prisma: true node-version: "24" + filter-regex: "apps/backend|lib/db-driver" - name: frontend context: apps/frontend test-command: npm run test:ci prisma: false node-version: "22" + filter-regex: "apps/frontend" - name: chatbot-backend context: apps/chatbot-backend test-command: npm run test prisma: false node-version: "24" + filter-regex: "apps/chatbot-backend" steps: - name: Checkout Code Repository @@ -61,12 +65,38 @@ jobs: clean: true fetch-depth: 0 + - name: Detect relevant changes + id: filter + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "changed=true" >> $GITHUB_OUTPUT + exit 0 + fi + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + BASE="${{ github.event.pull_request.base.sha }}" + HEAD="${{ github.event.pull_request.head.sha }}" + else + BASE="${{ github.event.before }}" + HEAD="${{ github.sha }}" + if [[ "$BASE" == "0000000000000000000000000000000000000000" ]]; then + echo "changed=true" >> $GITHUB_OUTPUT + exit 0 + fi + fi + if git diff --name-only "$BASE" "$HEAD" | grep -qE "^(${{ matrix.filter-regex }})/"; then + echo "changed=true" >> $GITHUB_OUTPUT + else + echo "changed=false" >> $GITHUB_OUTPUT + fi + - name: Set up Node.js + if: steps.filter.outputs.changed == 'true' uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: Setup Cache + if: steps.filter.outputs.changed == 'true' uses: actions/cache@v4 with: path: ./${{ matrix.context }}/node_modules @@ -74,26 +104,29 @@ jobs: restore-keys: ${{ runner.os }}-${{ matrix.name }}-modules- - name: Copy db-driver subfolders - if: ${{ matrix.name == 'authn' || matrix.name == 'backend' }} + if: ${{ steps.filter.outputs.changed == 'true' && (matrix.name == 'authn' || matrix.name == 'backend') }} run: | cp -rL lib/db-driver/. ${{ matrix.context }}/tmp-crdc-datahub-database-drivers/ rm -rf ${{ matrix.context }}/crdc-datahub-database-drivers mv ${{ matrix.context }}/tmp-crdc-datahub-database-drivers ${{ matrix.context }}/crdc-datahub-database-drivers - name: Install Dependencies + if: steps.filter.outputs.changed == 'true' working-directory: ${{ matrix.context }} run: npm install - name: Setup Prisma - if: ${{ matrix.prisma }} + if: ${{ steps.filter.outputs.changed == 'true' && matrix.prisma }} working-directory: ${{ matrix.context }} run: npx prisma generate - name: Run tests + if: steps.filter.outputs.changed == 'true' working-directory: ${{ matrix.context }} run: ${{ matrix.test-command }} - name: Coveralls GitHub Action + if: steps.filter.outputs.changed == 'true' uses: coverallsapp/github-action@v2 with: flag-name: ${{ matrix.name }} @@ -110,9 +143,11 @@ jobs: include: - name: validators context: apps/validator + filter-regex: "apps/validator|lib/bento-common" - name: cli-uploader context: apps/cli-uploader + filter-regex: "apps/cli-uploader|lib/bento-common" steps: - name: Checkout Code Repository @@ -123,13 +158,39 @@ jobs: clean: true fetch-depth: 0 + - name: Detect relevant changes + id: filter + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "changed=true" >> $GITHUB_OUTPUT + exit 0 + fi + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + BASE="${{ github.event.pull_request.base.sha }}" + HEAD="${{ github.event.pull_request.head.sha }}" + else + BASE="${{ github.event.before }}" + HEAD="${{ github.sha }}" + if [[ "$BASE" == "0000000000000000000000000000000000000000" ]]; then + echo "changed=true" >> $GITHUB_OUTPUT + exit 0 + fi + fi + if git diff --name-only "$BASE" "$HEAD" | grep -qE "^(${{ matrix.filter-regex }})/"; then + echo "changed=true" >> $GITHUB_OUTPUT + else + echo "changed=false" >> $GITHUB_OUTPUT + fi + - name: Set up Python + if: steps.filter.outputs.changed == 'true' uses: actions/setup-python@v5 with: python-version: "3.11" cache: "pip" - name: Install Python dependencies + if: steps.filter.outputs.changed == 'true' working-directory: ${{ matrix.context }} run: | python -m pip install --upgrade pip @@ -137,17 +198,19 @@ jobs: pip install pytest-cov - name: Copy bento-common subfolders - if: ${{ matrix.name == 'validators' || matrix.name == 'cli-uploader' }} + if: ${{ steps.filter.outputs.changed == 'true'}} run: | cp -rL lib/bento-common/. ${{ matrix.context }}/src/tmp-bento/ rm -rf ${{ matrix.context }}/src/bento mv ${{ matrix.context }}/src/tmp-bento ${{ matrix.context }}/src/bento - name: Run unit tests + if: steps.filter.outputs.changed == 'true' working-directory: ${{ matrix.context }} run: pytest --cov=src --cov-report=xml --cov-report=term-missing --ignore=src/bento - name: Coveralls GitHub Action + if: steps.filter.outputs.changed == 'true' uses: coverallsapp/github-action@v2 with: flag-name: ${{ matrix.name }} @@ -164,6 +227,7 @@ jobs: uses: coverallsapp/github-action@v2 with: parallel-finished: true + carryforward: "authn,backend,frontend,chatbot-backend,validators,cli-uploader" continue-on-error: true # ────────────────────────────────────────────── From 33e783f6c32201a0d3c3e7c4ff58a8099de789f4 Mon Sep 17 00:00:00 2001 From: "Alec M." Date: Thu, 6 Aug 2026 10:03:17 -0400 Subject: [PATCH 02/10] feat: Add logic to mark tests as skipped when no changes are detected --- .github/workflows/unit-test.yml | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 3022bb158..02eb3edd4 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -2,6 +2,7 @@ name: Test permissions: contents: read + checks: write on: workflow_dispatch: @@ -134,6 +135,31 @@ jobs: parallel: true continue-on-error: true + - name: Mark Skipped Tests + if: steps.filter.outputs.changed == 'false' + uses: actions/github-script@v7 + with: + script: | + const response = await github.rest.checks.listForRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: context.ref + }); + const checkRun = response.data.check_runs.find(c => c.name.includes('${{ matrix.name }}')); + if (checkRun) { + await github.rest.checks.update({ + owner: context.repo.owner, + repo: context.repo.repo, + check_run_id: checkRun.id, + conclusion: 'skipped', + status: 'completed', + output: { + title: 'Tests skipped', + summary: 'No changes detected in ${{ matrix.context }} or its dependencies.' + } + }); + } + pr-unit-test-python: name: ${{ matrix.name }} runs-on: ubuntu-latest @@ -218,6 +244,31 @@ jobs: parallel: true continue-on-error: true + - name: Mark Skipped Tests + if: steps.filter.outputs.changed == 'false' + uses: actions/github-script@v7 + with: + script: | + const response = await github.rest.checks.listForRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: context.ref + }); + const checkRun = response.data.check_runs.find(c => c.name.includes('${{ matrix.name }}')); + if (checkRun) { + await github.rest.checks.update({ + owner: context.repo.owner, + repo: context.repo.repo, + check_run_id: checkRun.id, + conclusion: 'skipped', + status: 'completed', + output: { + title: 'Tests skipped', + summary: 'No changes detected in ${{ matrix.context }} or its dependencies.' + } + }); + } + upload-coveralls: name: Upload to Coveralls runs-on: ubuntu-latest From 15577b63ce613729465f962c03cdffe279f6077f Mon Sep 17 00:00:00 2001 From: "Alec M." Date: Thu, 6 Aug 2026 10:12:29 -0400 Subject: [PATCH 03/10] Try neutral status instead --- .github/workflows/unit-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 02eb3edd4..9ca228622 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -151,7 +151,7 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, check_run_id: checkRun.id, - conclusion: 'skipped', + conclusion: 'neutral', status: 'completed', output: { title: 'Tests skipped', @@ -260,7 +260,7 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, check_run_id: checkRun.id, - conclusion: 'skipped', + conclusion: 'neutral', status: 'completed', output: { title: 'Tests skipped', From f7320045be2751fc6fccf7c52020bfddb4f4ef45 Mon Sep 17 00:00:00 2001 From: "Alec M." Date: Thu, 6 Aug 2026 10:14:41 -0400 Subject: [PATCH 04/10] Remove useless status override --- .github/workflows/unit-test.yml | 50 --------------------------------- 1 file changed, 50 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 9ca228622..cee58f36c 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -135,31 +135,6 @@ jobs: parallel: true continue-on-error: true - - name: Mark Skipped Tests - if: steps.filter.outputs.changed == 'false' - uses: actions/github-script@v7 - with: - script: | - const response = await github.rest.checks.listForRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: context.ref - }); - const checkRun = response.data.check_runs.find(c => c.name.includes('${{ matrix.name }}')); - if (checkRun) { - await github.rest.checks.update({ - owner: context.repo.owner, - repo: context.repo.repo, - check_run_id: checkRun.id, - conclusion: 'neutral', - status: 'completed', - output: { - title: 'Tests skipped', - summary: 'No changes detected in ${{ matrix.context }} or its dependencies.' - } - }); - } - pr-unit-test-python: name: ${{ matrix.name }} runs-on: ubuntu-latest @@ -244,31 +219,6 @@ jobs: parallel: true continue-on-error: true - - name: Mark Skipped Tests - if: steps.filter.outputs.changed == 'false' - uses: actions/github-script@v7 - with: - script: | - const response = await github.rest.checks.listForRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: context.ref - }); - const checkRun = response.data.check_runs.find(c => c.name.includes('${{ matrix.name }}')); - if (checkRun) { - await github.rest.checks.update({ - owner: context.repo.owner, - repo: context.repo.repo, - check_run_id: checkRun.id, - conclusion: 'neutral', - status: 'completed', - output: { - title: 'Tests skipped', - summary: 'No changes detected in ${{ matrix.context }} or its dependencies.' - } - }); - } - upload-coveralls: name: Upload to Coveralls runs-on: ubuntu-latest From 70855ca510248ed165a1657b142b1a83b4e09f8b Mon Sep 17 00:00:00 2001 From: "Alec M." Date: Thu, 6 Aug 2026 10:17:47 -0400 Subject: [PATCH 05/10] fix: update checkout action to v7 and standardize test step naming --- .github/workflows/unit-test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index cee58f36c..28891da82 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -59,7 +59,7 @@ jobs: steps: - name: Checkout Code Repository - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: ref: ${{ github.event.pull_request.head.sha }} submodules: recursive @@ -152,7 +152,7 @@ jobs: steps: - name: Checkout Code Repository - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: ref: ${{ github.event.pull_request.head.sha }} submodules: recursive @@ -205,7 +205,7 @@ jobs: rm -rf ${{ matrix.context }}/src/bento mv ${{ matrix.context }}/src/tmp-bento ${{ matrix.context }}/src/bento - - name: Run unit tests + - name: Run tests if: steps.filter.outputs.changed == 'true' working-directory: ${{ matrix.context }} run: pytest --cov=src --cov-report=xml --cov-report=term-missing --ignore=src/bento From d09cedb81944033ab4678871e23521e6f9294c1d Mon Sep 17 00:00:00 2001 From: "Alec M." Date: Thu, 6 Aug 2026 10:18:18 -0400 Subject: [PATCH 06/10] Remove slack notification from unit test workflow --- .github/workflows/unit-test.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 28891da82..0dac24c40 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -230,19 +230,3 @@ jobs: parallel-finished: true carryforward: "authn,backend,frontend,chatbot-backend,validators,cli-uploader" continue-on-error: true - - # ────────────────────────────────────────────── - # Slack notification (always runs) - # ────────────────────────────────────────────── - notify: - name: Slack Notification - runs-on: ubuntu-latest - needs: [pr-unit-test-npm, pr-unit-test-python] - if: always() - steps: - - name: Slack Notification - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - uses: act10ns/slack@87c73aef9f8838eb6feae81589a6b1487a4a9e08 # v1.6.0 - with: - status: ${{ (contains(needs.*.result, 'failure')) && 'failure' || 'success' }} From 8616a63fab62ea97bf747d04ab6563630b613727 Mon Sep 17 00:00:00 2001 From: "Alec M." Date: Fri, 14 Aug 2026 09:08:35 -0400 Subject: [PATCH 07/10] test chatbot-backend --- apps/chatbot-backend/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/chatbot-backend/README.md b/apps/chatbot-backend/README.md index c7be54d5c..2928ad9a6 100644 --- a/apps/chatbot-backend/README.md +++ b/apps/chatbot-backend/README.md @@ -1,5 +1,7 @@ # Introduction +Test changes + This project provides the base implementation for a question-answering system using AWS Bedrock and a Knowledge Base (KB). It handles incoming questions, retrieves relevant context from the KB, and generates answers using the Converse API. Key features include: From 54c0fccb5108834df1b0b11856dcb12a26f6cd4e Mon Sep 17 00:00:00 2001 From: "Alec M." Date: Fri, 14 Aug 2026 09:10:45 -0400 Subject: [PATCH 08/10] Revert "test chatbot-backend" This reverts commit 8616a63fab62ea97bf747d04ab6563630b613727. --- apps/chatbot-backend/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/chatbot-backend/README.md b/apps/chatbot-backend/README.md index 2928ad9a6..c7be54d5c 100644 --- a/apps/chatbot-backend/README.md +++ b/apps/chatbot-backend/README.md @@ -1,7 +1,5 @@ # Introduction -Test changes - This project provides the base implementation for a question-answering system using AWS Bedrock and a Knowledge Base (KB). It handles incoming questions, retrieves relevant context from the KB, and generates answers using the Converse API. Key features include: From a664fc00f8ecde10806b5870543aeb0a81ed3d5c Mon Sep 17 00:00:00 2001 From: "Alec M." Date: Fri, 14 Aug 2026 09:11:16 -0400 Subject: [PATCH 09/10] test frontend --- apps/frontend/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/frontend/README.md b/apps/frontend/README.md index 6582c05ba..b79f8f0e9 100644 --- a/apps/frontend/README.md +++ b/apps/frontend/README.md @@ -1,5 +1,7 @@ # Introduction +test changes + The CRDC Submission Portal is a React application that facilitates the data submission process for participating CRDC Data Commons projects. This project utilizes React.js, TypeScript, MUI, and Apollo Client, among other dependencies. [![Coverage Status](https://coveralls.io/repos/github/CBIIT/crdc-datahub-codebase/badge.svg?branch=master)](https://coveralls.io/github/CBIIT/crdc-datahub-codebase?branch=master) From c311250ea9606035b4cbeeb9dee18a0cd2765d8f Mon Sep 17 00:00:00 2001 From: "Alec M." Date: Fri, 14 Aug 2026 09:34:10 -0400 Subject: [PATCH 10/10] Revert "test frontend" This reverts commit a664fc00f8ecde10806b5870543aeb0a81ed3d5c. --- apps/frontend/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/frontend/README.md b/apps/frontend/README.md index b79f8f0e9..6582c05ba 100644 --- a/apps/frontend/README.md +++ b/apps/frontend/README.md @@ -1,7 +1,5 @@ # Introduction -test changes - The CRDC Submission Portal is a React application that facilitates the data submission process for participating CRDC Data Commons projects. This project utilizes React.js, TypeScript, MUI, and Apollo Client, among other dependencies. [![Coverage Status](https://coveralls.io/repos/github/CBIIT/crdc-datahub-codebase/badge.svg?branch=master)](https://coveralls.io/github/CBIIT/crdc-datahub-codebase?branch=master)