Skip to content

Commit

Permalink
Prune workflows based on changed files
Browse files Browse the repository at this point in the history
Only run tests based on things that have actually changed. For
example, if only Python files have changed, we don't need to run
the C++ tests.

Contributes to rapidsai/build-planning#94
  • Loading branch information
KyleFromNVIDIA committed Aug 27, 2024
1 parent f7e1cea commit f225033
Showing 1 changed file with 65 additions and 9 deletions.
74 changes: 65 additions & 9 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ concurrency:
jobs:
pr-builder:
needs:
- changed-files
- checks
- conda-cpp-build
- conda-cpp-tests
Expand All @@ -35,6 +36,52 @@ jobs:
- devcontainer
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
if: always()
with:
needs: ${{ toJSON(needs) }}
changed-files:
runs-on: ubuntu-latest
name: "Check changed files"
outputs:
test_cpp: ${{ steps.changed-files.outputs.cpp_any_changed == 'true' }}
test_notebooks: ${{ steps.changed-files.outputs.notebooks_any_changed == 'true' }}
test_python: ${{ steps.changed-files.outputs.python_any_changed == 'true' }}
steps:
- name: Get PR info
id: get-pr-info
uses: rapidsai/shared-actions/get-pr-info@main
- name: Checkout code repo
uses: actions/checkout@v4
with:
ref: ${{ inputs.sha }}
fetch-depth: ${{ fromJSON(steps.get-pr-info.outputs.pr-info).commits }}
persist-credentials: false
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
base_sha: ${{ fromJSON(steps.get-pr-info.outputs.pr-info).base.sha }}
files_yaml: |
cpp:
- '**'
- '!docs/**'
- '!img/**'
- '!notebooks/**'
- '!python/**'
# TODO: Remove this before merging
- '!.github/**'
notebooks:
- '**'
- '!docs/**'
# TODO: Remove this before merging
- '!.github/**'
python:
- '**'
- '!docs/**'
- '!img/**'
- '!notebooks/**'
# TODO: Remove this before merging
- '!.github/**'
checks:
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
Expand All @@ -48,9 +95,10 @@ jobs:
build_type: pull-request
node_type: cpu32
conda-cpp-tests:
needs: conda-cpp-build
needs: [conda-cpp-build, changed-files]
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
if: needs.changed-files.outputs.test_cpp == 'true'
with:
build_type: pull-request
conda-cpp-checks:
Expand All @@ -68,15 +116,17 @@ jobs:
with:
build_type: pull-request
conda-python-tests:
needs: conda-python-build
needs: [conda-python-build, changed-files]
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
if: needs.changed-files.outputs.test_python == 'true'
with:
build_type: pull-request
conda-notebook-tests:
needs: conda-python-build
needs: [conda-python-build, changed-files]
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
if: needs.changed-files.outputs.test_notebooks == 'true'
with:
build_type: pull-request
node_type: "gpu-v100-latest-1"
Expand Down Expand Up @@ -105,9 +155,10 @@ jobs:
extra-repo-deploy-key: CUGRAPH_OPS_SSH_PRIVATE_DEPLOY_KEY
node_type: cpu32
wheel-tests-pylibcugraph:
needs: wheel-build-pylibcugraph
needs: [wheel-build-pylibcugraph, changed-files]
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
if: needs.changed-files.outputs.test_python == 'true'
with:
build_type: pull-request
script: ci/test_wheel_pylibcugraph.sh
Expand All @@ -122,9 +173,10 @@ jobs:
extra-repo-sha: branch-24.10
extra-repo-deploy-key: CUGRAPH_OPS_SSH_PRIVATE_DEPLOY_KEY
wheel-tests-cugraph:
needs: wheel-build-cugraph
needs: [wheel-build-cugraph, changed-files]
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
if: needs.changed-files.outputs.test_python == 'true'
with:
build_type: pull-request
script: ci/test_wheel_cugraph.sh
Expand All @@ -136,9 +188,10 @@ jobs:
build_type: pull-request
script: ci/build_wheel_nx-cugraph.sh
wheel-tests-nx-cugraph:
needs: wheel-build-nx-cugraph
needs: [wheel-build-nx-cugraph, changed-files]
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
if: needs.changed-files.outputs.test_python == 'true'
with:
build_type: pull-request
script: ci/test_wheel_nx-cugraph.sh
Expand All @@ -150,9 +203,10 @@ jobs:
build_type: pull-request
script: ci/build_wheel_cugraph-dgl.sh
wheel-tests-cugraph-dgl:
needs: wheel-build-cugraph-dgl
needs: [wheel-build-cugraph-dgl, changed-files]
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
if: needs.changed-files.outputs.test_python == 'true'
with:
build_type: pull-request
script: ci/test_wheel_cugraph-dgl.sh
Expand All @@ -165,9 +219,10 @@ jobs:
build_type: pull-request
script: ci/build_wheel_cugraph-pyg.sh
wheel-tests-cugraph-pyg:
needs: wheel-build-cugraph-pyg
needs: [wheel-build-cugraph-pyg, changed-files]
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
if: needs.changed-files.outputs.test_python == 'true'
with:
build_type: pull-request
script: ci/test_wheel_cugraph-pyg.sh
Expand All @@ -179,9 +234,10 @@ jobs:
build_type: pull-request
script: ci/build_wheel_cugraph-equivariant.sh
wheel-tests-cugraph-equivariant:
needs: wheel-build-cugraph-equivariant
needs: [wheel-build-cugraph-equivariant, changed-files]
secrets: inherit
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
if: needs.changed-files.outputs.test_python == 'true'
with:
build_type: pull-request
script: ci/test_wheel_cugraph-equivariant.sh
Expand Down

0 comments on commit f225033

Please sign in to comment.