Skip to content

Commit

Permalink
Merge pull request #409 from kiyoon/ci/ruff-format
Browse files Browse the repository at this point in the history
ci: ruff format, isort, and lint
  • Loading branch information
sobolevnrm authored Nov 30, 2024
2 parents e355d88 + ddbb03c commit be4e943
Show file tree
Hide file tree
Showing 51 changed files with 402 additions and 754 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/check-styles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Check ruff format and isort applied correctly

name: Style checking

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
ruff-format:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install ruff
run: |
pip3 install ruff --break-system-packages
- name: Run ruff
run: |
set +e # Do not exit shell on ruff failure
out=$(ruff format --check --diff . 2> app_stderr.txt)
exit_code=$?
err=$(<app_stderr.txt)
# Display the raw output in the step
echo "${out}"
echo "${err}"
# Display the Markdown output in the job summary
{ echo "\`\`\`diff"; echo "${out}"; echo "${err}"; echo "\`\`\`"; } >> "$GITHUB_STEP_SUMMARY"
# Exit with the exit-code returned by ruff
exit ${exit_code}
ruff-isort:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install ruff
run: |
pip3 install ruff --break-system-packages
- name: Run ruff
run: |
set +e # Do not exit shell on ruff failure
out=$(ruff check --select I --diff . 2> app_stderr.txt)
exit_code=$?
err=$(<app_stderr.txt)
# Display the raw output in the step
echo "${out}"
echo "${err}"
# Display the Markdown output in the job summary
{ echo "\`\`\`diff"; echo "${out}"; echo "${err}"; echo "\`\`\`"; } >> "$GITHUB_STEP_SUMMARY"
# Exit with the exit-code returned by ruff
exit ${exit_code}
14 changes: 6 additions & 8 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
if: "!contains(github.event.head_commit.message, 'noci')"
strategy:
matrix:
python-version: ["3.11"]
python-version: ['3.11']

steps:
- uses: actions/checkout@v4
Expand All @@ -26,18 +26,16 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black flake8 pytest coverage
pip install -e .
pip install -e .[test]
- name: Lint with flake8
pip install -e '.[test]'
- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
ruff check . --config=ruff_essential.toml --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --statistics
ruff check . --exit-zero --statistics
- name: Test with pytest and coverage
run: |
coverage run --source=pdb2pqr -m pytest
coverage run -m pytest
coverage report -m | tee coverage.txt
coverage html
- name: Upload coverage results
Expand Down
Loading

0 comments on commit be4e943

Please sign in to comment.