Skip to content

Commit

Permalink
Fixed package tests
Browse files Browse the repository at this point in the history
  • Loading branch information
albarji committed Aug 22, 2021
1 parent 5274e98 commit 27c800f
Showing 1 changed file with 24 additions and 26 deletions.
50 changes: 24 additions & 26 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,45 +30,46 @@ jobs:
user: __token__
password: ${{ secrets.TESTPYPI_API_TOKEN }}

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

steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: |
conda env update --file environment.yml --name base
- 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
- name: Build package
run: |
python -m pip install --index-url https://test.pypi.org/simple/ --no-deps guertena==${{steps.tag.outputs.tag}}
python -m pip install --upgrade build &&
GITHUB_TAG=${{steps.tag.outputs.tag}} python -m build
- name: Run unit tests
run: |
conda install pytest && pytest tests
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

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

steps:
- uses: actions/checkout@v2
- name: Download tests
uses: actions/checkout@v2

- name: Erase source code
run: |
rm -rf docs guertena
- name: Setup conda
uses: s-weigand/setup-conda@v1
Expand All @@ -77,13 +78,10 @@ jobs:
id: tag
uses: dawidd6/action-get-tag@v1

- name: Build package
- name: Install package
run: |
python -m pip install --upgrade build &&
GITHUB_TAG=${{steps.tag.outputs.tag}} python -m build
python -m pip install guertena==${{steps.tag.outputs.tag}}
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Run unit tests
run: |
conda install pytest && pytest tests

0 comments on commit 27c800f

Please sign in to comment.