🎨 fix isort and black related issues #2108
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code quality | |
on: [push] | |
jobs: | |
isort: | |
name: Import sorting (isort) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up environment | |
uses: maykinmedia/setup-django-backend@v1 | |
with: | |
python-version: '3.10' | |
setup-node: 'no' | |
- uses: isort/[email protected] | |
with: | |
requirementsFiles: requirements/ci.txt | |
sortPaths: "src" | |
configuration: '--check-only --diff' | |
black: | |
name: Code formatting (black) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up environment | |
uses: maykinmedia/setup-django-backend@v1 | |
with: | |
python-version: '3.10' | |
setup-node: 'no' | |
- name: Run black | |
run: | | |
black --check src | |
flake8: | |
name: Code style (flake8) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up environment | |
uses: maykinmedia/setup-django-backend@v1 | |
with: | |
python-version: '3.10' | |
setup-node: 'no' | |
- name: Run flake8 | |
id: flake8 | |
run: | | |
flake8 src 2>&1 | tee flake8_output.txt | |
result_code=${PIPESTATUS[0]} | |
report="$(cat flake8_output.txt)" | |
report="${report//$'\n'/'%0A'}" # escape newlines | |
echo "FLAKE8_REPORT=${report}" >> $GITHUB_OUTPUT | |
exit $result_code | |
- name: Emit flake8 flake8 output | |
if: ${{ failure() }} | |
run: | | |
echo "${{ steps.flake8.outputs.FLAKE8_REPORT }}" | |
echo 'flake8 found some issues' >> $GITHUB_STEP_SUMMARY | |
echo '' >> $GITHUB_STEP_SUMMARY | |
echo '| File | Line | Column | Issue |' >> $GITHUB_STEP_SUMMARY | |
echo '| :--- | ---- | ------ | :---- |' >> $GITHUB_STEP_SUMMARY | |
python ./bin/flake8_summary.py "${{ steps.flake8.outputs.FLAKE8_REPORT }}" >> $GITHUB_STEP_SUMMARY |