diff --git a/.github/scripts/pre_build_script_m1.sh b/.github/scripts/pre_build_script_m1.sh new file mode 100644 index 00000000000..d309e316134 --- /dev/null +++ b/.github/scripts/pre_build_script_m1.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +python3 -mpip install git+https://github.com/pytorch-labs/tensordict.git diff --git a/.github/workflows/build-wheels-m1.yml b/.github/workflows/build-wheels-m1.yml new file mode 100644 index 00000000000..e9350fd1393 --- /dev/null +++ b/.github/workflows/build-wheels-m1.yml @@ -0,0 +1,42 @@ +name: Build M1 Wheels + +on: + pull_request: + push: + branches: + - nightly + - main + - release/* + tags: + # NOTE: Binary build pipelines should only get triggered on release candidate builds + # Release candidate tags look like: v1.11.0-rc1 + - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ + workflow_dispatch: + +jobs: + generate-matrix: + uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main + with: + package-type: wheel + os: macos-arm64 + test-infra-repository: pytorch/test-infra + test-infra-ref: main + build: + needs: generate-matrix + name: pytorch/rl + uses: pytorch/test-infra/.github/workflows/build_wheels_macos.yml@main + with: + repository: pytorch/rl + ref: "" + test-infra-repository: pytorch/test-infra + test-infra-ref: main + build-matrix: ${{ needs.generate-matrix.outputs.matrix }} + pre-script: .github/scripts/pre_build_script_m1.sh + post-script: "" + package-name: torchrl + runner-type: macos-m1-12 + smoke-test-script: "" + trigger-event: ${{ github.event_name }} + secrets: + AWS_PYTORCH_UPLOADER_ACCESS_KEY_ID: ${{ secrets.AWS_PYTORCH_UPLOADER_ACCESS_KEY_ID }} + AWS_PYTORCH_UPLOADER_SECRET_ACCESS_KEY: ${{ secrets.AWS_PYTORCH_UPLOADER_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index ca3075e7baa..3c0d5796b13 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -84,6 +84,47 @@ jobs: name: torchrl-batch.whl path: dist/*.whl + build-wheel-m1: + runs-on: macos-m1-12 + strategy: + matrix: + python_version: [["3.8", "3.8"], ["3.9", "3.9"], ["3.10", "3.10.3"], ["3.11", "3.11"]] + steps: + - name: Checkout torchrl + uses: actions/checkout@v2 + - uses: conda-incubator/setup-miniconda@v2 + with: + python-version: ${{ matrix.python-version[1] }} + - name: Binary Build in Conda Environment + run: | + set -euxo pipefail + conda clean --all --quiet --yes + conda create \ + --yes \ + --quiet \ + -n buildenv \ + python=${{ matrix.python_version[1] }} + + conda activate buildenv + + # Install PyTorch RC + python3 -mpip install torch --extra-index-url https://download.pytorch.org/whl/cpu + + # Build Wheel + export CC=clang CXX=clang++ + python3 -mpip install wheel + BUILD_VERSION=0.1.1 python3 setup.py bdist_wheel + - name: Upload wheel for the test-wheel job + uses: actions/upload-artifact@v2 + with: + name: torchrl-mac-${{ matrix.python_version[0] }}.whl + path: dist/torchrl-*.whl + - name: Upload wheel for download + uses: actions/upload-artifact@v2 + with: + name: torchrl-batch.whl + path: dist/*.whl + build-wheel-windows: runs-on: windows-latest strategy: