Skip to content

Commit

Permalink
feat: add pre-commit system for check Pythonic style
Browse files Browse the repository at this point in the history
  • Loading branch information
leynier committed Oct 18, 2021
1 parent bfc5fab commit 09f9b47
Show file tree
Hide file tree
Showing 5 changed files with 225 additions and 11 deletions.
14 changes: 4 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ jobs:
runs-on: ${{ matrix.os }}
# TODO(fedden): We need to discuss these steps: We could just use a test-supabase instance or we could update the docker image and use that for the tests.
steps:
- uses: actions/checkout@v2
- name: Clone Repository
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand All @@ -26,13 +27,6 @@ jobs:
uses: abatilo/actions-poetry@v2.1.0
with:
poetry-version: 1.1.2
- name: Install dependencies
run: poetry install
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build Docker image
run: |
cd infra
Expand All @@ -42,7 +36,7 @@ jobs:
uses: jakejarvis/wait-action@master
with:
time: "5s"
- name: Test with pytest
run: poetry run pytest --cov=./ --cov-report=xml -sx
- name: Run Tests
run: make tests
- name: Upload coverage
uses: codecov/codecov-action@v1
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: check-added-large-files
- id: mixed-line-ending
args: ['--fix=lf']

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.8.0
hooks:
- id: isort
args: ['--multi-line=3', '--trailing-comma', '--force-grid-wrap=0', '--use-parentheses', '--line-width=88']

- repo: https://github.com/humitos/mirrors-autoflake.git
rev: v1.1
hooks:
- id: autoflake
args: ['--in-place', '--remove-all-unused-imports']

- repo: https://github.com/ambv/black
rev: 21.5b1
hooks:
- id: black
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ build_sync:
if [ -d "gotrue/_sync" ]; then rm -r "gotrue/_sync"; fi
cp -r "build/lib/gotrue/_sync" "gotrue/_sync"
rm -r "build"

install:
poetry install

tests: install
poetry run pre-commit run --all-files
poetry run pytest --cov=./ --cov-report=xml -sx

0 comments on commit 09f9b47

Please sign in to comment.