Skip to content
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

Improve CI with flake8 and isort #58

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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