Skip to content

ci: pyproject semantic 8 #125

ci: pyproject semantic 8

ci: pyproject semantic 8 #125

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
Quality:
strategy:
fail-fast: false
matrix:
python-version: [3.9]
poetry-version: [1.6.1]
os: [macos-latest]
runs-on: ${{ matrix.os }}
outputs:
coverage_percent: ${{ steps.coverage.outputs.coverage_percent }}
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 Poetry
uses: abatilo/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Set Poetry config
run: |
poetry config virtualenvs.in-project false
poetry config virtualenvs.path ~/.virtualenvs
- name: Install Dependencies
run: poetry install
- name: Lint with flake8
run: |
python -m poetry run flake8 . --count --show-source --statistics
- name: Test with pytest
id: coverage
run: |
python -m poetry run coverage run -m pytest
COVERAGE=$(poetry run coverage report | awk '$1 == "TOTAL" {print $NF+0}')
echo "::set-output name=coverage_percent::$COVERAGE"
Badge:
needs: Quality
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Create Coverage Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: c90a126b4e926b94c07a36ac78e9a9ad
filename: hebikani_coverage.json
label: coverage
message: ${{ needs.quality.outputs.coverage_percent }}
namedLogo: pytest
color: blue
logoColor: lightblue
Release:
needs: Quality
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):')
runs-on: ubuntu-latest
concurrency: release
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Python Semantic Release
uses: python-semantic-release/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
pypi:
needs: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- run: python3 -m pip install --upgrade build && python3 -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}