Skip to content

Commit

Permalink
Move wheel building logic to downstream repos (#97)
Browse files Browse the repository at this point in the history
This PR tries to minimize custom logic in wheel building workflows by
trying to mirror conda builds closer and moving wheel building logic to
downstream repositories. The PR achieves this by adding a new workflow
`wheels-build.yaml`

Depends on rapidsai/cibuildwheel-imgs#29

---------

Co-authored-by: Vyas Ramasubramani <[email protected]>
  • Loading branch information
divyegala and vyasr authored Jul 19, 2023
1 parent a17d757 commit 016436c
Showing 1 changed file with 157 additions and 0 deletions.
157 changes: 157 additions & 0 deletions .github/workflows/wheels-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
name: Build RAPIDS wheels

on:
workflow_call:
inputs:
# repo and branch
repo:
type: string
branch:
type: string
date:
type: string
sha:
type: string
build_type:
required: true
type: string
build_script:
required: true
type: string

# allow a bigger runner instance
node_type:
required: false
type: string
default: "cpu16"

# general settings
matrix_filter:
type: string
default: "."

# Extra repository that will be cloned into the project directory.
extra-repo:
required: false
type: string
default: ''
extra-repo-sha:
required: false
type: string
default: ''
# Note that this is the _name_ of a secret containing the key, not the key itself.
extra-repo-deploy-key:
required: false
type: string
default: ''

defaults:
run:
shell: bash

permissions:
actions: read
checks: none
contents: read
deployments: none
discussions: none
id-token: write
issues: none
packages: read
pages: none
pull-requests: read
repository-projects: none
security-events: none
statuses: none

jobs:

compute-matrix:
runs-on: ubuntu-latest
outputs:
MATRIX: ${{ steps.compute-matrix.outputs.MATRIX }}
steps:
- name: Compute Build Matrix
id: compute-matrix
run: |
set -eo pipefail
export MATRIX="
- { CUDA_VER: '11.8.0', ARCH: 'amd64', PY_VER: '3.9', LINUX_VER: 'centos7' }
- { CUDA_VER: '11.8.0', ARCH: 'amd64', PY_VER: '3.10', LINUX_VER: 'centos7' }
- { CUDA_VER: '11.8.0', ARCH: 'arm64', PY_VER: '3.9', LINUX_VER: 'ubuntu20.04' }
- { CUDA_VER: '11.8.0', ARCH: 'arm64', PY_VER: '3.10', LINUX_VER: 'ubuntu20.04' }
- { CUDA_VER: '12.0.1', ARCH: 'amd64', PY_VER: '3.9', LINUX_VER: 'centos7' }
- { CUDA_VER: '12.0.1', ARCH: 'amd64', PY_VER: '3.10', LINUX_VER: 'centos7' }
- { CUDA_VER: '12.0.1', ARCH: 'arm64', PY_VER: '3.9', LINUX_VER: 'ubuntu20.04' }
- { CUDA_VER: '12.0.1', ARCH: 'arm64', PY_VER: '3.10', LINUX_VER: 'ubuntu20.04' }
"
echo "MATRIX=$(
yq -n -o json 'env(MATRIX)' | \
jq -c '${{ inputs.matrix_filter }} | {include: .}' \
)" | tee --append "${GITHUB_OUTPUT}"
build:
name: ${{ matrix.CUDA_VER }}, ${{ matrix.PY_VER }}, ${{ matrix.ARCH }}, ${{ matrix.LINUX_VER }}
needs: [compute-matrix]
strategy:
matrix: ${{ fromJSON(needs.compute-matrix.outputs.MATRIX) }}
runs-on: "linux-${{ matrix.ARCH }}-${{ inputs.node_type }}"
container:
image: "rapidsai/ci-wheel:cuda${{ matrix.CUDA_VER }}-${{ matrix.LINUX_VER }}-py${{ matrix.PY_VER }}"

env:
RAPIDS_BUILD_TYPE: ${{ inputs.build_type }}

steps:
- uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ vars.AWS_ROLE_ARN }}
aws-region: ${{ vars.AWS_REGION }}
role-duration-seconds: 43200 # 12h
- name: checkout code repo
uses: actions/checkout@v3
with:
repository: ${{ inputs.repo }}
ref: ${{ inputs.sha }}
fetch-depth: 0 # unshallow fetch for setuptools-scm
persist-credentials: false

- name: Standardize repository information
uses: rapidsai/shared-action-workflows/[email protected]
with:
repo: ${{ inputs.repo }}
branch: ${{ inputs.branch }}
date: ${{ inputs.date }}
sha: ${{ inputs.sha }}

- name: Preprocess extra repos
id: preprocess-extras
if: ${{ inputs.extra-repo != '' }}
run: |
EXTRA_REPO_PATH=$(echo ${{ inputs.extra-repo }} | cut -d "/" -f 2)
echo "EXTRA_REPO_PATH=${EXTRA_REPO_PATH}" >> $GITHUB_OUTPUT
- name: checkout extra repos
uses: actions/checkout@v3
if: ${{ inputs.extra-repo != '' }}
with:
repository: ${{ inputs.extra-repo }}
ref: ${{ inputs.extra-repo-sha }}
path: "./${{ steps.preprocess-extras.outputs.EXTRA_REPO_PATH }}"
ssh-key: ${{ secrets[inputs.extra-repo-deploy-key] }}
persist-credentials: false

- name: Build and repair the wheel
run: |
# Store internal pypi credentials before any step that may download wheels
printf 'machine pypi.k8s.rapids.ai\n\tlogin cibuildwheel\n\tpassword ${{ secrets.RAPIDSAI_PYPI_CI_PASSWORD }}\n' > ~/.netrc
${{ inputs.build_script }}
env:
GH_TOKEN: ${{ github.token }}
# Use a shell that loads the rc file so that we get the compiler settings
shell: bash -leo pipefail {0}
- name: Upload additional artifacts
if: "!cancelled()"
run: rapids-upload-artifacts-dir cuda${RAPIDS_CUDA_VERSION%%.*}_$(arch)_py${RAPIDS_PY_VERSION//.}

0 comments on commit 016436c

Please sign in to comment.