Skip to content

Commit

Permalink
Build in CI, split deploy, save artifacts. (#25)
Browse files Browse the repository at this point in the history
* Build in CI, split deploy, save artifacts.

Build package in CI to catch bugs before making a release.

Split deploy workflow into two jobs: build and deploy. Also push
wheel/package to GitHub release.

* fix copy/paste oversights
  • Loading branch information
Robpol86 authored Nov 16, 2021
1 parent f86e313 commit 23300d9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- {name: Run tests, run: make test}
- {name: Run integration tests, run: make it}
- {name: Build docs, run: make docs}
- {name: Build package, run: make build}
- name: Upload coverage
uses: codecov/codecov-action@v1.5.0
with: {name: "coverage-${{runner.os}}-py${{steps.py.outputs.python-version}}"}
25 changes: 16 additions & 9 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,30 @@ on:

jobs:

publish:
name: Publish to PyPI
build:
name: Build
runs-on: ubuntu-latest
steps:
- {name: Check out repository code, uses: actions/checkout@v2}
- {name: Install Python, uses: actions/setup-python@v2, with: {python-version: "3.10"}}
- {name: Install Poetry, uses: abatilo/actions-poetry@v2.1.4}
- {name: Copy LICENSE to COPYING, run: cp --no-clobber --verbose LICENSE COPYING} # For Python wheel.
- {name: Build package, run: make build}
- name: Publish Python distribution to PyPI
- name: Store artifacts
uses: actions/upload-artifact@v2
with: {name: dist, path: dist/, if-no-files-found: error}

publish:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
steps:
- {name: Fetch packages, uses: actions/download-artifact@v2, with: {name: dist, path: dist}}
- name: Publish packages to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
# - name: Publish package to TestPyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
- name: Upload packages to Release
uses: svenstaro/upload-release-action@v2
with: {file: dist/*, file_glob: true, repo_token: "${{ secrets.GITHUB_TOKEN }}", tag: "${{ github.ref }}"}

0 comments on commit 23300d9

Please sign in to comment.