2222 key : pre-commit|${{ env.PYSHA }}|${{ hashFiles('.pre-commit-config.yaml') }}
2323 - name : dependencies
2424 run : |
25- pip install -U pre-commit twine setuptools wheel setuptools_scm[toml] ninst scikit-build
25+ pip install -U pre-commit
2626 sudo apt-get install -yqq clang-format
27- - run : PATHTOOLS=$HOME/NiftyPET_tools python setup.py sdist
28- - run : twine check dist/*
2927 - uses : reviewdog/action-setup@v1
3028 - name : comment
3129 run : |
@@ -42,19 +40,23 @@ jobs:
4240 - run : pre-commit run -a --show-diff-on-failure
4341 test :
4442 if : github.event_name != 'pull_request' || github.head_ref != 'devel'
45- runs-on : [self-hosted, cuda]
43+ runs-on : [self-hosted, cuda, python ]
4644 name : Test
4745 steps :
4846 - uses : actions/checkout@v2
4947 with :
5048 fetch-depth : 0
49+ - name : Run setup-python
50+ run : setup-python -p3.7 -m ${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}
5151 - run : pip install -U -e .[dev]
5252 - run : pytest
5353 - run : codecov
5454 env :
5555 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
56+ - name : Post Run setup-python
57+ run : setup-python -p3.7 -m ${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER} -r
58+ if : ${{ always() }}
5659 deploy :
57- if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
5860 needs : [check, test]
5961 name : PyPI Deploy
6062 runs-on : ubuntu-latest
@@ -63,22 +65,24 @@ jobs:
6365 with :
6466 fetch-depth : 0
6567 - uses : actions/setup-python@v2
66- with :
67- python-version : ' 3.x'
6868 - run : pip install -U twine setuptools wheel setuptools_scm[toml] ninst scikit-build
6969 - run : PATHTOOLS=$HOME/NiftyPET_tools python setup.py sdist
70- - run : twine upload dist/*
70+ - run : twine check dist/*
71+ - if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
72+ run : twine upload dist/*
7173 env :
7274 TWINE_USERNAME : __token__
7375 TWINE_PASSWORD : ${{ secrets.PYPI_TOKEN }}
7476 skip_existing : true
75- - id : collect_assets
77+ - if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
78+ id : collect_assets
7679 name : Collect assets
7780 run : |
7881 echo "::set-output name=asset_path::$(ls dist/*.tar.gz)"
7982 echo "::set-output name=asset_name::$(basename dist/*.tar.gz)"
8083 git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD > _CHANGES.md
81- - id : create_release
84+ - if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
85+ id : create_release
8286 uses : actions/create-release@v1
8387 env :
8488 GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
8791 release_name : nimpa ${{ github.ref }} beta
8892 body_path : _CHANGES.md
8993 draft : true
90- - uses : actions/upload-release-asset@v1
94+ - if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
95+ uses : actions/upload-release-asset@v1
9196 env :
9297 GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
9398 with :
0 commit comments