Add cplint workflow support for minimal lint-only builds #7784
Workflow file for this run
This file contains 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: "p4c-lint" | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
merge_group: | |
branches: [main] | |
jobs: | |
p4c-lint: | |
runs-on: ubuntu-22.04 | |
env: | |
IMAGE_TYPE: test | |
CMAKE_ONLY: ON | |
CTEST_PARALLEL_LEVEL: 4 | |
ENABLE_GTESTS: ON | |
ENABLE_TOFINO: ON | |
ENABLE_TEST_TOOLS: ON | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/setup-python@v5 | |
- name: ccache | |
uses: hendrikmuhs/ccache-action@v1 | |
with: | |
key: apply-linters-${{ runner.os }} | |
max-size: 1000M | |
- name: Minimal Lint Setup | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y cmake g++ python3-pip clang-format | |
pip3 install -r requirements.txt | |
mkdir -p build && cd build | |
cmake .. -DCMAKE_LINT_ONLY=ON | |
- name: Run cpplint on C/C++ files. | |
run: cmake --build build --target cpplint | |
- name: Run clang-format on C/C++ files. | |
run: cmake --build build --target clang-format | |
- name: Run black and isort on Python files. | |
run: | | |
cmake --build build --target black | |
cmake --build build --target isort |