Skip to content

Commit

Permalink
style: Bump pre-commit hooks and update mypy config (#25)
Browse files Browse the repository at this point in the history
As well as update GitHub actions to use & remove commitizen check from
CI workflow.
  • Loading branch information
playpauseandstop authored Nov 3, 2020
1 parent 40b42af commit 90ab997
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 56 deletions.
49 changes: 4 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ on:
branches: ["master"]

env:
COMMITIZEN_VERSION: "2.4.1"
COVERALLS_VERSION: "2.1.2"
DEV_PYTHON_VERSION: "3.9"
POETRY_VERSION: "1.1.4"
Expand All @@ -21,46 +20,7 @@ env:
TWINE_VERSION: "3.2.0"

jobs:
commitizen:
name: "Check commit message"

runs-on: "ubuntu-latest"

steps:
- uses: "actions/checkout@v2.3.3"

- name: "Fetch ${{ github.base_ref }}"
if: "github.event_name == 'pull_request'"
run: |
set -e
git fetch --depth=1 origin +refs/heads/${{ github.base_ref }}:refs/heads/${{ github.base_ref }}
git fetch --prune --unshallow
- name: "Install Python"
if: "!startsWith(github.ref, 'refs/tags/')"
uses: "actions/setup-python@v2.1.4"
with:
python-version: "${{ env.DEV_PYTHON_VERSION }}"

- name: "Install commitizen"
if: "!startsWith(github.ref, 'refs/tags/')"
run: "pip install commitizen==${{ env.COMMITIZEN_VERSION }}"

- name: "Check pull request commit messages"
if: "github.event_name == 'pull_request'"
run: |
set -e
for commit in $(git log --pretty=%H ${{ github.base_ref }}..HEAD); do
echo "Checking commit: ${commit}"
cz check -m "$(git log -1 --pretty=%B ${commit})"
done
- name: "Check last commit message"
if: "github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/tags/')"
run: 'cz check -m "$(git log -1 --pretty=%B)"'

dev:
needs: ["commitizen"]
name: "Verify package is installed well"

strategy:
Expand All @@ -70,7 +30,7 @@ jobs:
runs-on: "${{ matrix.os }}"

steps:
- uses: "actions/checkout@v2.3.3"
- uses: "actions/checkout@v2.3.4"

- name: "Install Python"
uses: "actions/setup-python@v2.1.4"
Expand Down Expand Up @@ -101,7 +61,6 @@ jobs:
run: "poetry run badabump-ci --help"

test:
needs: ["commitizen"]
name: "Python ${{ matrix.python-version }}"

strategy:
Expand All @@ -111,7 +70,7 @@ jobs:
runs-on: "ubuntu-latest"

steps:
- uses: "actions/checkout@v2.3.3"
- uses: "actions/checkout@v2.3.4"

- name: "Install Python"
uses: "actions/setup-python@v2.1.4"
Expand Down Expand Up @@ -151,7 +110,7 @@ jobs:
runs-on: "ubuntu-latest"

steps:
- uses: "actions/checkout@v2.3.3"
- uses: "actions/checkout@v2.3.4"

- name: "Install Python"
uses: "actions/setup-python@v2.1.4"
Expand Down Expand Up @@ -186,7 +145,7 @@ jobs:
runs-on: "ubuntu-latest"

steps:
- uses: "actions/checkout@v2.3.3"
- uses: "actions/checkout@v2.3.4"

- name: "Fetch git data"
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: "ubuntu-latest"

steps:
- uses: "actions/checkout@v2.3.3"
- uses: "actions/checkout@v2.3.4"
with:
ref: "master"

Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
run: "poetry run python3 -m badabump --ci ${{ github.event.inputs.args }}"

- id: "token"
uses: "tibdex/github-app-token@v1.1.0"
uses: "tibdex/github-app-token@v1.1.1"
with:
app_id: "${{ secrets.BADABUMP_APP_ID }}"
private_key: "${{ secrets.BADABUMP_APP_PRIVATE_KEY }}"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:

steps:
- id: "token"
uses: "tibdex/github-app-token@v1.1.0"
uses: "tibdex/github-app-token@v1.1.1"
with:
app_id: "${{ secrets.BADABUMP_APP_ID }}"
private_key: "${{ secrets.BADABUMP_APP_PRIVATE_KEY }}"

- uses: "actions/checkout@v2.3.3"
- uses: "actions/checkout@v2.3.4"
with:
token: "${{ steps.token.outputs.token }}"
ref: "master"
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_language_version:
minimum_pre_commit_version: "1.17.0"
repos:
- repo: "https://github.com/commitizen-tools/commitizen"
rev: "v2.4.1"
rev: "v2.4.2"
hooks:
- id: "commitizen"
# By default commitizen using `python3` instead `python` language, so
Expand Down Expand Up @@ -31,7 +31,7 @@ repos:
- "black==20.8b1"

- repo: "https://github.com/pre-commit/pre-commit-hooks"
rev: "v3.2.0"
rev: "v3.3.0"
hooks:
- id: "end-of-file-fixer"
- id: "trailing-whitespace"
Expand All @@ -46,10 +46,10 @@ repos:
name: "Lint code (flake8)"
additional_dependencies: &flake8_additional_dependencies
- "flake8==3.8.4"
- "flake8-broken-line==0.2.1"
- "flake8-broken-line==0.3.0"
- "flake8-bugbear==20.1.4"
- "flake8-builtins==1.5.3"
- "flake8-comprehensions==3.2.3"
- "flake8-comprehensions==3.3.0"
- "flake8-eradicate==1.0.0"
- "flake8-import-order==0.18.1"
- "flake8-mutable==1.2.0"
Expand All @@ -74,5 +74,5 @@ repos:
hooks:
- id: "mypy"
name: "Lint code (mypy)"
args: ["--python-executable=.venv/bin/python3"]
args: ["--python-executable=./.venv/bin/python3"]
exclude: ^docs/.*$
4 changes: 3 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ disallow_untyped_decorators = True
disallow_untyped_defs = True
follow_imports = normal
follow_imports_for_stubs = True
ignore_missing_imports = True
ignore_missing_imports = False
mypy_path = ./src/
namespace_packages = True
python_executable = ./.venv/bin/python3
show_column_numbers = True
show_error_codes = True
warn_redundant_casts = True
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ badabump-ci = "badabump.cli.ci_app:main"
"Bug Tracker" = "https://github.com/playpauseandstop/badabump/issues"

[tool.pytest.ini_options]
minversion = "6.1.1"
minversion = "6.1.2"
testpaths = ["tests/"]
addopts = "--cov --no-cov-on-fail"
log_level = "info"
Expand Down

0 comments on commit 90ab997

Please sign in to comment.