Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoens committed Sep 7, 2023
1 parent 14ca63b commit 4cced48
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/build-wheels-m1.yml
Original file line number Diff line number Diff line change
@@ -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-labs/tensordict
uses: pytorch/test-infra/.github/workflows/build_wheels_macos.yml@main
with:
repository: pytorch-labs/tensordict
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: tensordict
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 }}
81 changes: 81 additions & 0 deletions .github/workflows/nightly_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,87 @@ jobs:
pytest test/smoke_test.py -v --durations 200
exit $EXIT_STATUS
build-wheel-mac-m1:
# Don't run on forked repos.
if: github.repository_owner == 'pytorch-labs'
runs-on: osx-arm64
strategy:
matrix:
python_version: [["3.8", "3.8"], ["3.9", "3.9"], ["3.10", "3.10.3"], ["3.11", "3.11"]]
steps:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version[1] }}
architecture: x64
- name: Checkout tensordict
uses: actions/checkout@v2
- name: Install PyTorch nightly
run: |
python3 -mpip install --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/cpu
- name: Build tensordict Nightly
run: |
rm -r dist || true
export CC=clang CXX=clang++
python3 -mpip install wheel
python3 setup.py bdist_wheel \
--package_name tensordict-nightly \
--python-tag=${{ matrix.python-tag }}
- name: Upload wheel for the test-wheel job
uses: actions/upload-artifact@v2
with:
name: tensordict-mac-${{ matrix.python_version[0] }}.whl
path: dist/*.whl

test-wheel-mac-m1:
# Don't run on forked repos.
if: github.repository_owner == 'pytorch-labs'
needs: build-wheel-mac
runs-on: osx-arm64
strategy:
matrix:
python_version: [["3.8", "3.8"], ["3.9", "3.9"], ["3.10", "3.10.3"], ["3.11", "3.11"]]
steps:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version[1] }}
architecture: x64
- name: Checkout tensordict
uses: actions/checkout@v2
- name: Install PyTorch Nightly
run: |
python3 -mpip install --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/cpu
- name: Upgrade pip
run: |
python3 -mpip install --upgrade pip
- name: Install test dependencies
run: |
python3 -mpip install numpy pytest --no-cache-dir
- name: Download built wheels
uses: actions/download-artifact@v2
with:
name: tensordict-mac-${{ matrix.python_version[0] }}.whl
path: /tmp/wheels
- name: Install built wheels
run: |
python3 -mpip install /tmp/wheels/*
- name: Log version string
run: |
# Avoid ambiguity of "import tensordict" by deleting the source files.
rm -rf tensordict/
python3 -c "import tensordict; print(tensordict.__version__)"
- name: Run tests
run: |
set -e
export IN_CI=1
mkdir test-reports
python -m torch.utils.collect_env
python -c "import tensordict; print(tensordict.__version__);from tensordict.nn import TensorDictModule"
EXIT_STATUS=0
pytest test/smoke_test.py -v --durations 200
exit $EXIT_STATUS
upload-wheel-linux:
# Don't run on forked repos.
if: github.repository_owner == 'pytorch-labs'
Expand Down

0 comments on commit 4cced48

Please sign in to comment.