Skip to content

Commit

Permalink
Correct torch dependencies. Test PyPI before real upload to PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
albarji committed Aug 22, 2021
1 parent 791de3e commit 50077fe
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 2 deletions.
57 changes: 56 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,65 @@ name: Publish package on PyPI
on: [push]

jobs:
test-publish-package:
runs-on: ubuntu-latest
name: publish package on test-PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')

steps:
- uses: actions/checkout@v2

- name: Setup conda
uses: s-weigand/setup-conda@v1

- name: Get release tag
id: tag
uses: dawidd6/action-get-tag@v1

- name: Build package
run: |
python -m pip install --upgrade build &&
GITHUB_TAG=${{steps.tag.outputs.tag}} python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://test.pypi.org/legacy/
user: __token__
password: ${{ secrets.TESTPYPI_API_TOKEN }}

test-package-download:
runs-on: ubuntu-latest
name: test package works by installing from test-PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: test-publish-package

steps:
- uses: actions/checkout@v2

- name: Erase everything but tests folder
run: |
rm -rf docs guertena
- name: Setup conda
uses: s-weigand/setup-conda@v1

- name: Get release tag
id: tag
uses: dawidd6/action-get-tag@v1

- name: Install package
run: |
python -m pip install --index-url https://test.pypi.org/simple/ guertena==${{steps.tag.outputs.tag}}
- name: Run unit tests
run: |
conda install pytest && pytest tests
publish-package:
runs-on: ubuntu-latest
name: publish package on PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: test-package-download

steps:
- uses: actions/checkout@v2
Expand All @@ -20,7 +75,7 @@ jobs:

- name: Build package
run: |
python -m pip install --upgrade build &&
python -m pip install --upgrade build &&
GITHUB_TAG=${{steps.tag.outputs.tag}} python -m build
- name: Publish package
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
packages=['guertena'],
install_requires=[
'numpy>=1.20,<2',
'pytorch>=1.9,<2',
'torch>=1.9,<2',
'torchvision>=0.10,<1'
],
author="Alvaro Barbero",
Expand Down

0 comments on commit 50077fe

Please sign in to comment.