mirror of
https://github.com/bec-project/ophyd_devices.git
synced 2025-06-24 03:38:00 +02:00
61 lines
1.7 KiB
YAML
61 lines
1.7 KiB
YAML
name: Formatter and Pylint jobs
|
|
on: [workflow_call]
|
|
jobs:
|
|
|
|
Formatter:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.13'
|
|
|
|
- name: Run black and isort
|
|
run: |
|
|
pip install black isort
|
|
pip install -e .[dev]
|
|
black --check --diff --color .
|
|
isort --check --diff ./
|
|
Pylint:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.13'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install pylint pylint-exit anybadge
|
|
|
|
- name: Run Pylint
|
|
run: |
|
|
mkdir -p ./pylint
|
|
set +e
|
|
pylint ./${{ github.event.repository.name }} --output-format=text > ./pylint/pylint.log
|
|
pylint-exit $?
|
|
set -e
|
|
|
|
- name: Extract Pylint Score
|
|
id: score
|
|
run: |
|
|
SCORE=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' ./pylint/pylint.log)
|
|
echo "score=$SCORE" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create Badge
|
|
run: |
|
|
anybadge --label=Pylint --file=./pylint/pylint.svg --value="${{ steps.score.outputs.score }}" 2=red 4=orange 8=yellow 10=green
|
|
|
|
- name: Upload Artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: pylint-artifacts
|
|
path: |
|
|
# ./pylint/pylint.log # not sure why this isn't working
|
|
./pylint/pylint.svg |