From 8da782883eb047b64a86228b7a103dda38f0f6b5 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 20 May 2025 22:21:33 -0500 Subject: [PATCH 1/8] build and test wheels in CI --- .github/workflows/build.yaml | 0 .github/workflows/pr.yaml | 31 +++++++++++++++++++------------ .gitignore | 5 +++++ ci/build_wheel.sh | 11 +++++++++++ ci/test_wheel.sh | 10 ++++++++++ pyproject.toml | 7 +++++-- 6 files changed, 50 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/build.yaml create mode 100755 ci/build_wheel.sh create mode 100755 ci/test_wheel.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..e69de29 diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 1f53862..e0295b2 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -7,15 +7,22 @@ on: pull_request: jobs: - test: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -e .[test] - - name: Run tests - run: pytest + build-wheel: + uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-25.06 + with: + build_type: pull-request + script: ci/build_wheel.sh + # only need 1 build: amd64, oldest-supported Python, latest-supported CUDA + matrix_filter: '[map(select(.ARCH == "amd64")) | min_by((.PY_VER | split(".") | map(tonumber)), (.CUDA_VER | split(".") | map(-tonumber)))]' + package-name: rapids-cli + package-type: python + pure-wheel: true + append-cuda-suffix: false + wheel-tests: + secrets: inherit + uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-25.06 + with: + build_type: pull-request + script: ci/test_wheel.sh + # run just 1 amd64 and 1 arm64 test job (using the oldest-supported Python and the latest-supported CUDA) + matrix_filter: group_by(.CUDA_VER|split(".")|map(tonumber)|.[0]) | map(max_by([(.PY_VER|split(".")|map(tonumber)), (.CUDA_VER|split(".")|map(tonumber))])) diff --git a/.gitignore b/.gitignore index 83c97b5..3e3600b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,10 @@ +*.bz2 +*.conda .mypy_cache/ .ruff_cache/ +*.tar.gz +*.whl +*.zip # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/ci/build_wheel.sh b/ci/build_wheel.sh new file mode 100755 index 0000000..6bd0dea --- /dev/null +++ b/ci/build_wheel.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Copyright (c) 2024-2025, NVIDIA CORPORATION. + +set -euo pipefail + +python -m pip wheel \ + -v \ + --no-deps \ + --disable-pip-version-check \ + -w "${RAPIDS_WHEEL_BLD_OUTPUT_DIR}" \ + . diff --git a/ci/test_wheel.sh b/ci/test_wheel.sh new file mode 100755 index 0000000..e5125f0 --- /dev/null +++ b/ci/test_wheel.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# nx-cugraph is a pure wheel, which is part of generating the download path +WHEELHOUSE=$(RAPIDS_PY_WHEEL_NAME="rapids_cli" RAPIDS_PY_WHEEL_PURE="1" rapids-download-wheels-from-github python) + +# echo to expand wildcard before adding `[extra]` requires for pip +rapids-pip-retry install \ + "$(echo "${WHEELHOUSE}/rapids_cli"*.whl)[test]" + +python -m pytest diff --git a/pyproject.toml b/pyproject.toml index 1e194fb..e73eddf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,12 @@ [build-system] -requires = ["setuptools", "wheel"] +requires = [ + "setuptools>=64.0.0", + "wheel", +] build-backend = "setuptools.build_meta" [project] -name = "rapids_cli" +name = "rapids-cli" version = "0.1" description = "A CLI for RAPIDS" requires-python = ">=3.10" From df632f2d8972aeedc027d04ea7fb02098c086b8c Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 20 May 2025 22:23:43 -0500 Subject: [PATCH 2/8] switch to push events --- .github/workflows/pr.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index e0295b2..615c433 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -1,10 +1,14 @@ -name: Python Tests +name: pr on: push: branches: - - main - pull_request: + - "pull-request/[0-9]+" + +# automatically cancel in-progress CI runs if a new commit is pushed to the same ref +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true jobs: build-wheel: @@ -21,6 +25,7 @@ jobs: wheel-tests: secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-25.06 + needs: [build-wheel] with: build_type: pull-request script: ci/test_wheel.sh From 52ce0db84947ba869a295e33796a53cb77a5c9dd Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 20 May 2025 22:41:24 -0500 Subject: [PATCH 3/8] fix download steps --- ci/test_wheel.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/test_wheel.sh b/ci/test_wheel.sh index e5125f0..022ec25 100755 --- a/ci/test_wheel.sh +++ b/ci/test_wheel.sh @@ -5,6 +5,6 @@ WHEELHOUSE=$(RAPIDS_PY_WHEEL_NAME="rapids_cli" RAPIDS_PY_WHEEL_PURE="1" rapids-d # echo to expand wildcard before adding `[extra]` requires for pip rapids-pip-retry install \ - "$(echo "${WHEELHOUSE}/rapids_cli"*.whl)[test]" + $(echo "${WHEELHOUSE}/rapids_cli"*.whl)[test] python -m pytest From 0bbb67d61799c1779f986b0b9f6bd78b5cb41849 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 20 May 2025 23:06:11 -0500 Subject: [PATCH 4/8] fix artifact downloads --- ci/test_wheel.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/test_wheel.sh b/ci/test_wheel.sh index 022ec25..b729091 100755 --- a/ci/test_wheel.sh +++ b/ci/test_wheel.sh @@ -1,10 +1,10 @@ #!/bin/bash # nx-cugraph is a pure wheel, which is part of generating the download path -WHEELHOUSE=$(RAPIDS_PY_WHEEL_NAME="rapids_cli" RAPIDS_PY_WHEEL_PURE="1" rapids-download-wheels-from-github python) +WHEELHOUSE=$(RAPIDS_PY_WHEEL_NAME="rapids-cli" RAPIDS_PY_WHEEL_PURE="1" rapids-download-wheels-from-github python) # echo to expand wildcard before adding `[extra]` requires for pip rapids-pip-retry install \ - $(echo "${WHEELHOUSE}/rapids_cli"*.whl)[test] + "$(echo "${WHEELHOUSE}"/rapids_cli*.whl)[test]" python -m pytest From 447bbcce48a09d2982bbd10dbe7308d8d3407672 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 20 May 2025 23:32:15 -0500 Subject: [PATCH 5/8] fill out build.yaml --- .github/workflows/build.yaml | 54 ++++++++++++++++++++++++++++++++++++ .github/workflows/pr.yaml | 1 - 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e69de29..4ef3034 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -0,0 +1,54 @@ +name: build + +on: + push: + branches: + - main + tags: + - v[0-9][0-9].[0-9][0-9].[0-9][0-9] + workflow_dispatch: + inputs: + branch: + required: true + type: string + date: + required: true + type: string + sha: + required: true + type: string + build_type: + type: string + default: nightly + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + +jobs: + wheel-build: + secrets: inherit + uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-25.06 + with: + build_type: ${{ inputs.build_type || 'branch' }} + branch: ${{ inputs.branch }} + sha: ${{ inputs.sha }} + date: ${{ inputs.date }} + script: ci/build_wheel.sh + # only need 1 build: amd64, oldest-supported Python, latest-supported CUDA + matrix_filter: '[map(select(.ARCH == "amd64")) | min_by((.PY_VER | split(".") | map(tonumber)), (.CUDA_VER | split(".") | map(-tonumber)))]' + package-name: rapids-cli + package-type: python + pure-wheel: true + append-cuda-suffix: false + wheel-publish: + needs: wheel-build + secrets: inherit + uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-25.06 + with: + build_type: ${{ inputs.build_type || 'branch' }} + branch: ${{ inputs.branch }} + sha: ${{ inputs.sha }} + date: ${{ inputs.date }} + package-name: rapids-cli + package-type: python diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 615c433..908b50e 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -5,7 +5,6 @@ on: branches: - "pull-request/[0-9]+" -# automatically cancel in-progress CI runs if a new commit is pushed to the same ref concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} cancel-in-progress: true From 047156ae5a52b947f08d1850bdb8c55134c7a399 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 20 May 2025 23:42:05 -0500 Subject: [PATCH 6/8] run a single test job --- .github/workflows/pr.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 908b50e..89645c5 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -22,11 +22,12 @@ jobs: pure-wheel: true append-cuda-suffix: false wheel-tests: + needs: [conda-cpp-build, changed-files] secrets: inherit - uses: rapidsai/shared-workflows/.github/workflows/wheels-test.yaml@branch-25.06 - needs: [build-wheel] + uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@branch-25.06 with: build_type: pull-request - script: ci/test_wheel.sh - # run just 1 amd64 and 1 arm64 test job (using the oldest-supported Python and the latest-supported CUDA) - matrix_filter: group_by(.CUDA_VER|split(".")|map(tonumber)|.[0]) | map(max_by([(.PY_VER|split(".")|map(tonumber)), (.CUDA_VER|split(".")|map(tonumber))])) + node_type: "gpu-l4-latest-1" + arch: "amd64" + container_image: "rapidsai/citestwheel:latest" + run_script: "ci/test_wheel.sh" From 949a6a953392b43b096561c6a99960e782a96a9e Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 20 May 2025 23:44:02 -0500 Subject: [PATCH 7/8] run a single test job --- .github/workflows/pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 89645c5..a4c762e 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -22,7 +22,7 @@ jobs: pure-wheel: true append-cuda-suffix: false wheel-tests: - needs: [conda-cpp-build, changed-files] + needs: [build-wheel] secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/custom-job.yaml@branch-25.06 with: @@ -30,4 +30,4 @@ jobs: node_type: "gpu-l4-latest-1" arch: "amd64" container_image: "rapidsai/citestwheel:latest" - run_script: "ci/test_wheel.sh" + run_script: ci/test_wheel.sh From 1cbfdd06be3bed7e6eaf8d74d46dae0b872f5a9e Mon Sep 17 00:00:00 2001 From: James Lamb Date: Wed, 21 May 2025 09:39:36 -0500 Subject: [PATCH 8/8] updates --- .github/workflows/build.yaml | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4ef3034..e93ef15 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,24 +2,12 @@ name: build on: push: + # run on every new commit pushed to 'main' branches: - main + # run whenever a new tag is created following one of the following patterns tags: - v[0-9][0-9].[0-9][0-9].[0-9][0-9] - workflow_dispatch: - inputs: - branch: - required: true - type: string - date: - required: true - type: string - sha: - required: true - type: string - build_type: - type: string - default: nightly concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} @@ -30,10 +18,7 @@ jobs: secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-build.yaml@branch-25.06 with: - build_type: ${{ inputs.build_type || 'branch' }} - branch: ${{ inputs.branch }} - sha: ${{ inputs.sha }} - date: ${{ inputs.date }} + build_type: branch script: ci/build_wheel.sh # only need 1 build: amd64, oldest-supported Python, latest-supported CUDA matrix_filter: '[map(select(.ARCH == "amd64")) | min_by((.PY_VER | split(".") | map(tonumber)), (.CUDA_VER | split(".") | map(-tonumber)))]' @@ -46,9 +31,6 @@ jobs: secrets: inherit uses: rapidsai/shared-workflows/.github/workflows/wheels-publish.yaml@branch-25.06 with: - build_type: ${{ inputs.build_type || 'branch' }} - branch: ${{ inputs.branch }} - sha: ${{ inputs.sha }} - date: ${{ inputs.date }} + build_type: branch package-name: rapids-cli package-type: python