Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ jobs:
```

Notes:
- The action installs LLVM 20 from apt.llvm.org, the version the analyzer builds with, and is tested
on `ubuntu-24.04`. With another `llvm-version`, or on a runner for which apt.llvm.org publishes no
LLVM 20 packages, such as `ubuntu-26.04`, it stops with an error before installing LLVM.
- SARIF is generated by default (`sarif-file`) and can be uploaded automatically (`upload-sarif: "true"`).
- Each SARIF rule carries the CWE tags of its diagnostics. A rule that detects a security weakness
also carries the `security` tag and a `security-severity` score, so code scanning lists its
Expand Down
35 changes: 27 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ inputs:
required: false
default: "true"
llvm-version:
description: "LLVM version to install."
description: "LLVM version to install. The analyzer builds with LLVM 20 only."
required: false
default: "20"

Expand All @@ -91,18 +91,37 @@ runs:
# ---------------------------------------------------------------
- name: Install LLVM ${{ inputs.llvm-version }}
shell: bash
env:
LLVM_VERSION: ${{ inputs.llvm-version }}
run: |
CODENAME=$(. /etc/os-release && printf '%s' "${VERSION_CODENAME}")
if [[ "${LLVM_VERSION}" != 20 ]]; then
echo "::error::The analyzer builds with LLVM 20 only; got llvm-version '${LLVM_VERSION}'."
exit 1
fi

sudo apt-get update
wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
CODENAME=$(lsb_release -cs)
sudo apt-add-repository "deb http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${{ inputs.llvm-version }} main"
sudo apt-get install -y --no-install-recommends ca-certificates curl gnupg
# apt.llvm.org publishes a different set of LLVM branches for each Ubuntu release: ask it.
release_url="https://apt.llvm.org/${CODENAME}/dists/llvm-toolchain-${CODENAME}-${LLVM_VERSION}/Release"
status=$(curl --silent --head --location --output /dev/null --write-out '%{http_code}' "${release_url}") || status="unreachable"
if [[ "${status}" != 200 ]]; then
echo "::error::Cannot find LLVM ${LLVM_VERSION} packages for '${CODENAME}' at ${release_url} (status: ${status}). The action is tested on ubuntu-24.04."
exit 1
fi
sudo install -d -m 0755 /etc/apt/keyrings
curl --fail --silent --show-error --location https://apt.llvm.org/llvm-snapshot.gpg.key |
sudo gpg --dearmor --batch --yes --output /etc/apt/keyrings/llvm.gpg
sudo chmod 0644 /etc/apt/keyrings/llvm.gpg
echo "deb [signed-by=/etc/apt/keyrings/llvm.gpg] https://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${LLVM_VERSION} main" |
sudo tee /etc/apt/sources.list.d/llvm.list
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
cmake ninja-build python3 build-essential \
llvm-${{ inputs.llvm-version }} \
llvm-${{ inputs.llvm-version }}-dev \
clang-${{ inputs.llvm-version }} \
libclang-${{ inputs.llvm-version }}-dev
llvm-${LLVM_VERSION} \
llvm-${LLVM_VERSION}-dev \
clang-${LLVM_VERSION} \
libclang-${LLVM_VERSION}-dev

# ---------------------------------------------------------------
# 2. Cache + Build the analyzer
Expand Down
Loading