Skip to content

Commit eac8839

Browse files
committed
Try reducing redundancy
1 parent ee12958 commit eac8839

File tree

2 files changed

+128
-155
lines changed

2 files changed

+128
-155
lines changed

.github/workflows/build-and-test-python-wheels.yml

Lines changed: 21 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -10,86 +10,33 @@ defaults:
1010
jobs:
1111
build-cccl:
1212
name: Build CCCL Wheels
13-
runs-on: ubuntu-latest
13+
uses: ./.github/workflows/run-ci-script.yml
14+
with:
15+
script-command: ci/build_cuda_cccl_python.sh -py-version ${{ matrix.python-version }}
16+
python-version: ${{ matrix.python-version }}
17+
strategy:
18+
matrix:
19+
python-version: ['3.10', '3.11', '3.12', '3.13']
1420
permissions:
1521
id-token: write
1622
contents: read
23+
24+
test-cccl:
25+
name: Test CCCL Wheels
26+
needs: build-cccl
27+
uses: ./.github/workflows/run-ci-script.yml
28+
with:
29+
script-command: ci/test_cuda_cccl_python.sh -py-version ${{ matrix.python-version }}
30+
python-version: ${{ matrix.python-version }}
31+
needs-artifact: true
32+
artifact-name: wheel-cccl-${{ matrix.python-version }}
33+
artifact-path: ${{github.event.repository.name}}/wheelhouse/
1734
strategy:
1835
matrix:
1936
python-version: ['3.10', '3.11', '3.12', '3.13']
20-
steps:
21-
- name: Checkout repository
22-
uses: actions/checkout@v4
23-
with:
24-
path: ${{github.event.repository.name}}
25-
persist-credentials: false
26-
- name: Get AWS credentials for sccache bucket
27-
uses: aws-actions/configure-aws-credentials@v4
28-
with:
29-
role-to-assume: arn:aws:iam::279114543810:role/gha-oidc-NVIDIA
30-
aws-region: us-east-2
31-
role-duration-seconds: 43200 # 12 hours
32-
- name: Create CI script
33-
run: |
34-
cat <<"EOF" > "$RUNNER_TEMP/ci.sh"
35-
#! /usr/bin/env bash
36-
set -eo pipefail
37-
38-
ci/build_cuda_cccl_python.sh -py-version ${{ matrix.python-version }};
39-
EOF
40-
41-
chmod +x "$RUNNER_TEMP/ci.sh"
42-
43-
mkdir -p .aws
44-
45-
cat <<EOF > .aws/config
46-
[default]
47-
bucket=rapids-sccache-devs
48-
region=us-east-2
49-
EOF
50-
51-
cat <<EOF > .aws/credentials
52-
[default]
53-
aws_access_key_id=$AWS_ACCESS_KEY_ID
54-
aws_session_token=$AWS_SESSION_TOKEN
55-
aws_secret_access_key=$AWS_SECRET_ACCESS_KEY
56-
EOF
57-
58-
chmod 0600 .aws/credentials
59-
chmod 0664 .aws/config
60-
61-
- name: Run build script
62-
env:
63-
PYTHON_VERSION: ${{ matrix.python-version }}
64-
run: |
65-
${{github.event.repository.name}}/.devcontainer/launch.sh \
66-
--docker \
67-
--cuda 12.8 \
68-
--host gcc13 \
69-
--volume "$RUNNER_TEMP/ci.sh:/ci.sh" \
70-
--env "CI=$CI" \
71-
--env "AWS_ROLE_ARN=" \
72-
--env "SCCACHE_IDLE_TIMEOUT=0" \
73-
--env "GITHUB_ENV=$GITHUB_ENV" \
74-
--env "GITHUB_SHA=$GITHUB_SHA" \
75-
--env "GITHUB_PATH=$GITHUB_PATH" \
76-
--env "GITHUB_OUTPUT=$GITHUB_OUTPUT" \
77-
--env "GITHUB_ACTIONS=$GITHUB_ACTIONS" \
78-
--env "GITHUB_REF_NAME=$GITHUB_REF_NAME" \
79-
--env "GITHUB_WORKSPACE=$GITHUB_WORKSPACE" \
80-
--env "GITHUB_REPOSITORY=$GITHUB_REPOSITORY" \
81-
--env "GITHUB_STEP_SUMMARY=$GITHUB_STEP_SUMMARY" \
82-
--env "HOST_WORKSPACE=${{github.workspace}}" \
83-
-- /ci.sh
84-
85-
- name: Upload wheel artifact
86-
uses: actions/upload-artifact@v4
87-
with:
88-
name: wheel-cccl-${{ matrix.python-version }}
89-
path: ${{github.event.repository.name}}/wheelhouse/
90-
retention-days: 1
91-
continue-on-error: true
92-
37+
permissions:
38+
id-token: write
39+
contents: read
9340

