mirror of
https://github.com/github/codeql.git
synced 2026-02-12 21:21:16 +01:00
Turns out this is important for the black formatting tool to work correctly. The formatting won't generally change between python versions (it only depends on `black`'s version), but the formatted code needs to be parseable by the system python version. One script uses ```python def foo[T](x: T) -> T: ``` syntax, which is only supported in Python 3.12 and later. Running `pre-commit` will now require a python 3.12 installation (which is already what we mandate for internal developer environment setup). The error in case of absence of such a version is pretty clear though.
36 lines
824 B
YAML
36 lines
824 B
YAML
name: Python tooling
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- "misc/bazel/**"
|
|
- "misc/codegen/**"
|
|
- "misc/scripts/models-as-data/bulk_generate_mad.py"
|
|
- "*.bazel*"
|
|
- .github/workflows/codegen.yml
|
|
- .pre-commit-config.yaml
|
|
branches:
|
|
- main
|
|
- rc/*
|
|
- codeql-cli-*
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
check-python-tooling:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
- uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507
|
|
name: Check that python code is properly formatted
|
|
with:
|
|
extra_args: black --all-files
|
|
- name: Run codegen tests
|
|
shell: bash
|
|
run: |
|
|
bazel test //misc/codegen/...
|