Build/Push Nightly Binary #824
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build/Push Nightly Binary | |
on: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
# Runs at midnight every day | |
- cron: '0 0 * * *' | |
# manual trigger | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash -l -eo pipefail {0} | |
jobs: | |
build_and_upload_wheel: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
python-version: 3.8 | |
python-tag: "py38" | |
- os: ubuntu-latest | |
python-version: 3.9 | |
python-tag: "py39" | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
miniconda-version: "latest" | |
activate-environment: build_binary | |
python-version: ${{ matrix.python-version }} | |
- name: Check conda info | |
run: conda info | |
- name: Check python version with conda | |
run: python --version | |
- name: Update pip | |
run: python -m pip install --upgrade pip | |
- name: Update build/packaging tools | |
run: python -m pip install --upgrade setuptools wheel twine | |
- name: Install dependencies | |
run: | | |
python -m pip install --pre torch torchvision torchaudio --extra-index-url \ | |
https://download.pytorch.org/whl/nightly/cpu | |
python -m pip install -r requirements.txt | |
- name: Test installation of dependencies | |
run: | | |
python -c "import torch" | |
echo "Import torch succeeded" | |
python -c "import torchvision" | |
echo "Import torchvision succeeded" | |
python -c "import torchaudio" | |
echo "Import torchaudio succeeded" | |
- name: Build torchmultimodal nightly | |
run: | | |
rm -r dist || true | |
python setup.py bdist_wheel --package_name torchmultimodal-nightly \ | |
--python-tag=${{ matrix.python-tag }} | |
- name: Install torchmultimodal nightly | |
run: python -m pip install dist/torchmultimodal*.whl | |
- name: Test torchmultimodal installation | |
# Go one-level up to avoid importing the source code | |
run: | | |
pushd ../ | |
python -c "import torchmultimodal" | |
popd | |
- name: Run unit tests against the installation | |
# import-model MUST be `append` to give precedence to the installed package | |
# rather than the source code | |
run: | | |
python -m pip install pytest pytest-mock pytest-cov | |
pytest tests --import-mode=append --junitxml=junit/test-results.xml \ | |
--cov-report=xml --cov-report=html --cov=. --durations=20 -vv | |
- name: Push wheel to PyPI | |
env: | |
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
python -m twine upload dist/torchmultimodal_nightly-*.whl \ | |
--username __token__ --password "$PYPI_API_TOKEN" \ | |
--skip-existing \ | |
--verbose |