-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
329 additions
and
127 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,245 @@ | ||
name: Unit Testing, Coverage Collection, Package, Release, Documentation and Publish | ||
|
||
on: [ push ] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
UnitTesting: | ||
name: ${{ matrix.icon }} Unit Tests using Python ${{ matrix.python }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- {python: 3.6, icon: 🔴} | ||
- {python: 3.7, icon: 🟠} | ||
- {python: 3.8, icon: 🟡} | ||
- {python: 3.9, icon: 🟢} | ||
|
||
env: | ||
PYTHON: ${{ matrix.python }} | ||
outputs: | ||
python: ${{ env.PYTHON }} | ||
|
||
steps: | ||
- name: ⏬ Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: 🐍 Setup Python ${{ matrix.python }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: 🔧 Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r tests/requirements.txt | ||
- name: ☑ Run unit tests | ||
run: | | ||
python -m pytest -rA tests/unit | ||
Coverage: | ||
name: 📈 Collect Coverage Data using Python 3.9 | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
PYTHON: 3.9 | ||
outputs: | ||
python: ${{ env.PYTHON }} | ||
|
||
steps: | ||
- name: ⏬ Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: 🐍 Setup Python ${{ env.PYTHON }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.PYTHON }} | ||
|
||
- name: 🗂 Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r tests/requirements.txt | ||
- name: Collect coverage | ||
continue-on-error: true | ||
run: | | ||
python -m pytest -rA --cov=.. --cov-config=tests/.coveragerc tests/unit | ||
- name: Convert to cobertura format | ||
run: | | ||
coverage xml | ||
- name: 📊 Publish coverage at CodeCov | ||
continue-on-error: true | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
file: ./coverage.xml | ||
flags: unittests | ||
env_vars: PYTHON | ||
|
||
- name: 📉 Publish coverage at Codacy | ||
continue-on-error: true | ||
uses: codacy/codacy-coverage-reporter-action@master | ||
with: | ||
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | ||
coverage-reports: ./coverage.xml | ||
|
||
Release: | ||
name: 📝 Create 'Release Page' on GitHub | ||
runs-on: ubuntu-latest | ||
|
||
if: startsWith(github.ref, 'refs/tags') | ||
needs: | ||
- UnitTesting | ||
- Coverage | ||
|
||
env: | ||
PYTHON: ${{ needs.Coverage.outputs.python }} | ||
outputs: | ||
python: ${{ env.PYTHON }} | ||
tag: ${{ steps.getVariables.outputs.gitTag }} | ||
version: ${{ steps.getVariables.outputs.version }} | ||
datetime: ${{ steps.getVariables.outputs.datetime }} | ||
upload_url: ${{ steps.createReleasePage.outputs.upload_url }} | ||
|
||
steps: | ||
- name: 🔁 Extract Git tag from GITHUB_REF | ||
id: getVariables | ||
run: | | ||
GIT_TAG=${GITHUB_REF#refs/*/} | ||
RELEASE_VERSION=${GIT_TAG#v} | ||
RELEASE_DATETIME="$(date --utc '+%d.%m.%Y - %H:%M:%S')" | ||
# write to step outputs | ||
echo ::set-output name=gitTag::${GIT_TAG} | ||
echo ::set-output name=version::${RELEASE_VERSION} | ||
echo ::set-output name=datetime::${RELEASE_DATETIME} | ||
- name: 📑 Create Release Page | ||
id: createReleasePage | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.getVariables.outputs.gitTag }} | ||
# release_name: ${{ steps.getVariables.outputs.gitTag }} | ||
body: | | ||
**Automated Release created on: ${{ steps.getVariables.outputs.datetime }}** | ||
# New Features | ||
* tbd | ||
# Changes | ||
* tbd | ||
# Bug Fixes | ||
* tbd | ||
draft: false | ||
prerelease: false | ||
|
||
Package: | ||
name: 📦 Package in Wheel Format | ||
runs-on: ubuntu-latest | ||
|
||
if: startsWith(github.ref, 'refs/tags') | ||
needs: | ||
- Coverage | ||
|
||
env: | ||
PYTHON: ${{ needs.Coverage.outputs.python }} | ||
ARTIFACT: pyGenericPath-wheel | ||
outputs: | ||
python: ${{ env.PYTHON }} | ||
artifact: ${{ env.ARTIFACT }} | ||
|
||
steps: | ||
- name: 📥 Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: 🐍 Setup Python ${{ env.PYTHON }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.PYTHON }} | ||
|
||
- name: 🔧 Install dependencies for packaging and release | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install wheel | ||
- name: 🔨 Build Python package (source distribution) | ||
run: | | ||
python setup.py sdist | ||
- name: 🔨 Build Python package (binary distribution - wheel) | ||
run: | | ||
python setup.py bdist_wheel | ||
- name: 📤 Upload 'pyGenericPath' artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ env.ARTIFACT }} | ||
path: dist/ | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
PublishOnPyPI: | ||
name: 🚀 Publish to PyPI | ||
runs-on: ubuntu-latest | ||
|
||
if: startsWith(github.ref, 'refs/tags') | ||
needs: | ||
- Package | ||
|
||
env: | ||
PYTHON: ${{ needs.Package.outputs.python }} | ||
ARTIFACT: ${{ needs.Package.outputs.artifact }} | ||
outputs: | ||
python: ${{ env.PYTHON }} | ||
artifact: ${{ env.ARTIFACT }} | ||
|
||
steps: | ||
- name: 📥 Download artifacts '${{ env.ARTIFACT }}' from 'Package' job | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: ${{ env.ARTIFACT }} | ||
path: dist/ | ||
|
||
- name: 🐍 Setup Python ${{ env.PYTHON }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.PYTHON }} | ||
|
||
- name: ⚙ Install dependencies for packaging and release | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install wheel twine | ||
- name: ⤴ Release Python package to PyPI | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
run: | | ||
twine upload dist/* | ||
ArtifactCleanUp: | ||
name: 🗑️ Artifact Cleanup | ||
runs-on: ubuntu-latest | ||
|
||
needs: | ||
- Package | ||
- PublishOnPyPI | ||
|
||
env: | ||
ARTIFACT: ${{ needs.Package.outputs.artifact }} | ||
|
||
steps: | ||
- name: 🗑️ Delete all Artifacts | ||
uses: geekyeggo/delete-artifact@v1 | ||
with: | ||
name: | | ||
${{ env.ARTIFACT }} |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Oops, something went wrong.