Refactor testbed (Part 27) #3022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Check code style | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
changes: | |
name: Detect changes | |
runs-on: ubuntu-24.04 | |
outputs: | |
cpp: ${{ steps.filter.outputs.cpp }} | |
python: ${{ steps.filter.outputs.python }} | |
cfg: ${{ steps.filter.outputs.cfg }} | |
md: ${{ steps.filter.outputs.md }} | |
yaml: ${{ steps.filter.outputs.yaml }} | |
toml: ${{ steps.filter.outputs.toml }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Determine supported Python versions | |
id: python_version | |
run: echo "python_version=$(sed s/,//g python/.version-python)" >> $GITHUB_OUTPUT | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ steps.python_version.outputs.python_version }} | |
check-latest: true | |
- name: Detect changes | |
uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
build_files: &build_files | |
- '.github/workflows/test_format.yml' | |
- 'build' | |
- 'build.bat' | |
- 'build_system/main.py' | |
- 'build_system/core/**' | |
- 'build_system/util/**' | |
- 'build_system/targets/*.py' | |
- 'build_system/targets/code_style/*' | |
cpp: | |
- *build_files | |
- 'build_system/targets/code_style/cpp/*' | |
- '.cpplint.cfg' | |
- '**/*.hpp' | |
- '**/*.cpp' | |
python: | |
- *build_files | |
- 'build_system/targets/code_style/python/*' | |
- '.cython-lint.toml' | |
- '**/*.py' | |
cfg: | |
- *build_files | |
- 'build_system/targets/code_style/cfg/*' | |
- '**/*.cfg' | |
md: | |
- *build_files | |
- 'build_system/targets/code_style/markdown/*' | |
- '**/*.md' | |
yaml: | |
- *build_files | |
- 'build_system/targets/code_style/yaml/*' | |
- '**/*.y*ml' | |
toml: | |
- *build_files | |
- 'build_system/targets/code_style/toml/*' | |
- '**/*.toml' | |
test_format_cpp: | |
needs: changes | |
if: ${{ needs.changes.outputs.cpp == 'true' }} | |
name: Check C++ source files | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Determine supported Python versions | |
id: python_version | |
run: echo "python_version=$(sed s/,//g python/.version-python)" >> $GITHUB_OUTPUT | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ steps.python_version.outputs.python_version }} | |
check-latest: true | |
- name: Check C++ source files | |
run: ./build test_format_cpp | |
test_format_python: | |
needs: changes | |
if: ${{ needs.changes.outputs.python == 'true' }} | |
name: Check Python source files | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Determine supported Python versions | |
id: python_version | |
run: echo "python_version=$(sed s/,//g python/.version-python)" >> $GITHUB_OUTPUT | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ steps.python_version.outputs.python_version }} | |
check-latest: true | |
- name: Check Python source files | |
run: ./build test_format_python | |
test_format_cfg: | |
needs: changes | |
if: ${{ needs.changes.outputs.cfg == 'true' }} | |
name: Check .cfg files | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Determine supported Python versions | |
id: python_version | |
run: echo "python_version=$(sed s/,//g python/.version-python)" >> $GITHUB_OUTPUT | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ steps.python_version.outputs.python_version }} | |
check-latest: true | |
- name: Check .cfg files | |
run: ./build test_format_cfg | |
test_format_md: | |
needs: changes | |
if: ${{ needs.changes.outputs.md == 'true' }} | |
name: Check Markdown files | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Determine supported Python versions | |
id: python_version | |
run: echo "python_version=$(sed s/,//g python/.version-python)" >> $GITHUB_OUTPUT | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ steps.python_version.outputs.python_version }} | |
check-latest: true | |
- name: Check Markdown files | |
run: ./build test_format_md | |
test_format_yaml: | |
needs: changes | |
if: ${{ needs.changes.outputs.yaml == 'true' }} | |
name: Check YAML files | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Determine supported Python versions | |
id: python_version | |
run: echo "python_version=$(sed s/,//g python/.version-python)" >> $GITHUB_OUTPUT | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ steps.python_version.outputs.python_version }} | |
check-latest: true | |
- name: Check YAML files | |
run: ./build test_format_yaml | |
test_format_toml: | |
needs: changes | |
if: ${{ needs.changes.outputs.toml == 'true' }} | |
name: Check TOML files | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Determine supported Python versions | |
id: python_version | |
run: echo "python_version=$(sed s/,//g python/.version-python)" >> $GITHUB_OUTPUT | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ steps.python_version.outputs.python_version }} | |
check-latest: true | |
- name: Check TOML files | |
run: ./build test_format_toml |