hide for now #411
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: CodeQL | |
on: | |
push: | |
paths: | |
- 'source/common/**' | |
branches-ignore: | |
- 'dependabot/**' | |
pull_request: | |
concurrency: | |
group: ${{ github.head_ref-github.workflow || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
CodeQL-Build: | |
permissions: | |
security-events: write # for github/codeql-action/analyze to upload SARIF results | |
strategy: | |
fail-fast: false | |
# CodeQL runs on ubuntu-20.04 | |
runs-on: ubuntu-20.04 | |
if: github.repository == 'envoyproxy/envoy' | |
steps: | |
- name: Pre-cleanup | |
uses: envoyproxy/toolshed/gh-actions/[email protected] | |
with: | |
to_remove: | | |
/usr/local/lib/android | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
# We must fetch at least the immediate parents so that if this is | |
# a pull request then we can checkout the head. | |
fetch-depth: 2 | |
- name: Get build targets | |
run: | | |
. .github/workflows/get_build_targets.sh | |
echo 'BUILD_TARGETS<<EOF' >> $GITHUB_ENV | |
echo $BUILD_TARGETS_LOCAL >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
# If this run was triggered by a pull request event, then checkout | |
# the head of the pull request instead of the merge commit. | |
- run: git checkout HEAD^2 | |
if: ${{ github.event_name == 'pull_request' }} | |
# Initializes the CodeQL tools for scanning. | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a | |
# Override language selection by uncommenting this and choosing your languages | |
with: | |
languages: cpp | |
- name: Install deps | |
shell: bash | |
run: | | |
sudo apt-get update --error-on=any | |
sudo apt-get install --yes libtool cmake automake autoconf make ninja-build curl unzip virtualenv openjdk-11-jdk build-essential libc++1 | |
# Note: the llvm/clang version should match the version specifed in: | |
# - bazel/repository_locations.bzl | |
# - .github/workflows/codeql-daily.yml | |
# - https://github.com/envoyproxy/envoy-build-tools/blob/main/build_container/build_container_ubuntu.sh#L84 | |
mkdir -p bin/clang14 | |
cd bin/clang14 | |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz | |
tar -xf clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz --strip-components 1 | |
export PATH=bin/clang14/bin:$PATH | |
- name: Build | |
run: | | |
bazel/setup_clang.sh bin/clang14 | |
bazelisk shutdown | |
bazelisk build -c fastbuild --spawn_strategy=local --discard_analysis_cache --nouse_action_cache --config clang --config libc++ $BUILD_TARGETS | |
echo -e "Built targets...\n$BUILD_TARGETS" | |
- name: Clean Artifacts | |
run: | | |
git clean -xdf | |
- name: Perform CodeQL Analysis | |
if: env.BUILD_TARGETS != '' | |
uses: github/codeql-action/analyze@cdcdbb579706841c47f7063dda365e292e5cad7a |