ci: Use mkosi in linter workflow

Let's reuse the mkosi tools tree to get all the tools we need instead
of pulling them from pypi.
This commit is contained in:
Daan De Meyer
2025-04-23 15:27:49 +02:00
parent 98a8117eb9
commit 9e3d048bd0
2 changed files with 18 additions and 11 deletions
+17 -10
View File
@@ -36,29 +36,36 @@ jobs:
VALIDATE_ALL_CODEBASE: false
VALIDATE_GITHUB_ACTIONS: true
- uses: systemd/mkosi@dbb4020beee2cdf250f93a425794f1cf8b0fe693
- name: Check that tabs are not used in Python code
run: sh -c '! git grep -P "\\t" -- src/boot/generate-hwids-section.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py'
- name: Install ruff and mypy
- name: Build tools tree
run: |
python3 -m pip install --break-system-packages --upgrade setuptools wheel pip
python3 -m pip install --break-system-packages mypy types-Pillow ruff
tee mkosi/mkosi.local.conf <<EOF
[Build]
ToolsTreeDistribution=fedora
ToolsTreeRelease=rawhide
EOF
mkosi -f sandbox -- true
- name: Run mypy
run: |
python3 -m mypy --version
python3 -m mypy src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py
mkosi sandbox -- mypy --version
mkosi sandbox -- mypy src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py
- name: Run ruff check
run: |
ruff --version
ruff check src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py
mkosi sandbox -- ruff --version
mkosi sandbox -- ruff check src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py
- name: Run ruff format
run: |
ruff --version
if ! ruff format --check src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py
mkosi sandbox -- ruff --version
if ! mkosi sandbox -- ruff format --check src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py
then
echo "Please run 'ruff format' on the above files or apply the diffs below manually"
ruff format --check --quiet --diff src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py
mkosi sandbox -- ruff format --check --quiet --diff src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py
fi