From 27c800f8c1509c72d1f5208855e806ced269d17e Mon Sep 17 00:00:00 2001 From: albarji Date: Sun, 22 Aug 2021 20:50:18 +0200 Subject: [PATCH] Fixed package tests --- .github/workflows/publish.yml | 50 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f4734c1..aed41fb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -30,22 +30,15 @@ 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 @@ -53,22 +46,30 @@ jobs: 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 @@ -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