Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions .github/workflows/build-wheels-m1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ jobs:
dupes=$(jq -r '.include | group_by(.desired_cuda) | map(select(length > 1)
| "\(.[0].desired_cuda): \(map(.python_version) | join(", "))") | .[]' <<< "$MATRIX")
[[ -z "$dupes" ]] || { echo "More than one build per variant:"; echo "$dupes"; exit 1; }
save-build-matrix:
needs: generate-matrix
runs-on: ubuntu-latest
steps:
- name: Save the build matrix
env:
MATRIX: ${{ needs.generate-matrix.outputs.matrix }}
run: printf '%s' "${MATRIX}" > build-matrix.json
- name: Upload the build matrix
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: build-matrix
path: build-matrix.json
build:
needs: [generate-matrix, check-one-build-per-variant]
strategy:
Expand All @@ -64,10 +77,6 @@ jobs:
runner-type: macos-m1-stable
package-name: ${{ matrix.package-name }}
trigger-event: ${{ github.event_name }}
secrets:
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
# See the equivalent job in build_wheels_linux.yml for why this exists.
test-py3-none-wheel:
needs: build
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/build_wheels_aarch64_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ jobs:
dupes=$(jq -r '.include | group_by(.desired_cuda) | map(select(length > 1)
| "\(.[0].desired_cuda): \(map(.python_version) | join(", "))") | .[]' <<< "$MATRIX")
[[ -z "$dupes" ]] || { echo "More than one build per variant:"; echo "$dupes"; exit 1; }
save-build-matrix:
needs: generate-matrix
runs-on: ubuntu-latest
steps:
- name: Save the build matrix
env:
MATRIX: ${{ needs.generate-matrix.outputs.matrix }}
run: printf '%s' "${MATRIX}" > build-matrix.json
- name: Upload the build matrix
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: build-matrix
path: build-matrix.json
build:
needs: [generate-matrix, check-one-build-per-variant]
strategy:
Expand All @@ -69,10 +82,6 @@ jobs:
trigger-event: ${{ github.event_name }}
architecture: aarch64
setup-miniconda: false
secrets:
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
# See the equivalent job in build_wheels_linux.yml for why this exists.
test-py3-none-wheel:
needs: build
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/build_wheels_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ jobs:
dupes=$(jq -r '.include | group_by(.desired_cuda) | map(select(length > 1)
| "\(.[0].desired_cuda): \(map(.python_version) | join(", "))") | .[]' <<< "$MATRIX")
[[ -z "$dupes" ]] || { echo "More than one build per variant:"; echo "$dupes"; exit 1; }
save-build-matrix:
needs: generate-matrix
runs-on: ubuntu-latest
steps:
- name: Save the build matrix
env:
MATRIX: ${{ needs.generate-matrix.outputs.matrix }}
run: printf '%s' "${MATRIX}" > build-matrix.json
- name: Upload the build matrix
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: build-matrix
path: build-matrix.json
build:
needs: [generate-matrix, check-one-build-per-variant]
strategy:
Expand All @@ -65,10 +78,6 @@ jobs:
smoke-test-script: ${{ matrix.smoke-test-script }}
package-name: ${{ matrix.package-name }}
trigger-event: ${{ github.event_name }}
secrets:
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
# Download the wheel that was built and run the smoke tests on different
# Python versions, including free-threaded versions. The smoke tests were
# already ran on the `build` job that built the wheel, but the point here is
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/build_wheels_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@ jobs:
dupes=$(jq -r '.include | group_by(.desired_cuda) | map(select(length > 1)
| "\(.[0].desired_cuda): \(map(.python_version) | join(", "))") | .[]' <<< "$MATRIX")
[[ -z "$dupes" ]] || { echo "More than one build per variant:"; echo "$dupes"; exit 1; }
save-build-matrix:
needs: generate-matrix
runs-on: ubuntu-latest
steps:
- name: Save the build matrix
env:
MATRIX: ${{ needs.generate-matrix.outputs.matrix }}
run: printf '%s' "${MATRIX}" > build-matrix.json
- name: Upload the build matrix
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: build-matrix
path: build-matrix.json
build:
needs: [generate-matrix, check-one-build-per-variant]
strategy:
Expand All @@ -62,10 +75,6 @@ jobs:
package-name: ${{ matrix.package-name }}
smoke-test-script: ${{ matrix.smoke-test-script }}
trigger-event: ${{ github.event_name }}
secrets:
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
# See the equivalent job in build_wheels_linux.yml for why this exists.
test-py3-none-wheel:
needs: build
Expand Down
121 changes: 121 additions & 0 deletions .github/workflows/upload_wheels_r2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Upload wheels to R2

