release test #34
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
name: Test and Release | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
Quality: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.9" | |
- name: Configure poetry & Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry && poetry install | |
- name: View poetry version | |
run: poetry --version | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Security Analysis with bandit | |
run: | | |
# stop pipeline if level 3 vulnerability found | |
poetry run bandit -r -lll ./nekton ./tests | |
- name: Submodules Setup | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Test with pytest | |
run: | | |
poetry run python -m pytest -v tests | |
Release: | |
needs: Quality | |
# https://github.community/t/how-do-i-specify-job-dependency-running-in-another-workflow/16482 | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && !contains(github.event.head_commit.message, 'chore(release):') | |
runs-on: ubuntu-latest | |
concurrency: release | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Submodules Setup | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
# This action uses Python Semantic Release v8 | |
- name: Python Semantic Release | |
id: release | |
uses: python-semantic-release/python-semantic-release@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
root_options: '-vv' | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
# NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true. | |
# See https://github.com/actions/runner/issues/1173 | |
if: steps.release.outputs.released == 'true' | |
- name: Publish package distributions to GitHub Releases | |
uses: python-semantic-release/upload-to-gh-release@main | |
if: steps.release.outputs.released == 'true' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |