From 0e742807dec4eed023b29a2dc32cca1f4899a45f Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Mon, 18 Nov 2024 14:19:41 +0000 Subject: [PATCH] Fix the NX check that looks for only affected packages when running tests in CI --- .github/workflows/budibase_ci.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 128b38a704..e894a91703 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -199,18 +199,22 @@ jobs: env: DATASOURCE: ${{ matrix.datasource }} run: | - AFFECTED=$(yarn --silent nx show projects --affected -t test --base=${{ env.NX_BASE_BRANCH }} -p @budibase/server) - if [ -n "$AFFECTED" ]; then - cd packages/server - if [ "${{ matrix.datasource }}" == "none" ]; then - yarn test --filter ./src/tests/filters/non-datasource-tests.js --passWithNoTests - else - yarn test --filter ./src/tests/filters/datasource-tests.js --passWithNoTests + if ${{ env.ONLY_AFFECTED_TASKS }}; then + AFFECTED=$(yarn --silent nx show projects --affected -t test --base=${{ env.NX_BASE_BRANCH }} -p @budibase/server) + if [ -z "$AFFECTED" ]; then + echo "No affected tests to run" + exit 0 fi - else - echo "No affected tests to run" fi + FILTER="./src/tests/filters/datasource-tests.js" + if [ "${{ matrix.datasource }}" == "none" ]; then + FILTER="./src/tests/filters/non-datasource-tests.js" + fi + + cd packages/server + yarn test --filter $FILTER --passWithNoTests + check-pro-submodule: runs-on: ubuntu-latest if: inputs.run_as_oss != true && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase')