Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
157 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ "master", "0.10" ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ "master", "0.10" ] | ||
schedule: | ||
- cron: '23 0 * * 5' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
analyze: | ||
name: "Analyze (${{ matrix.language }})" | ||
# Runner size impacts CodeQL analysis time. To learn more, please see: | ||
# - https://gh.io/recommended-hardware-resources-for-running-codeql | ||
# - https://gh.io/supported-runners-and-hardware-resources | ||
# - https://gh.io/using-larger-runners | ||
# Consider using larger runners for possible analysis time improvements. | ||
runs-on: 'ubuntu-latest' | ||
container: | ||
image: debian:stable | ||
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- language: "cpp" | ||
configure-args: "--enable-ja-rule --enable-e133 --enable-unittests" | ||
compiler: | ||
CC: "/usr/bin/gcc" | ||
CXX: "/usr/bin/g++" | ||
pkg: "gcc g++" | ||
- language: "java" | ||
configure-args: "--enable-unittests --enable-java-libs" | ||
compiler: | ||
CC: "/usr/bin/gcc" | ||
CXX: "/usr/bin/g++" | ||
pkg: "gcc g++" | ||
- language: "javascript" | ||
configure-args: "--enable-unittests" | ||
compiler: | ||
CC: "/usr/bin/gcc" | ||
CXX: "/usr/bin/g++" | ||
pkg: "gcc g++" | ||
- language: "python" | ||
configure-args: "--enable-unittests --enable-rdm-tests" | ||
compiler: | ||
CC: "/usr/bin/gcc" | ||
CXX: "/usr/bin/g++" | ||
pkg: "gcc g++" | ||
env: | ||
CC: "${{ matrix.compiler.CC }}" | ||
CXX: "${{ matrix.compiler.CXX }}" | ||
|
||
steps: | ||
- name: Get number of CPU cores | ||
id: num-cpu-cores | ||
# TODO(Perry): Parallelization causes GH Actions to hang -j${{ steps.num-cpu-cores.outputs.NUM_CPU_CORES }} | ||
# run: echo "NUM_CPU_CORES=$(grep -c processor /proc/cpuinfo)" >> $GITHUB_OUTPUT | ||
run: echo "NUM_CPU_CORES=1" >> $GITHUB_OUTPUT | ||
- name: Update package database | ||
run: apt-get update -y | ||
# See comments beginning at | ||
# https://github.com/actions/runner/issues/763#issuecomment-1435474884 | ||
# Without Git, actions/checkout@v3 will resort to REST and will not | ||
# create a .git folder or .git.config. The Problem Matcher looks for | ||
# .git/config to find where the root of the repo is, so it must be | ||
# present. | ||
- name: Install Git | ||
run: apt-get -y install git | ||
- uses: actions/checkout@v3 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
|
||
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs | ||
# queries: security-extended,security-and-quality | ||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
#- name: Autobuild | ||
# uses: github/codeql-action/autobuild@v2 | ||
|
||
- name: Install build tools | ||
shell: bash | ||
run: | | ||
apt-get -y install adduser sudo pkg-config libtool autoconf \ | ||
automake g++ bison flex make bash-completion dh-autoreconf \ | ||
debhelper devscripts wget python3-full python3-pip | ||
- name: Setup Python venv | ||
shell: bash | ||
run: | | ||
python3 -m venv --system-site-packages ../venv | ||
source ../venv/bin/activate | ||
echo "PATH=$PATH" >> $GITHUB_ENV | ||
- name: Install Python build tools | ||
run: python3 -m pip install --no-input gcovr | ||
- name: Install build dependencies | ||
shell: bash | ||
run: | | ||
sudo apt-get -y install libcppunit-dev uuid-dev libncurses5-dev \ | ||
libmicrohttpd-dev protobuf-compiler python3-protobuf \ | ||
libprotobuf-dev libprotoc-dev zlib1g-dev libftdi-dev \ | ||
libusb-1.0-0-dev liblo-dev libavahi-client-dev python3-numpy \ | ||
default-jdk-headless maven | ||
- name: Install compiler | ||
shell: bash | ||
run: apt-get -y install ${{ matrix.compiler.pkg }} | ||
- name: Set up build user # CredentialsTest cannot run as root | ||
run: | | ||
adduser --disabled-password --gecos "" builduser | ||
chown -R builduser:builduser . | ||
chown builduser:builduser .. | ||
- name: Autoreconf | ||
run: sudo --preserve-env -u builduser env "PATH=$PATH" autoreconf -i | ||
- name: Set configure arguments | ||
run: | | ||
echo "GH_OLA_CONFIGURE_ARGS=${{ matrix.configure-args }}" >> $GITHUB_ENV | ||
- name: Set additional Linux configure arguments | ||
if: runner.os == 'Linux' | ||
# Silence all deprecated declarations on Linux due to auto_ptr making the build log too long | ||
run: | | ||
echo "GH_OLA_CONFIGURE_ARGS=$GH_OLA_CONFIGURE_ARGS CPPFLAGS=-Wno-deprecated-declarations" >> $GITHUB_ENV | ||
- name: Print configure command | ||
run: echo "./configure $GH_OLA_CONFIGURE_ARGS" | ||
- name: Configure | ||
run: sudo --preserve-env -u builduser env "PATH=$PATH" ./configure $GH_OLA_CONFIGURE_ARGS | ||
- name: Make | ||
run: sudo --preserve-env -u builduser env "PATH=$PATH" make -j${{ steps.num-cpu-cores.outputs.NUM_CPU_CORES }} VERBOSE=1 | ||
- name: Display structure of the built files | ||
if: always() && env.ACTIONS_STEP_DEBUG == 'true' | ||
run: ls -alR | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 | ||
with: | ||
category: "/language:${{matrix.language}}" |