Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: switch from Travis CI to GitHub Actions
- Loading branch information
1 parent
753be63
commit ba1b1fb
Showing
6 changed files
with
127 additions
and
51 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,118 @@ | ||
name: Continuous Integration | ||
|
||
env: | ||
TERM: screen-256color | ||
|
||
on: | ||
pull_request: | ||
branches: ["master", "main"] | ||
paths-ignore: ["docs/**"] | ||
|
||
push: | ||
branches: ["master", "main"] | ||
paths-ignore: ["docs/**"] | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
|
||
# Runs all steps on the VM | ||
test: | ||
|
||
runs-on: ubuntu-20.04 | ||
|
||
strategy: | ||
matrix: | ||
python-version: [3.6, 3.7, 3.8, 3.9] | ||
|
||
steps: | ||
|
||
- name: Checkout Code Repository | ||
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 | ||
pip install tox tox-gh-actions | ||
pip install codecov | ||
- name: "Run tox targets for Python ${{ matrix.python-version }}" | ||
run: | | ||
tox | ||
- name: Upload Coverage to Codecov | ||
uses: "codecov/codecov-action@v2" | ||
with: | ||
fail_ci_if_error: true | ||
|
||
# Runs all steps on the VM | ||
# Deploy to PyPI & create a GitHub Release when the test job succeeds, and only on pushes to tags. | ||
deploy: | ||
|
||
needs: test | ||
|
||
if: needs.test.result == 'success' && startsWith( github.ref, 'refs/tags/v' ) | ||
|
||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Checkout Code Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements_dev.txt | ||
- name: Build Package | ||
run: | | ||
invoke dist | ||
- name: Publish 🐍 distribution 📦 to Test PyPI | ||
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: Publish 🐍 distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
verbose: true | ||
|
||
- name: Get the version | ||
id: get_version | ||
run: | | ||
echo "${{ github.ref }}" | ||
echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | ||
- name: Generate Release Title | ||
id: get_release_title | ||
shell: bash | ||
run: | | ||
export TODAY="($(TZ=Africa/Lusaka date --iso))" | ||
echo ::set-output name=RELEASE_NAME::"${{ steps.get_version.outputs.VERSION }} $TODAY" | ||
- name: Extract Release Notes | ||
# This creates a file LATEST_RELEASE_NOTES.md in the parent directory (../) | ||
run: | | ||
invoke get-release-notes | ||
- name: GitHub Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: ${{ steps.get_release_title.outputs.RELEASE_NAME }} | ||
body_path: ../LATEST_RELEASE_NOTES.md | ||
files: dist/* |
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
This file was deleted.
Oops, something went wrong.
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
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
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