Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions .github/workflows/python-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,15 @@ jobs:
${{ steps.setup.outputs.pr_number || github.event.pull_request.number || github.event.issue.number }}
with:
script: |
const includesPath = path => [
'scripts/', 'ci/', '.devcontainer/', '.github/format-tools/'
].some(prefix => path.startsWith(prefix)) || path === 'pyproject.toml';
const pythonSourcePath = path => path.endsWith('.py') && [
'scripts/', 'ci/', '.devcontainer/', 'plugins/python/python/', 'test/python/'
].some(prefix => path.startsWith(prefix));
const includesPath = path => pythonSourcePath(path) ||
path === 'docs/source/conf.py' ||
path.startsWith('.github/format-tools/') ||
path === 'pyproject.toml' ||
path === '.pre-commit-config.yaml' ||
/^\.github\/workflows\/.+\.ya?ml$/.test(path);
let relevant = true;
const changedPaths = [];
if (context.eventName === 'pull_request' || context.eventName === 'issue_comment') {
Expand Down Expand Up @@ -267,6 +273,15 @@ jobs:
ruff check --config "$RUNNER_TEMP/workflow-tools/pyproject.toml" .
continue-on-error: true

- name: Run ruff format check
id: ruff_format
working-directory: ${{ needs.setup.outputs.checkout_path }}
env:
FORCE_COLOR: 1
run: |
ruff format --config "$RUNNER_TEMP/workflow-tools/pyproject.toml" --check .
continue-on-error: true

- name: Run MyPy check
id: mypy
working-directory: ${{ needs.setup.outputs.checkout_path }}
Expand All @@ -276,13 +291,20 @@ jobs:
continue-on-error: true

- name: Evaluate Python checks result
if: always() && (steps.ruff.outcome != 'skipped' || steps.mypy.outcome != 'skipped')
if: >
always() && (
steps.ruff.outcome != 'skipped' ||
steps.ruff_format.outcome != 'skipped' ||
steps.mypy.outcome != 'skipped'
)
env:
REPO: ${{ needs.setup.outputs.repo }}
# yamllint disable rule:line-length
run: |
REPO_NAME="${REPO##*/}"
if [ "${{ steps.ruff.outcome }}" = 'success' ] && [ "${{ steps.mypy.outcome }}" = 'success' ]; then
if [ "${{ steps.ruff.outcome }}" = 'success' ] && \
[ "${{ steps.ruff_format.outcome }}" = 'success' ] && \
[ "${{ steps.mypy.outcome }}" = 'success' ]; then
echo "✅ Python checks passed."
else
echo "::error::Python checks failed. Comment '@${REPO_NAME}bot python-fix' on the PR to request a fix."
Expand Down
1 change: 1 addition & 0 deletions scripts/test/test_workflow_tooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ def test_lint_configuration_is_from_workflow_snapshot(self):
for name in ("python-check", "python-fix"):
content = (ROOT / f".github/workflows/{name}.yaml").read_text()
self.assertIn("$RUNNER_TEMP/workflow-tools/pyproject.toml", content)
self.assertNotIn("$GITHUB_WORKSPACE/workflow-tools/pyproject.toml", content)

def test_untrusted_formatter_workflows_disable_uv_cache(self):
"""Prevent source-processing jobs from writing reusable uv caches."""
Expand Down
Loading