cuda_tests #25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: cuda_tests | |
| on: | |
| push: | |
| branches: ["main"] | |
| paths-ignore: | |
| - 'docs/**' | |
| - 'docker/cuda/**' | |
| - 'docker/build.sh' | |
| - 'tools/install/**' | |
| - 'requirements/**' | |
| - '.github/workflows/build_image_cuda.yml' | |
| - '.github/workflows/push_image_harbor.yml' | |
| pull_request: | |
| branches: ["main"] | |
| paths-ignore: | |
| - 'docs/**' | |
| - 'docker/cuda/**' | |
| - 'docker/build.sh' | |
| - 'tools/install/**' | |
| - 'requirements/**' | |
| - '.github/workflows/build_image_cuda.yml' | |
| - '.github/workflows/push_image_harbor.yml' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.actor }} | |
| cancel-in-progress: true | |
| jobs: | |
| # --------------------------------------------------------------------------- | |
| # Guard: skip tests when PR contains docker-related changes, because | |
| # build_image_cuda.yml will handle build + test for those PRs. | |
| # paths-ignore alone cannot guarantee mutual exclusivity when a PR touches | |
| # both docker files and non-docker files, so we need this job-level check. | |
| # --------------------------------------------------------------------------- | |
| check_docker_changes: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| outputs: | |
| has_docker_changes: ${{ steps.check.outputs.has_docker_changes }} | |
| steps: | |
| - name: Check for docker-related file changes | |
| id: check | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| CHANGED=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files --paginate --jq '.[].filename') | |
| if echo "$CHANGED" | grep -qE '^(docker/cuda/|docker/build\.sh$|tools/install/|requirements/|\.github/workflows/build_image_cuda\.yml$)'; then | |
| echo "has_docker_changes=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_docker_changes=false" >> $GITHUB_OUTPUT | |
| fi | |
| run_tests: | |
| needs: check_docker_changes | |
| # On push: always run (paths-ignore already filtered). | |
| # On PR: only run when no docker-related files changed. | |
| if: always() && (github.event_name == 'push' || needs.check_docker_changes.outputs.has_docker_changes != 'true') | |
| # Package manager and environment settings are read from .github/configs/cuda.yml | |
| uses: ./.github/workflows/all_tests_common.yml | |
| with: | |
| platform: cuda | |
| all_tests: | |
| needs: [check_docker_changes, run_tests] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Verify workflow status | |
| run: | | |
| if [ "${{ needs.check_docker_changes.outputs.has_docker_changes }}" = "true" ]; then | |
| echo "⏭️ Skipped - docker changes detected, handled by build_image_cuda workflow" | |
| exit 0 | |
| fi | |
| if [ "${{ needs.run_tests.result }}" != "success" ]; then | |
| echo "❌ Tests workflow failed" | |
| exit 1 | |
| fi | |
| echo "✅ All tests passed!" |