9441
# build-cooperative:
9542
# name: Build Cooperative Wheels
@@ -171,87 +118,6 @@ jobs:
171118
# path: dist/*.whl
172119
# retention-days: 1
173120

174-
test-cccl:
175-
name: Test CCCL Wheels
176-
permissions:
177-
id-token: write
178-
contents: read
179-
needs: build-cccl
180-
runs-on: ubuntu-latest
181-
strategy:
182-
matrix:
183-
python-version: ['3.10', '3.11', '3.12', '3.13']
184-
steps:
185-
- name: Checkout repository
186-
uses: actions/checkout@v4
187-
with:
188-
path: ${{github.event.repository.name}}
189-
persist-credentials: false
190-
191-
- name: Get AWS credentials for sccache bucket
192-
uses: aws-actions/configure-aws-credentials@v4
193-
with:
194-
role-to-assume: arn:aws:iam::279114543810:role/gha-oidc-NVIDIA
195-
aws-region: us-east-2
196-
role-duration-seconds: 43200 # 12 hours
197-
198-
- name: Download wheel artifact
199-
uses: actions/download-artifact@v4
200-
with:
201-
name: wheel-cccl-${{ matrix.python-version }}
202-
path: ${{github.event.repository.name}}/wheelhouse/
203-
continue-on-error: true
204-
205-
- name: Create CI script
206-
run: |
207-
cat <<"EOF" > "$RUNNER_TEMP/ci.sh"
208-
#! /usr/bin/env bash
209-
set -eo pipefail
210-
211-
ci/test_cuda_cccl_python.sh -py-version ${{ matrix.python-version }};
212-
EOF
213-
214-
chmod +x "$RUNNER_TEMP/ci.sh"
215-
216-
mkdir -p .aws
217-
cat <<EOF > .aws/config
218-
[default]
219-
bucket=rapids-sccache-devs
220-
region=us-east-2
221-
EOF
222-
223-
cat <<EOF > .aws/credentials
224-
[default]
225-
aws_access_key_id=$AWS_ACCESS_KEY_ID
226-
aws_session_token=$AWS_SESSION_TOKEN
227-
aws_secret_access_key=$AWS_SECRET_ACCESS_KEY
228-
EOF
229-
230-
chmod 0600 .aws/credentials
231-
chmod 0664 .aws/config
232-
233-
- name: Run test script
234-
env:
235-
PYTHON_VERSION: ${{ matrix.python-version }}
236-
run: |
237-
${{github.event.repository.name}}/.devcontainer/launch.sh \
238-
--docker \
239-
--cuda 12.8 \
240-
--host gcc13 \
241-
--volume "$RUNNER_TEMP/ci.sh:/ci.sh" \
242-
--env "CI=$CI" \
243-
--env "AWS_ROLE_ARN=" \
244-
--env "SCCACHE_IDLE_TIMEOUT=0" \
245-
--env "GITHUB_ENV=$GITHUB_ENV" \
246-
--env "GITHUB_SHA=$GITHUB_SHA" \
247-
--env "GITHUB_PATH=$GITHUB_PATH" \
248-
--env "GITHUB_OUTPUT=$GITHUB_OUTPUT" \
249-
--env "GITHUB_ACTIONS=$GITHUB_ACTIONS" \
250-
--env "GITHUB_REF_NAME=$GITHUB_REF_NAME" \
251-
--env "GITHUB_WORKSPACE=$GITHUB_WORKSPACE" \
252-
--env "GITHUB_REPOSITORY=$GITHUB_REPOSITORY" \
253-
-- /ci.sh
254-
255121
# test-cooperative:
256122
# name: Test Cooperative Wheels
257123
# needs: build-cooperative
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Run CI Script
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
script-command:
7+
required: true
8+
type: string
9+
description: 'The command to run in the CI script'
10+
python-version:
11+
required: true
12+
type: string
13+
description: 'Python version to use'
14+
needs-artifact:
15+
required: false
16+
type: boolean
17+
default: false
18+
description: 'Whether to download the wheel artifact'
19+
artifact-name:
20+
required: false
21+
type: string
22+
description: 'Name of the artifact to download'
23+
artifact-path:
24+
required: false
25+
type: string
26+
description: 'Path to download the artifact to'
27+
28+
jobs:
29+
run-script:
30+
name: Run CI Script
31+
runs-on: ubuntu-latest
32+
permissions:
33+
id-token: write
34+
contents: read
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v4
38+
with:
39+
path: ${{github.event.repository.name}}
40+
persist-credentials: false
41+
42+
- name: Get AWS credentials for sccache bucket
43+
uses: aws-actions/configure-aws-credentials@v4
44+
with:
45+
role-to-assume: arn:aws:iam::279114543810:role/gha-oidc-NVIDIA
46+
aws-region: us-east-2
47+
role-duration-seconds: 43200 # 12 hours
48+
49+
- name: Download wheel artifact
50+
if: ${{ inputs.needs-artifact }}
51+
uses: actions/download-artifact@v4
52+
with:
53+
name: ${{ inputs.artifact-name }}
54+
path: ${{ inputs.artifact-path }}
55+
continue-on-error: true
56+
57+
- name: Create CI script
58+
run: |
59+
cat <<"EOF" > "$RUNNER_TEMP/ci.sh"
60+
#! /usr/bin/env bash
61+
set -eo pipefail
62+
63+
${{ inputs.script-command }};
64+
EOF
65+
66+
chmod +x "$RUNNER_TEMP/ci.sh"
67+
68+
mkdir -p .aws
69+
cat <<EOF > .aws/config
70+
[default]
71+
bucket=rapids-sccache-devs
72+
region=us-east-2
73+
EOF
74+
75+
cat <<EOF > .aws/credentials
76+
[default]
77+
aws_access_key_id=$AWS_ACCESS_KEY_ID
78+
aws_session_token=$AWS_SESSION_TOKEN
79+
aws_secret_access_key=$AWS_SECRET_ACCESS_KEY
80+
EOF
81+
82+
chmod 0600 .aws/credentials
83+
chmod 0664 .aws/config
84+
85+
- name: Run script
86+
env:
87+
PYTHON_VERSION: ${{ inputs.python-version }}
88+
run: |
89+
${{github.event.repository.name}}/.devcontainer/launch.sh \
90+
--docker \
91+
--cuda 12.8 \
92+
--host gcc13 \
93+
--volume "$RUNNER_TEMP/ci.sh:/ci.sh" \
94+
--env "CI=$CI" \
95+
--env "AWS_ROLE_ARN=" \
96+
--env "SCCACHE_IDLE_TIMEOUT=0" \
97+
--env "GITHUB_ENV=$GITHUB_ENV" \
98+
--env "GITHUB_SHA=$GITHUB_SHA" \
99+
--env "GITHUB_PATH=$GITHUB_PATH" \
100+
--env "GITHUB_OUTPUT=$GITHUB_OUTPUT" \
101+
--env "GITHUB_ACTIONS=$GITHUB_ACTIONS" \
102+
--env "GITHUB_REF_NAME=$GITHUB_REF_NAME" \
103+
--env "GITHUB_WORKSPACE=$GITHUB_WORKSPACE" \
104+
--env "GITHUB_REPOSITORY=$GITHUB_REPOSITORY" \
105+
--env "GITHUB_STEP_SUMMARY=$GITHUB_STEP_SUMMARY" \
106+
--env "HOST_WORKSPACE=${{github.workspace}}" \
107+
-- /ci.sh

0 commit comments

Comments
 (0)