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