Skip to content

Commit

Permalink
ci: Use pre-commit.ci and Ruff to lint project (#29)
Browse files Browse the repository at this point in the history
* ci: Use pre-commit CI to lint project

* Update type annotations
  • Loading branch information
edgarrmondragon authored Apr 13, 2023
1 parent 3197eeb commit 0c9b490
Show file tree
Hide file tree
Showing 12 changed files with 180 additions and 478 deletions.
29 changes: 3 additions & 26 deletions .github/workflows/ci_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,10 @@ name: Test tap-messagebird
on: [push]

jobs:
linting:

runs-on: ubuntu-latest
strategy:
matrix:
# Only lint using the primary version used for dev
python-version: [3.9]

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
run: |
python -m pip install --upgrade pip
pip install poetry==1.2.*
- name: Install dependencies
run: poetry install
- name: Run lint command from tox.ini
run: |
poetry run tox -e lint
pytest:

runs-on: ubuntu-latest
env:
PIP_CONSTRAINT: .github/workflows/constraints.txt
strategy:
matrix:
python-version: [3.9] #Don't want to hit the API for each version of Python
Expand All @@ -45,7 +22,7 @@ jobs:
- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry==1.2.*
pipx install poetry
- name: Install dependencies
run: |
poetry install
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pip==23.0.1
poetry==1.4.2
tox==4.4.11
40 changes: 40 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
ci:
autofix_commit_msg: '[pre-commit.ci] auto fixes'
autofix_prs: true
autoupdate_schedule: weekly
autoupdate_commit_msg: 'chore(deps): pre-commit autoupdate'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-json
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.261'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]

- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.2.0
hooks:
- id: mypy
pass_filenames: true
additional_dependencies:
- types-requests

- repo: https://github.com/pre-commit/pre-commit
rev: v3.2.2
hooks:
- id: validate_manifest
Loading

0 comments on commit 0c9b490

Please sign in to comment.