Skip to content

CodeQL

CodeQL #563

# 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]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 21 * * 0'
workflow_dispatch:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['cpp', 'java']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
steps:
- name: Checkout repository
uses: actions/checkout@main
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
- if: matrix.language == 'java'
name: Checkout GIT submodules (java)
run: |
git submodule init
git submodule update client/radioGUI/lib/jsimconnect
- if: matrix.language == 'java'
name: Setup Java
uses: actions/setup-java@main
with:
java-version: '11' # The JDK version to make available on the path.
distribution: adopt
- if: matrix.language == 'cpp'
name: Setup C++
run: sudo apt-get install libssl-dev mingw-w64 mingw-w64-common build-essential
# 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.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
- if: matrix.language == 'java'
name: Build Java
run: |
make build-radioGUI
- if: matrix.language == 'cpp'
name: Build C++ Tests (Linux x64)
run: |
make clean test
- if: matrix.language == 'cpp'
name: Build C++ (Linux x64)
run: |
make clean tools plugin
- if: matrix.language == 'cpp'
name: Build C++ (Windows x64 mingw-crosscompile)
# skip openssl build, it takes long and will trigger false-positives
run: |
make SSLFLAGS= clean tools-win64 plugin-win64
- if: matrix.language == 'cpp'
name: Build C++ (Windows x32 mingw-crosscompile)
# skip openssl build, it takes long and will trigger false-positives
run: |
make SSLFLAGS= clean plugin-win32
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
#
# Syntax checking
#
analyze-php:
name: Analyze (php)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@main
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: Check PHP syntax errors
uses: overtrue/phplint@main
with:
path: server/statuspage/
options: --exclude=vendor
analyze-lua:
name: Analyze (lua)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@main
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: Setup programs
run: |
sudo apt-get -y install lua-check
#- name: Check LUA syntax errors
# run: |
# find . -name '*.lua' -print > luacheck.list
# while read file; do echo "LuaLintCheck: $file"; luac -p "$file"; done <luacheck.list
# invoke luacheck, but make the run-action return only with errors, not with warnings (i.e. RC>1)
- name: Check LUA syntax errors
continue-on-error: true
run: |
luacheck . && lrc=$? || lrc=$?
echo "LUACHECK_RC=$lrc" >> $GITHUB_ENV
- name: Evaluate luacheck return code
run: |
r=0
if [[ "${{env.LUACHECK_RC}}" -gt 1 ]]; then r=1; fi
echo "LUACHECK returned ${{env.LUACHECK_RC}}, translated to step_rc=$r"
exit $r