-
Notifications
You must be signed in to change notification settings - Fork 862
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build and test python wheel with github actions (#687)
* try to build with github actions
- Loading branch information
Showing
2 changed files
with
128 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Build and test the python package | ||
on: | ||
push: | ||
branches: | ||
- 'releases/**' | ||
jobs: | ||
build: | ||
name: Build whl from source | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Install pypa/build | ||
run: >- | ||
python -m | ||
pip install | ||
build wheel | ||
--user | ||
- name: Build a binary wheel and a source tarball | ||
run: | | ||
echo `pwd` | ||
echo `git log|head -n 50` | ||
python setup.py -q sdist bdist_wheel --universal | ||
- name: Archive production artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: dist-pip-whl | ||
path: | | ||
dist | ||
test-the-wheel: | ||
name: Install whl and run demo | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Dump GitHub context | ||
id: github_context_step | ||
run: echo '${{ toJSON(github) }}' | ||
|
||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Download the whl | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: dist-pip-whl | ||
|
||
- name: Install tensorboardX from whl | ||
run: pip install tensorboardX*.whl | ||
|
||
- name: Install torch torchvision for demo | ||
run: pip install torch torchvision | ||
|
||
- name: Print version | ||
run: python -c "import tensorboardX; print(tensorboardX.__version__)" | ||
|
||
- name: Run examples | ||
run: | | ||
cd examples | ||
python demo.py | ||
- name: Archive demo artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: demo-results | ||
path: | | ||
examples/runs | ||
upload-to-pypi: | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
name: Upload to pypi if tagged with version | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Dump GitHub context | ||
id: github_context_step | ||
run: echo '${{ toJSON(github) }}' | ||
|
||
# upload: | ||
# if: startsWith('github.ref', 'refs/tags/v') | ||
# name: Publish a Python distribution to PyPI test site | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - name: Set up Python 3.9 | ||
# uses: actions/setup-python@v2 | ||
# with: | ||
# python-version: 3.9 | ||
# | ||
# - name: Install pypa/build | ||
# run: >- | ||
# python -m | ||
# pip install | ||
# build wheel | ||
# --user | ||
# | ||
# - name: Build a binary wheel and a source tarball | ||
# run: | | ||
# echo `pwd` | ||
# python setup.py -q sdist bdist_wheel --universal | ||
# | ||
# - name: Publish to Test PyPI | ||
# uses: pypa/gh-action-pypi-publish@release/v1 | ||
# with: | ||
# password: ${{ secrets.PYPI_API_TESTSITE }} | ||
# repository_url: https://test.pypi.org/legacy/ | ||
|
||
|
||
# - name: Publish to Test PyPI | ||
# uses: pypa/gh-action-pypi-publish@release/v1 | ||
# with: | ||
# password: ${{ secrets.PYPI_API_TESTSITE }} | ||
# repository_url: https://test.pypi.org/legacy/ | ||
# |
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