mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
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:
27
.github/workflows/linter.yml
vendored
27
.github/workflows/linter.yml
vendored
@@ -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
|
||||
|
||||
@@ -15,7 +15,7 @@ from pathlib import Path
|
||||
URL = 'https://github.com/systemd/mkosi'
|
||||
BRANCH = 'main' # We only want to ever use commits on upstream 'main' branch
|
||||
CONFIG = Path('mkosi/mkosi.conf')
|
||||
WORKFLOWS = [Path('.github/workflows/mkosi.yml'), Path('.github/workflows/coverage.yml')]
|
||||
WORKFLOWS = [Path('.github/workflows') / f for f in ['mkosi.yml', 'coverage.yml', 'linter.yml']]
|
||||
|
||||
def parse_args():
|
||||
p = argparse.ArgumentParser(
|
||||
|
||||
Reference in New Issue
Block a user