Merge pull request #10 from WildMeOrg/build-test #60
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: Wheel | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build_wheels: | |
name: Build on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: [3.8] | |
steps: | |
- name: Checkout code | |
uses: nschloe/[email protected] | |
with: | |
exclude: "scoutbot/*/models/pytorch/" | |
- uses: actions/setup-python@v2 | |
name: Install Python | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Build wheel | |
run: | | |
pip install --upgrade pip | |
pip install build | |
python -m build --wheel --outdir dist/ . | |
- uses: actions/upload-artifact@v2 | |
with: | |
path: ./dist/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: nschloe/[email protected] | |
with: | |
exclude: "scoutbot/*/models/pytorch/" | |
- uses: actions/setup-python@v2 | |
name: Install Python | |
with: | |
python-version: '3.8' | |
- name: Build sdist | |
run: | | |
pip install --upgrade pip | |
pip install build | |
python -m build --sdist --outdir dist/ . | |
- uses: actions/upload-artifact@v2 | |
with: | |
path: ./dist/*.tar.gz | |
test_wheel: | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
env: | |
WIC_BATCH_SIZE: 16 | |
# test wheel | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/setup-python@v2 | |
name: Install Python | |
with: | |
python-version: '3.8' | |
- uses: actions/download-artifact@v2 | |
with: | |
name: artifact | |
path: dist | |
- name: Install wheel | |
run: | | |
pip install --upgrade pip | |
pip install wheel | |
pip install dist/*.whl | |
- name: Test module | |
run: | | |
python -c "import scoutbot; scoutbot.fetch(); scoutbot.example();" | |
- name: Test CLI | |
run: | | |
scoutbot fetch | |
scoutbot example | |
upload_pypi: | |
needs: [test_wheel] | |
runs-on: ubuntu-latest | |
# upload to PyPI on every tag starting with 'v' | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/download-artifact@v2 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_PASSWORD }} | |
# To test: repository_url: https://test.pypi.org/legacy/ |