name: Quality checks C++ # Reusable workflow (ADR-0008). A repository calls it with # # jobs: # quality: # uses: TirSystem/github-action/.gitea/workflows/quality-checks-cpp.yml@v1 # # It checks the C and C++ files of the repository with clang-format and # clang-tidy at exact versions, changes no file and needs no secret. The # repository needs a .clang-format; a .clang-tidy and a compile database # (compile-commands-dir) are optional. on: workflow_call: inputs: working-directory: description: "Directory, relative to the repository root, whose files are checked" type: string default: "." std: description: "C++ standard for clang-tidy when no compile database is given, such as c++20" type: string default: "c++20" compile-commands-dir: description: "Directory with a compile_commands.json built by the caller before the call; empty uses the std input" type: string default: "" clang-format-version: description: "Exact version of the clang-format package" type: string default: "23.1.3" clang-tidy-version: description: "Exact version of the clang-tidy package" type: string default: "22.1.8" tools-ref: description: "Tag or branch of TirSystem/github-action whose tools/quality-checks-cpp.sh is run; pin it to the exact tag together with the workflow" type: string default: "v1" jobs: quality-checks-cpp: permissions: contents: read runs-on: ubuntu-latest env: WORKING_DIRECTORY: ${{ inputs.working-directory }} STD: ${{ inputs.std }} COMPILE_COMMANDS_DIR: ${{ inputs.compile-commands-dir }} CLANG_FORMAT_VERSION: ${{ inputs.clang-format-version }} CLANG_TIDY_VERSION: ${{ inputs.clang-tidy-version }} QC_VENV: /tmp/quality-tools steps: - name: Check out the repository uses: actions/checkout@v4 - name: Fetch the shared script uses: actions/checkout@v4 with: repository: TirSystem/github-action ref: ${{ inputs.tools-ref }} path: shared-scripts - name: Validate the inputs run: bash shared-scripts/tools/quality-checks-cpp.sh validate - name: Install the tools run: bash shared-scripts/tools/quality-checks-cpp.sh install - name: Run the checks run: bash shared-scripts/tools/quality-checks-cpp.sh run