From 9884ef5d5c32dd578707ea8e4efbacc9e12c836f Mon Sep 17 00:00:00 2001 From: spomichter Date: Tue, 17 Feb 2026 19:10:57 +0000 Subject: [PATCH] fix(ci): skip test jobs entirely for non-code PRs, add builds to ci-complete MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move path filter checks to job-level if: conditions so test caller jobs are fully skipped (no container spin-up) when no relevant files changed. The always() is kept so skipped upstream builds don't prevent the condition from evaluating. Remove should-run input from tests.yml and all callers — job-level gating makes it redundant. If the job runs, code changed. Add all upstream jobs to ci-complete's needs list (check-changes, build jobs, test jobs) so failures at any stage are caught by the gate. --- .github/workflows/docker.yml | 90 ++++++++++++++++++------------------ .github/workflows/tests.yml | 9 +--- 2 files changed, 46 insertions(+), 53 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index cf3e1cdcae..09029e7a0e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -144,94 +144,94 @@ jobs: run-ros-tests: needs: [check-changes, ros-dev] - if: always() + if: ${{ + always() && + needs.check-changes.result == 'success' && + (needs.check-changes.outputs.tests == 'true' || + needs.check-changes.outputs.ros == 'true' || + needs.check-changes.outputs.python == 'true' || + needs.check-changes.outputs.dev == 'true') + }} uses: ./.github/workflows/tests.yml secrets: inherit with: - should-run: ${{ - needs.check-changes.result == 'success' && - (needs.check-changes.outputs.tests == 'true' || - needs.check-changes.outputs.ros == 'true' || - needs.check-changes.outputs.python == 'true' || - needs.check-changes.outputs.dev == 'true') - }} cmd: "pytest && pytest -m ros" # run tests that depend on ros as well dev-image: ros-dev:${{ (needs.check-changes.outputs.python == 'true' || needs.check-changes.outputs.dev == 'true' || needs.check-changes.outputs.ros == 'true') && needs.ros-dev.result == 'success' && needs.check-changes.outputs.branch-tag || 'dev' }} run-tests: needs: [check-changes, dev] - if: always() + if: ${{ + always() && + needs.check-changes.result == 'success' && + (needs.check-changes.outputs.tests == 'true' || + needs.check-changes.outputs.python == 'true' || + needs.check-changes.outputs.dev == 'true') + }} uses: ./.github/workflows/tests.yml secrets: inherit with: - should-run: ${{ - needs.check-changes.result == 'success' && - (needs.check-changes.outputs.tests == 'true' || - needs.check-changes.outputs.python == 'true' || - needs.check-changes.outputs.dev == 'true') - }} cmd: "pytest" dev-image: dev:${{ (needs.check-changes.outputs.python == 'true' || needs.check-changes.outputs.dev == 'true') && needs.dev.result == 'success' && needs.check-changes.outputs.branch-tag || 'dev' }} # we run in parallel with normal tests for speed run-heavy-tests: needs: [check-changes, dev] - if: always() + if: ${{ + always() && + needs.check-changes.result == 'success' && + (needs.check-changes.outputs.tests == 'true' || + needs.check-changes.outputs.python == 'true' || + needs.check-changes.outputs.dev == 'true') + }} uses: ./.github/workflows/tests.yml secrets: inherit with: - should-run: ${{ - needs.check-changes.result == 'success' && - (needs.check-changes.outputs.tests == 'true' || - needs.check-changes.outputs.python == 'true' || - needs.check-changes.outputs.dev == 'true') - }} cmd: "pytest -m heavy" dev-image: dev:${{ (needs.check-changes.outputs.python == 'true' || needs.check-changes.outputs.dev == 'true') && needs.dev.result == 'success' && needs.check-changes.outputs.branch-tag || 'dev' }} run-lcm-tests: needs: [check-changes, dev] - if: always() + if: ${{ + always() && + needs.check-changes.result == 'success' && + (needs.check-changes.outputs.tests == 'true' || + needs.check-changes.outputs.python == 'true' || + needs.check-changes.outputs.dev == 'true') + }} uses: ./.github/workflows/tests.yml secrets: inherit with: - should-run: ${{ - needs.check-changes.result == 'success' && - (needs.check-changes.outputs.tests == 'true' || - needs.check-changes.outputs.python == 'true' || - needs.check-changes.outputs.dev == 'true') - }} cmd: "pytest -m lcm" dev-image: dev:${{ (needs.check-changes.outputs.python == 'true' || needs.check-changes.outputs.dev == 'true') && needs.dev.result == 'success' && needs.check-changes.outputs.branch-tag || 'dev' }} run-integration-tests: needs: [check-changes, dev] - if: always() + if: ${{ + always() && + needs.check-changes.result == 'success' && + (needs.check-changes.outputs.tests == 'true' || + needs.check-changes.outputs.python == 'true' || + needs.check-changes.outputs.dev == 'true') + }} uses: ./.github/workflows/tests.yml secrets: inherit with: - should-run: ${{ - needs.check-changes.result == 'success' && - (needs.check-changes.outputs.tests == 'true' || - needs.check-changes.outputs.python == 'true' || - needs.check-changes.outputs.dev == 'true') - }} cmd: "pytest -m integration" dev-image: dev:${{ (needs.check-changes.outputs.python == 'true' || needs.check-changes.outputs.dev == 'true') && needs.dev.result == 'success' && needs.check-changes.outputs.branch-tag || 'dev' }} run-mypy: needs: [check-changes, ros-dev] - if: always() + if: ${{ + always() && + needs.check-changes.result == 'success' && + (needs.check-changes.outputs.tests == 'true' || + needs.check-changes.outputs.ros == 'true' || + needs.check-changes.outputs.python == 'true' || + needs.check-changes.outputs.dev == 'true') + }} uses: ./.github/workflows/tests.yml secrets: inherit with: - should-run: ${{ - needs.check-changes.result == 'success' && - (needs.check-changes.outputs.tests == 'true' || - needs.check-changes.outputs.ros == 'true' || - needs.check-changes.outputs.python == 'true' || - needs.check-changes.outputs.dev == 'true') - }} cmd: "MYPYPATH=/opt/ros/humble/lib/python3.10/site-packages mypy dimos" dev-image: ros-dev:${{ (needs.check-changes.outputs.python == 'true' || needs.check-changes.outputs.dev == 'true' || needs.check-changes.outputs.ros == 'true') && needs.ros-dev.result == 'success' && needs.check-changes.outputs.branch-tag || 'dev' }} @@ -271,7 +271,7 @@ jobs: # /entrypoint.sh bash -c "pytest -m module" ci-complete: - needs: [run-tests, run-heavy-tests, run-lcm-tests, run-integration-tests, run-ros-tests, run-mypy] + needs: [check-changes, ros, python, ros-python, dev, ros-dev, run-tests, run-heavy-tests, run-lcm-tests, run-integration-tests, run-ros-tests, run-mypy] runs-on: [self-hosted, Linux] if: always() steps: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1f78a4e4e9..25273238dc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,10 +3,6 @@ name: tests on: workflow_call: inputs: - should-run: - required: false - type: boolean - default: true dev-image: required: true type: string @@ -31,19 +27,16 @@ jobs: steps: - uses: actions/checkout@v4 - if: ${{ inputs.should-run }} - name: Fix permissions - if: ${{ inputs.should-run }} run: | git config --global --add safe.directory '*' - name: Run tests - if: ${{ inputs.should-run }} run: | /entrypoint.sh bash -c "${{ inputs.cmd }}" - name: check disk space - if: ${{ failure() && inputs.should-run }} + if: failure() run: | df -h