CodeQL Analysis #19
This file contains hidden or 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 Analysis" | |
on: | |
push: | |
branches: [ "main" ] | |
schedule: | |
- cron: '27 0 * * 2' | |
jobs: | |
analyze: | |
name: Analyze C/C++ and Java/Kotlin | |
runs-on: 'ubuntu-latest' | |
permissions: | |
# required for all workflows | |
security-events: write | |
# required to fetch internal or private CodeQL packs | |
packages: read | |
# only required for workflows in private repositories | |
actions: read | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
cache: gradle | |
distribution: 'temurin' | |
- name: Install dependencies | |
shell: bash | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y cmake swig ninja-build clang clang-tools libc++-dev libc++abi-dev | |
# - name: Install latest cmake | |
# run: | | |
# CMAKE_URL="https://github.com/Kitware/CMake/releases/latest/download/cmake-4.0.0-linux-x86_64.sh" | |
# EXPECTED_HASH="33ba237f2850a82d5c71c1d41803ab832a9a7aac7d99fa6e48bbe5bb4d66653c" | |
# | |
# wget "$CMAKE_URL" -O cmake-installer.sh | |
# echo "$EXPECTED_HASH cmake-installer.sh" | sha256sum -c - | |
# | |
# chmod +x cmake-installer.sh | |
# sudo ./cmake-installer.sh --skip-license --prefix=/usr/local | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Setup Android NDK | |
shell: bash | |
run: | | |
sdkmanager "ndk;27.2.12479018" | |
sdkmanager "cmake;3.31.6" | |
echo "ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/27.2.12479018" >> $GITHUB_ENV | |
echo "$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_PATH | |
# Add any setup steps before running the `github/codeql-action/init` action. | |
# This includes steps like installing compilers or runtimes (`actions/setup-node` | |
# or others). This is typically only required for manual builds. | |
# - name: Setup runtime (example) | |
# uses: actions/setup-example@v1 | |
# Initializes the CodeQL tools for scanning. | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: c-cpp, java-kotlin | |
build-mode: manual | |
- name: Build | |
shell: bash | |
env: | |
CC: clang | |
CXX: clang++ | |
CXXFLAGS: --stdlib=libc++ | |
run: | | |
./gradlew assemble | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 |