Skip to content

Commit 13bc56e

Browse files
committed
[ci] add clang-tidy code analysis (WIP)
1 parent 8fecb0b commit 13bc56e

2 files changed

Lines changed: 61 additions & 2 deletions

File tree

.ci/tidy_script.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
#!/usr/bin/env bash
22

3-
set -ex
3+
set -e
4+
5+
echo "Running $0"
6+
7+
WORKSPACE="${GITHUB_WORKSPACE:-${PWD}}"
8+
echo "Setting WORKSPACE to $WORKSPACE"
9+
10+
mkdir -v -p "${WORKSPACE}/ROOT-CI/src" "${WORKSPACE}/ROOT-CI/build"
11+
12+
echo "Hello, World"
13+
exit 0
414

515
CLANG_TIDY_CHECKS='-*'
616
if [[ $TOOL == clang-tidy-analyzer ]]; then

.github/workflows/code_analysis.yml

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
2424
runs-on: ubuntu-latest
2525
env:
26-
TRAVIS_BRANCH: ${{ github.base_ref }}
26+
TRAVIS_BRANCH: ${{ github.base_ref }}
2727
TRAVIS_PULL_REQUEST_REPO: ${{ github.event.pull_request.head.repo.html_url }}
2828
TRAVIS_PULL_REQUEST_BRANCH: ${{ github.head_ref }}
2929
BASE_COMMIT: ${{ github.event.pull_request.base.sha }}
@@ -48,6 +48,55 @@ jobs:
4848
PATH=/usr/lib/llvm-20/bin:${PATH}
4949
.ci/format_script.sh
5050
51+
clang-tidy:
52+
# For any event that is not a PR, the CI will always run. In PRs, the CI
53+
# can be skipped if the tag [skip-ci] is written in the title.
54+
if: |
55+
(github.repository_owner == 'root-project' && github.event_name != 'pull_request') ||
56+
(github.event_name == 'pull_request' && !(
57+
contains(github.event.pull_request.title, '[skip-ci]') ||
58+
contains(github.event.pull_request.labels.*.name, 'skip ci') ||
59+
contains(github.event.pull_request.labels.*.name, 'skip code analysis')
60+
))
61+
62+
runs-on:
63+
- self-hosted
64+
- linux
65+
- x64
66+
67+
container:
68+
image: registry.cern.ch/root-ci/alma10:buildready
69+
options: '--security-opt label=disable --rm'
70+
env:
71+
OS_APPLICATION_CREDENTIAL_ID: '7f5b64a265244623a3a933308569bdba'
72+
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
73+
OS_AUTH_TYPE: 'v3applicationcredential'
74+
OS_AUTH_URL: 'https://keystone.cern.ch/v3'
75+
OS_IDENTITY_API_VERSION: 3
76+
OS_INTERFACE: 'public'
77+
OS_REGION_NAME: 'cern'
78+
PYTHONUNBUFFERED: true
79+
80+
env:
81+
TRAVIS_BRANCH: ${{ github.base_ref }}
82+
TRAVIS_PULL_REQUEST_REPO: ${{ github.event.pull_request.head.repo.html_url }}
83+
TRAVIS_PULL_REQUEST_BRANCH: ${{ github.head_ref }}
84+
BASE_COMMIT: ${{ github.event.pull_request.base.sha }}
85+
86+
steps:
87+
- uses: actions/checkout@v6
88+
with:
89+
fetch-depth: 1
90+
ref: ${{ github.event.pull_request.head.sha }}
91+
path: ROOT-CI/src
92+
- name: Fetch base sha
93+
run: cd ROOT-CI/src && git fetch --depth=1 origin +${{github.event.pull_request.base.sha}}:origin/base_sha
94+
- name: Determine merge base
95+
run: echo "MERGE_BASE=$(cd ROOT-CI/src && git merge-base ${{ github.event.pull_request.base.sha }} HEAD)" >> $GITHUB_ENV
96+
- name: run clang-tidy script
97+
run: |
98+
ROOT-CI/src/.ci/tidy_script.sh
99+
51100
ruff:
52101
if: |
53102
(github.repository_owner == 'root-project' && github.event_name != 'pull_request') ||

0 commit comments

Comments
 (0)