lint #1599
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: lint | |
| on: | |
| push: | |
| pull_request: | |
| types: [opened, reopened, synchronize, labeled, unlabeled] | |
| schedule: | |
| - cron: '34 17 * * *' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| check_skip: | |
| uses: ./.github/workflows/check_skip_ci.yml | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| issues: read | |
| lint: | |
| name: Run make lint and pilot on ${{ matrix.os }} | |
| needs: [check_skip] | |
| if: | | |
| needs.check_skip.outputs.skip != 'true' && ( | |
| github.event_name == 'pull_request' || | |
| (github.event_name == 'push' && | |
| (vars.MMGH_PUSH_RUN_BRANCH == '*' || | |
| contains(vars.MMGH_PUSH_RUN_BRANCH, github.ref_name))) || | |
| (github.event_name == 'schedule' && vars.MMGH_NIGHTLY == 'enable')) | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: ${{ fromJSON(vars.MMGH_TIMEOUT_LINT || '45') }} | |
| env: | |
| JOB_MAKE_ARGS: VERBOSE=1 BUILD_QT=ON USE_CLANG_TIDY=ON LINT_AS_ERRORS=ON | |
| # Cap parallelism. The github-hosted runners have only 3 (macOS) / 4 | |
| # (ubuntu) virtual cores shared with co-tenant VMs, so letting NPROC | |
| # auto-detect oversubscribes memory and CPU; on the 7 GB arm64 macOS | |
| # runner clang-tidy then OOMs. NPROC drives both MAKE_PARALLEL (build) | |
| # and the lint targets (cformat xargs, flake8 --jobs), so capping it | |
| # here bounds every parallel step. 2 is the safe bet on both runners. | |
| NPROC: 2 | |
| QT_DEBUG_PLUGINS: 1 | |
| # QT_QPA_PLATFORM is set per-OS by the setup actions (xcb on Linux via | |
| # Xvfb, offscreen on macOS). Do not set it at the job level. | |
| PIP_BREAK_SYSTEM_PACKAGES: 1 # disabling PEP668 (for MacOS runner) | |
| # Fix issue: https://github.com/solvcon/solvcon/issues/366 | |
| # Use custom config for jurplel/install-qt-action@v4 | |
| AQT_CONFIG: "thirdparty/aqt_settings.ini" | |
| strategy: | |
| matrix: | |
| # https://github.com/actions/runner-images/blob/main/images/macos/macos-26-Readme.md | |
| # macos-26 is arm64 with 7 GB RAM; parallelism is capped via NPROC | |
| # in the env block above so clang-tidy does not OOM. | |
| os: [ubuntu-24.04, macos-26] | |
| cmake_build_type: [Debug] | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: ${{ github.event_name == 'pull_request' && 100 || 1 }} | |
| - name: event name | |
| run: | | |
| echo "github.event_name: ${{ github.event_name }}" | |
| - name: setup dependencies for Linux | |
| if: runner.os == 'Linux' | |
| uses: ./.github/actions/setup_linux | |
| with: | |
| workflow: 'lint' | |
| - name: setup dependencies for macOS | |
| if: runner.os == 'macOS' | |
| uses: ./.github/actions/setup_macos | |
| with: | |
| workflow: 'lint' | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@v1.2.23 | |
| with: | |
| key: ${{ runner.os }}-tidy-${{ matrix.cmake_build_type }} | |
| restore-keys: ${{ runner.os }}-tidy-${{ matrix.cmake_build_type }} | |
| create-symlink: true | |
| - name: make cformat (clang-format check) | |
| run: | | |
| echo "::group::make cformat" | |
| make cformat | |
| echo "::endgroup::" | |
| - name: make cinclude (check_include) | |
| run: | | |
| echo "::group::make cinclude" | |
| make cinclude | |
| echo "::endgroup::" | |
| - name: make checkascii (check ASCII-only characters) | |
| run: | | |
| echo "::group::make checkascii" | |
| make checkascii | |
| echo "::endgroup::" | |
| - name: make checktws (check trailing whitespace) | |
| run: | | |
| echo "::group::make checktws" | |
| make checktws | |
| echo "::endgroup::" | |
| - name: make flake8 | |
| run: | | |
| echo "::group::make flake8" | |
| make flake8 | |
| echo "::endgroup::" | |
| - name: make pilot | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| echo "::group::make pilot" | |
| make pilot \ | |
| ${JOB_MAKE_ARGS} \ | |
| CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \ | |
| CMAKE_ARGS="-DPYTHON_EXECUTABLE=$(which python3)" | |
| echo "::endgroup::" | |
| - name: make run_pilot_pytest | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| echo "::group::make run_pilot_pytest" | |
| export LD_LIBRARY_PATH=$(python3 -c "import sys, os, shiboken6; sys.stdout.write(os.path.dirname(shiboken6.__file__))") | |
| make run_pilot_pytest \ | |
| ${JOB_MAKE_ARGS} \ | |
| CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \ | |
| CMAKE_ARGS="-DPYTHON_EXECUTABLE=$(which python3)" | |
| echo "::endgroup::" | |
| - name: make pilot_clang_tidy_diff | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| make pilot_clang_tidy_diff \ | |
| ${JOB_MAKE_ARGS} \ | |
| CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \ | |
| CMAKE_ARGS="-DPYTHON_EXECUTABLE=$(which python3) -DCMAKE_EXPORT_COMPILE_COMMANDS=ON" \ | |
| SOLVCON_DIFF_BASE=${{ github.event.pull_request.base.sha }} | |
| - name: make pilot_clang_tidy_diff with Python library path | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| export LD_LIBRARY_PATH=$(python3 -c "import sys, os, shiboken6; sys.stdout.write(os.path.dirname(shiboken6.__file__))") | |
| make pilot_clang_tidy_diff \ | |
| ${JOB_MAKE_ARGS} \ | |
| CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \ | |
| CMAKE_ARGS="-DPYTHON_EXECUTABLE=$(which python3) -DCMAKE_EXPORT_COMPILE_COMMANDS=ON" \ | |
| SOLVCON_DIFF_BASE=${{ github.event.pull_request.base.sha }} | |
| send_email_on_failure: | |
| needs: [lint] | |
| # Run if any of the dependencies failed in master branch | |
| if: ${{ always() && contains(needs.*.result, 'failure') && github.ref_name == 'master' && github.event.repository.fork == false }} | |
| uses: ./.github/workflows/send_email_on_fail.yml | |
| with: | |
| job_results: | | |
| - lint: ${{ needs.lint.result }} | |
| secrets: | |
| EMAIL_USERNAME: ${{ secrets.EMAIL_USERNAME }} | |
| EMAIL_PASSWORD: ${{ secrets.EMAIL_PASSWORD }} |