Use different clang-tidy CI job that can run on non-PR branches #24
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: Run C++ Tests | |
on: | |
push: | |
branches: | |
- main | |
- 'maint/maint*' | |
pull_request: | |
branches: '**' | |
jobs: | |
build: | |
name: Lint ICU4C C++ executor | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read # change to write for thread comments | |
# metadata: read # for thread comments | |
# pull-requests: write # for pull request reviews | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup deps, etc. # install JSON-C, download ICU4C binaries if not present | |
run: | | |
bash setup.sh | |
sudo apt-get install libicu-dev | |
- name: Run clang-tidy | |
run: | | |
pushd executors/cpp | |
clang-tidy *.cpp --config-file="clang-tidy-config.yml" -p . | |
# Optionally generate compile_commands.json | |
# Run clang-tidy | |
# Note: when running locally at the command line, use the equivalent | |
# command when in the directory `executors/cpp`: | |
# clang-tidy *.cpp --fix-errors --config-file="clang-tidy-config.yml" -p . | |
# Note: you must run setup.sh and also run install_icu4c_binary.sh (for a given ICU4C version) first | |
# before running the above clang-tidy command | |
- uses: cpp-linter/cpp-linter-action@v2 | |
with: | |
repo-root: "./executors/cpp" | |
style: 'file' # Use .clang-format config file | |
tidy-checks: '' # Use .clang-tidy config file | |
# not enough permissions in default GITHUB_TOKEN to post on public fork PRs | |
# thread-comments: ${{ github.event_name == 'pull_request' && 'update' }} | |
# extra-args: '--config-file="clang-tidy-config.yml" -p=.' | |
id: linter | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# If there are any comments, fail the check | |
- if: steps.linter.outputs.checks-failed > 0 | |
run: exit 1 |