Skip to content

Commit

Permalink
improve CI with flake8 and isort (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
submarcos authored Dec 7, 2023
1 parent 7c10ca8 commit bd0da65
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
30 changes: 28 additions & 2 deletions .github/workflows/release.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Release
name: CI workflow

on:
pull_request:
Expand All @@ -25,6 +25,32 @@ env:
LANG: C.UTF-8

jobs:
flake8:
runs-on: ubuntu-latest
continue-on-error: true
name: Check flake8 rules
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install flake8
run: pip install flake8
- run: flake8 convertit

isort:
runs-on: ubuntu-latest
continue-on-error: true
name: Check flake8 rules
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install isort
run: pip install isort
- run: isort -c convertit

build:
runs-on: ubuntu-latest
continue-on-error: true
Expand Down Expand Up @@ -172,7 +198,7 @@ jobs:
deploy:
name: Publish (on release only)
runs-on: ubuntu-latest
needs: [ e2e ]
needs: [ flake8, isort, e2e ]
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 1 addition & 3 deletions convertit/tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ def test_x_forwarded_for_replacement(self):
mock_req.read.return_value = self.odt_data()
mock_urlopen.return_value = mock_req
resp = self.testapp.get('/', params={'url': url}, status=302,
headers={
'X_FORWARDED_FOR': x_forwarded_for
})
headers={'X_FORWARDED_FOR': x_forwarded_for})
mock_urlopen.assert_called_once_with(expected_url)
filename = os.path.basename(resp.location)
filepath = os.path.join(settings['convertit.converted_path'],
Expand Down
6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ domain = convertit
input_file = convertit/locale/convertit.pot
output_dir = convertit/locale
previous = true

[flake8]
ignore = E501,W503

[isort]
profile=black
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
'mock',
'coverage',
'freezegun',
'flake8',
'isort'
]


Expand Down

0 comments on commit bd0da65

Please sign in to comment.