# Runs from main whenever a nightly wheel build finishes, picks up the wheels that
# build saved as GitHub artifacts and uploads them to R2. The upload step lives
# here, not in the build workflows, so a pull request cannot change it, and the R2
# credentials come from the pytorchbot-env environment.

on:
workflow_run:
workflows:
- Build Linux Wheels
- Build Aarch64 Linux Wheels
- Build Windows Wheels
- Build M1 Wheels
types:
- completed

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.id }}
cancel-in-progress: false

jobs:
get-matrix:
if: ${{ github.repository == 'pytorch/audio' && github.event.workflow_run.event == 'push' && github.event.workflow_run.head_branch == 'nightly' && github.event.workflow_run.head_repository.full_name == github.repository }}
runs-on: ubuntu-22.04
permissions:
actions: read
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
architecture: ${{ steps.matrix.outputs.architecture }}
steps:
- name: Download the build matrix
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: build-matrix
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Read the build matrix
id: matrix
shell: bash
env:
WORKFLOW_NAME: ${{ github.event.workflow_run.name }}
run: |
set -euo pipefail
echo "matrix=$(jq -c . build-matrix.json)" >> "${GITHUB_OUTPUT}"
# The architecture in the artifact name, as the build workflows pass it
# to the upload (the macOS one passes none)
case "${WORKFLOW_NAME}" in
"Build Aarch64 Linux Wheels") echo "architecture=aarch64" >> "${GITHUB_OUTPUT}" ;;
"Build Windows Wheels") echo "architecture=x64" >> "${GITHUB_OUTPUT}" ;;
"Build M1 Wheels") echo "architecture=" >> "${GITHUB_OUTPUT}" ;;
*) echo "architecture=x86_64" >> "${GITHUB_OUTPUT}" ;;
esac

upload-r2:
needs: get-matrix
runs-on: ubuntu-22.04
environment: pytorchbot-env
timeout-minutes: 30
permissions:
actions: read
contents: read
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.get-matrix.outputs.matrix) }}
name: upload-r2-${{ matrix.build_name }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: pytorch/test-infra
ref: main
path: test-infra

- uses: ./test-infra/.github/actions/set-channel

- uses: ./test-infra/.github/actions/setup-binary-upload
with:
repository: pytorch/audio
ref: ""
python-version: ${{ matrix.python_version }}
cuda-version: ${{ matrix.desired_cuda }}
arch: ${{ needs.get-matrix.outputs.architecture }}
upload-to-base-bucket: ${{ matrix.upload_to_base_bucket }}

- name: Download the wheel
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ${{ env.ARTIFACT_NAME }}
path: pytorch/audio/dist/
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Upload package to R2
shell: bash
working-directory: pytorch/audio
env:
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: auto
run: |
set -ex
if [[ -z "${R2_ACCOUNT_ID}" || -z "${AWS_ACCESS_KEY_ID}" || -z "${AWS_SECRET_ACCESS_KEY}" ]]; then
echo "::error::R2 secrets are missing from the pytorchbot-env environment"
exit 1
fi

# shellcheck disable=SC1090
source "${BUILD_ENV_FILE}"

pip install awscli==1.32.18

PYTORCH_S3_BUCKET_PATH=${PYTORCH_S3_BUCKET_PATH/"s3://pytorch"/"s3://pytorch-downloads"}
for pkg in dist/*; do
shm_id=$(sha256sum "${pkg}" | awk '{print $1}')
aws s3 cp "$pkg" "${PYTORCH_S3_BUCKET_PATH}" \
--metadata "checksum-sha256=${shm_id}" --endpoint-url "https://${R2_ACCOUNT_ID}.r2.cloudflarestorage.com"
done
Loading