-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI Overhaul #6
base: master
Are you sure you want to change the base?
CI Overhaul #6
Changes from all commits
60b90c5
f8cf897
d4eb4c2
f4e73c0
aef2cf4
1e177cc
da6a6b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[flake8] | ||
# B = bugbear | ||
# B9 = bugbear opinions | ||
# BLK = black style warnings | ||
# C = mccabe code complexity | ||
# E = pycodestyle errors | ||
# F = pyflakes errors | ||
# I = isort style warnings | ||
# W = pycodestyle warnings | ||
select = B,B9,BLK,C,E,F,W | ||
# B904 = within an `except` clause, raise exceptions with `raise ... from err` | ||
# E203 = slice notation whitespace, invalid | ||
# E501 = line length, handled by bugbear B950 | ||
# W503 = bin op line break, invalid | ||
ignore = B904, E203, E501, W503 | ||
# up to 88 allowed by bugbear B950 | ||
max-line-length = 80 | ||
max-complexity = 18 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
categories: | ||
- title: ':boom: Breaking Changes' | ||
label: 'breaking' | ||
- title: ':package: Build System' | ||
label: 'build' | ||
- title: ':construction_worker: Continuous Integration' | ||
label: 'ci' | ||
- title: ':books: Documentation' | ||
label: 'documentation' | ||
- title: ':rocket: Features' | ||
label: 'enhancement' | ||
- title: ':beetle: Fixes' | ||
label: 'bug' | ||
- title: ':racehorse: Performance' | ||
label: 'performance' | ||
- title: ':hammer: Refactoring' | ||
label: 'refactoring' | ||
- title: ':fire: Removals and Deprecations' | ||
label: 'removal' | ||
- title: ':lipstick: Style' | ||
label: 'style' | ||
- title: ':rotating_light: Testing' | ||
label: 'testing' | ||
template: | | ||
## What’s Changed | ||
|
||
$CHANGES |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't gotten a ton of use out of this personally but it's an easy add and I like it in theory. Described here. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Release Drafter | ||
on: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
draft_release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: release-drafter/release-drafter@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Release | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.8' | ||
architecture: x64 | ||
- run: pip install nox poetry | ||
- run: nox --python 3.8 | ||
- run: poetry build | ||
- run: poetry publish --username=__token__ --password=${{ secrets.PYPI_TOKEN }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You'll need to set up a PyPI API token in GitHub but this will allow you to release to PyPI with a Github release. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Test | ||
on: [push] | ||
jobs: | ||
tests: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
python-version: ['3.9', '3.8', '3.7'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not testing past |
||
os: [ubuntu-latest] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may want to eventually add |
||
name: Test - Python ${{ matrix.python-version }} - ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: x64 | ||
- name: Install Root Dependencies | ||
run: pip install nox poetry | ||
- name: Run Nox Sessions | ||
run: nox --python ${{ matrix.python-version }} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mostly just modernizing this. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
exclude: > | ||
(?x)( | ||
\.mypy_cache/ | ||
| \.pytest_cache/ | ||
| \.venv/ | ||
| build/ | ||
| dist/ | ||
| \S+\.egg-info/ | ||
) | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: check-toml | ||
- id: check-json | ||
- id: pretty-format-json | ||
args: ["--autofix"] | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
args: ["--markdown-linebreak-ext=md"] | ||
- repo: local | ||
hooks: | ||
- id: isort | ||
name: isort | ||
entry: poetry run isort | ||
types: [python] | ||
language: system | ||
- id: black | ||
name: black | ||
entry: poetry run black | ||
types: [python] | ||
language: system | ||
- id: flake8 | ||
name: flake8 | ||
entry: poetry run flake8 | ||
types: [python] | ||
language: system | ||
- id: mypy | ||
name: mypy | ||
entry: poetry run mypy | ||
types: [python] | ||
language: system |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you have an attachment to Travis CI, feel free to keep using it! This proposal would switch to GH Actions though. |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[![Build Status](https://travis-ci.org/bourbaki-py/introspection.svg?branch=master)](https://travis-ci.org/bourbaki-py/introspection) | ||
[![Coverage Status](https://coveralls.io/repos/github/bourbaki-py/introspection/badge.svg?branch=master)](https://coveralls.io/github/bourbaki-py/introspection?branch=master) | ||
[![Coverage Status](https://coveralls.io/repos/github/bourbaki-py/introspection/badge.svg?branch=master)](https://coveralls.io/github/bourbaki-py/introspection?branch=master) |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Namespaces don't need to be declared anymore. |
This file was deleted.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure why this deletion diff got left behind on the |
This file was deleted.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really like |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
"""Nox sessions.""" | ||
import nox | ||
from nox.sessions import Session | ||
|
||
nox.options.sessions = "lint", "mypy", "tests" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned in the |
||
|
||
PACKAGE = "bourbaki-introspection" | ||
LOCATIONS = "src", "tests", "./noxfile.py" | ||
PYTHON = "3.9" | ||
PYTHONS = ["3.9", "3.8", "3.7"] | ||
|
||
|
||
# Formatting | ||
|
||
|
||
@nox.session(python=PYTHON) | ||
def isort(session: Session) -> None: | ||
"""Run isort import formatter.""" | ||
args = session.posargs or LOCATIONS | ||
session.run("poetry", "install", "--only", "isort", external=True) | ||
session.run("isort", *args) | ||
|
||
|
||
@nox.session(python=PYTHON) | ||
def black(session: Session) -> None: | ||
"""Run black code formatter.""" | ||
args = session.posargs or LOCATIONS | ||
session.run("poetry", "install", "--only", "black", external=True) | ||
session.run("black", *args) | ||
|
||
|
||
# Linting | ||
|
||
|
||
@nox.session(python=PYTHONS) | ||
def lint(session: Session) -> None: | ||
"""Lint using flake8.""" | ||
args = session.posargs or LOCATIONS | ||
session.run("poetry", "install", "--only", "lint", external=True) | ||
session.run("flake8", *args) | ||
|
||
|
||
# Typechecking | ||
|
||
|
||
@nox.session(python=PYTHONS) | ||
def mypy(session: Session) -> None: | ||
"""Type-check using mypy.""" | ||
args = session.posargs or LOCATIONS | ||
session.run("poetry", "install", "--only", "main,mypy", external=True) | ||
session.run("mypy", *args) | ||
|
||
|
||
# Testing | ||
|
||
|
||
@nox.session(python=PYTHONS) | ||
def tests(session: Session) -> None: | ||
"""Run the test suite.""" | ||
args = session.posargs or ["-rxs", "--cov"] | ||
session.run("poetry", "install", "--only", "main,test", external=True) | ||
session.run("pytest", *args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm having
flake8
checkblack
andisort
formatting because I prefer to haveflake8
statically check formatting rather than running Git modifying code in CI, although the difference is pretty arbitrary.