Code analysis #42
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: "Code analysis" | |
on: | |
workflow_call: | |
inputs: | |
os: | |
required: false | |
type: string | |
default: "ubuntu-22.04-amd64" | |
workflow_dispatch: | |
inputs: | |
os: | |
required: false | |
type: string | |
default: "ubuntu-22.04-amd64" | |
jobs: | |
build-docker-image: | |
uses: ./.github/workflows/build-docker-artifact.yaml | |
secrets: inherit | |
with: | |
os: ${{ inputs.os }} | |
clang-tidy: | |
needs: build-docker-image | |
env: | |
ARCH_NAME: wormhole_b0 | |
runs-on: | |
- build | |
- in-service | |
steps: | |
- name: Verify ccache availability | |
shell: bash | |
run: | | |
if [ ! -d "/mnt/MLPerf/ccache" ]; then | |
echo "::error title=ccache-mlperf-not-mounted::NFS drive is not mounted; build machine not properly provisioned." | |
exit 1 | |
fi | |
if [ ! -d "$HOME/.ccache-ci" ]; then | |
echo "::error title=ccache-not-provisioned::Ccache is not properly provisioned." | |
exit 1 | |
fi | |
- uses: tenstorrent/tt-metal/.github/actions/checkout-with-submodule-lfs@main | |
- name: Set up dynamic env vars for build | |
run: | | |
echo "TT_METAL_HOME=$(pwd)" >> $GITHUB_ENV | |
echo "RUNNER_UID=$(id -u)" >> $GITHUB_ENV | |
echo "RUNNER_GID=$(id -g)" >> $GITHUB_ENV | |
- name: Update submodules | |
run: | | |
git submodule update --init --recursive | |
- name: Generate docker tag | |
id: generate-docker-tag | |
uses: ./.github/actions/generate-docker-tag | |
with: | |
image: tt-metalium/${{ inputs.os }} | |
- name: Docker login | |
uses: docker/login-action@v3 | |
with: | |
registry: https://ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Pull docker image | |
run: docker pull ${{ env.TT_METAL_DOCKER_IMAGE_TAG }} | |
- name: Analyze code with clang-tidy | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: ${{ env.TT_METAL_DOCKER_IMAGE_TAG }} | |
options: | | |
--rm | |
--tmpfs /tmp | |
-u ${{ env.RUNNER_UID }}:${{ env.RUNNER_GID }} | |
--group-add 1457 | |
-v ${{ github.workspace }}:${{ github.workspace }} | |
-v /etc/passwd:/etc/passwd:ro | |
-v /etc/shadow:/etc/shadow:ro | |
-v /etc/bashrc:/etc/bashrc:ro | |
-v /home/ubuntu/.ccache-ci:/home/ubuntu/.ccache | |
-v /mnt/MLPerf/ccache:/mnt/MLPerf/ccache | |
-e ARCH_NAME=${{ env.ARCH_NAME }} | |
-e CARGO_HOME=${{ github.workspace }}/.cargo | |
-w ${{ github.workspace }} | |
run: | | |
set -eu # basic shell hygiene | |
# /tmp is a tmpfs; more efficient than persisted storage | |
mkdir -p /tmp/ccache | |
export CCACHE_TEMPDIR=/tmp/ccache | |
# Zero out the stats so we can see how we did this build | |
# NOTE: may be inaccurate if we have >1 build runner on the same machine, using the same local cache | |
ccache -z | |
cmake --preset clang-tidy | |
# cmake -B .build/clang-tidy -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_CLANG_TIDY=clang-tidy-17 -DTT_UNITY_BUILDS=FALSE -DCMAKE_DISABLE_PRECOMPILE_HEADERS=TRUE -DENABLE_CCACHE=TRUE -DTT_METAL_BUILD_TESTS=TRUE -DTTNN_BUILD_TESTS=TRUE -DBUILD_PROGRAMMING_EXAMPLES=TRUE -DBUILD_TT_TRAIN=TRUE | |
nice -n 19 cmake --build --preset clang-tidy | |
mkdir out | |
ccache -s > out/ccache.stats | |
- name: Publish Ccache summary | |
run: | | |
echo '## CCache Summary' >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
cat out/ccache.stats >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY |