-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving from Travis to GitHub actions * Add GitHub actions to build package * Change Python versions to 3.x * Use pytest instead of nose * Drop 3.4 testing and test uploading of results * Test junit reporting * Move Pypi to use secret keys * Add skip_existing flag for dev deployments * Update test results dir * Add production deployment (Should only run on master branch and tagged commits) * Only run production on tagged commits v2
- Loading branch information
Showing
2 changed files
with
87 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Build, Test and Release Python Package | ||
|
||
on: | ||
push: | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
# Currently Ubuntu 20.04 | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.5", "3.6", "3.7", "3.8", "3.9", "3.10"] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install . | ||
python -m pip install pytest | ||
- name: Test with pytest | ||
run: | | ||
python -m pytest --doctest-modules --junitxml junit/test-results-${{ matrix.python-version }}.xml | ||
- name: Publish pytest test results | ||
uses: mikepenz/action-junit-report@v2 | ||
with: | ||
report_paths: junit/test-results*.xml | ||
# Use always() to always run this step to publish test results when there are test failures | ||
if: ${{ always() }} | ||
|
||
deploy-test: | ||
runs-on: ubuntu-latest | ||
environment: Development | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
# Build on the latest version of Python | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
- name: Build package | ||
run: python -m build --sdist --wheel | ||
- name: Publish package to Test PyPI | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.DEV_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
skip_existing: true | ||
|
||
deploy-production: | ||
runs-on: ubuntu-latest | ||
environment: Production | ||
if: startsWith(github.ref, 'refs/tags') | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
# Build on the latest version of Python | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
- name: Build package | ||
run: python -m build --sdist --wheel | ||
- name: Publish package to PyPi | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PROD_PYPI_API_TOKEN }} |
This file was deleted.
Oops, something went wrong.