Skip to content

Commit 8d216a1

Browse files
committed
codechecker
Signed-off-by: Anas Nashif <[email protected]>
1 parent 168c79c commit 8d216a1

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

.github/workflows/codechecker.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Codechecker
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- v*-branch
7+
- collab-*
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
Codechecker:
17+
if: github.repository_owner == 'zephyrproject-rtos'
18+
runs-on:
19+
group: test-runner-v2-linux-x64-4xlarge
20+
container:
21+
image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026
22+
options: '--entrypoint /bin/bash'
23+
env:
24+
CCACHE_DIR: /node-cache/ccache-zephyr
25+
CCACHE_REMOTE_STORAGE: "redis://cache-*.keydb-cache.svc.cluster.local|shards=1,2,3"
26+
CCACHE_REMOTE_ONLY: "true"
27+
CCACHE_IGNOREOPTIONS: '-specs=* --specs=*'
28+
LLVM_TOOLCHAIN_PATH: /usr/lib/llvm-16
29+
BASE_REF: ${{ github.base_ref }}
30+
steps:
31+
- name: Apply container owner mismatch workaround
32+
run: |
33+
# FIXME: The owner UID of the GITHUB_WORKSPACE directory may not
34+
# match the container user UID because of the way GitHub
35+
# Actions runner is implemented. Remove this workaround when
36+
# GitHub comes up with a fundamental fix for this problem.
37+
git config --global --add safe.directory ${GITHUB_WORKSPACE}
38+
39+
- name: Print cloud service information
40+
run: |
41+
echo "ZEPHYR_RUNNER_CLOUD_PROVIDER = ${ZEPHYR_RUNNER_CLOUD_PROVIDER}"
42+
echo "ZEPHYR_RUNNER_CLOUD_NODE = ${ZEPHYR_RUNNER_CLOUD_NODE}"
43+
echo "ZEPHYR_RUNNER_CLOUD_POD = ${ZEPHYR_RUNNER_CLOUD_POD}"
44+
45+
- name: Clone cached Zephyr repository
46+
continue-on-error: true
47+
run: |
48+
git clone --shared /repo-cache/zephyrproject/zephyr .
49+
git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
50+
51+
- name: Checkout
52+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
53+
with:
54+
fetch-depth: 0
55+
persist-credentials: false
56+
57+
- name: Environment Setup
58+
run: |
59+
echo "$HOME/.local/bin" >> $GITHUB_PATH
60+
git config --global user.email "[email protected]"
61+
git config --global user.name "Zephyr Bot"
62+
rm -fr ".git/rebase-apply"
63+
rm -fr ".git/rebase-merge"
64+
git clean -f -d
65+
git log --pretty=oneline | head -n 10
66+
west init -l . || true
67+
west config --global update.narrow true
68+
west config manifest.group-filter -- +ci,+optional
69+
# In some cases modules are left in a state where they can't be
70+
# updated (i.e. when we cancel a job and the builder is killed),
71+
# So first retry to update, if that does not work, remove all modules
72+
# and start over. (Workaround until we implement more robust module
73+
# west caching).
74+
west update --path-cache /repo-cache/zephyrproject 2>&1 1> west.log || west update --path-cache /repo-cache/zephyrproject 2>&1 1> west2.log || ( rm -rf ../modules ../bootloader ../tools && west update --path-cache /repo-cache/zephyrproject)
75+
76+
echo "ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-$( cat SDK_VERSION )" >> $GITHUB_ENV
77+
78+
- name: Check Environment
79+
run: |
80+
cmake --version
81+
${LLVM_TOOLCHAIN_PATH}/bin/clang --version
82+
gcc --version
83+
ls -la
84+
85+
- name: Set up ccache
86+
run: |
87+
mkdir -p ${CCACHE_DIR}
88+
ccache -M 10G
89+
ccache -p
90+
ccache -z -s -vv
91+
92+
- name: Run Tests with Twister
93+
id: twister
94+
run: |
95+
export ZEPHYR_BASE=${PWD}
96+
export ZEPHYR_TOOLCHAIN_VARIANT=llvm
97+
pip install codechecker==v6.25.1
98+
99+
west build -b mimxrt1064_evk samples/basic/blinky -- -DZEPHYR_SCA_VARIANT=codechecker -DCODECHECKER_EXPORT=sarif
100+
101+
- name: Print ccache stats
102+
if: always()
103+
run: |
104+
ccache -s -vv
105+

0 commit comments

Comments
 (0)