Skip to content

[#485] Add CodeQL queries for AUTOSAR #259

[#485] Add CodeQL queries for AUTOSAR

[#485] Add CodeQL queries for AUTOSAR #259

Workflow file for this run

name: Linux
on:
push:
branches: [ master, '*-ci' ]
pull_request:
branches: [ master ]
jobs:
build_linux:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: ["ubuntu-20.04", "ubuntu-22.04"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
include:
- os: "ubuntu-20.04"
clang-version-suffix: "-11"
- os: "ubuntu-22.04"
clang-version-suffix: "-14"
env:
CPPCHECK_HOME: "${{github.workspace}}/cppcheck-2.6"
SPOTBUGS_HOME: "${{github.workspace}}/spotbugs-3.1.12"
PYLINT_ENABLED: 1
MYPY_ENABLED: 1
NU_HTML_VALIDATOR: "${{github.workspace}}/vnu-20.6.30/vnu.jar"
XMLLINT_ENABLED: 1
CLANG_VERSION_SUFFIX: "${{matrix.clang-version-suffix}}"
CMAKE_BUILD_OPTIONS: "-j2"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
- name: Set up Python ${{matrix.python-version}}
uses: actions/setup-python@v4
with:
python-version: ${{matrix.python-version}}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install virtualenv
python -m pip install gcovr
- name: Workaround for 'Unable to connect to ppa.launchpad.net' failure during installation
run: sudo apt-get update --option Acquire::Retries=100 --option Acquire::http::Timeout="300"
- name: Install dependencies
run: sudo apt-get install cmake doxygen graphviz g++-multilib
- name: Install specific version of C++ static code analysis tool (cppcheck)
run: |
wget https://github.com/danmar/cppcheck/archive/2.6.tar.gz -P "${GITHUB_WORKSPACE}" -O cppcheck-2.6.tar.gz
tar -xf "${GITHUB_WORKSPACE}"/cppcheck-2.6.tar.gz
mkdir "${GITHUB_WORKSPACE}/cppcheck-2.6/build"
pushd "${GITHUB_WORKSPACE}/cppcheck-2.6/build"
cmake .. -DHAVE_RULES=ON -DUSE_MATCHCOMPILER=ON \
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}"/cppcheck-2.6 \
-DCMAKE_INSTALL_BINDIR=. \
-DCMAKE_BUILD_TYPE=Release \
-DFILESDIR=.
cmake --build . --target install
popd
- name: Install specific version of Java static code analysis tool (spotbugs)
run: |
wget https://repo.maven.apache.org/maven2/com/github/spotbugs/spotbugs/3.1.12/spotbugs-3.1.12.zip -P "${GITHUB_WORKSPACE}"
unzip "${GITHUB_WORKSPACE}"/spotbugs-3.1.12.zip
- name: Install specific version of HTML validator (v.Nu)
run: |
wget https://github.com/validator/validator/releases/download/20.6.30/vnu.jar_20.6.30.zip -P "${GITHUB_WORKSPACE}"
unzip "${GITHUB_WORKSPACE}"/vnu.jar_20.6.30.zip -d "${GITHUB_WORKSPACE}"
mv "${GITHUB_WORKSPACE}"/dist "${GITHUB_WORKSPACE}"/vnu-20.6.30
- name: Install XML validator (xmllint)
run: sudo apt-get install libxml2-utils
- name: Build Zserio
run: scripts/build.sh all-linux64-gcc cpp_rt-linux32-gcc cpp_rt-linux64-clang cpp_rt-linux32-clang
env:
CMAKE_EXTRA_ARGS: "-DZSERIO_ENABLE_WERROR=1 -DCMAKE_BUILD_TYPE=Release"
- name: Build Zserio C++ runtime (Debug Build)
run: |
if [ -f "`which clang-tidy-14`" ] ; then
export CLANG_TIDY_BIN=clang-tidy-14
fi
# sanitizers do not work on cpp_rt-linux32-clang when cross-compiling
scripts/build.sh cpp_rt-linux64-gcc cpp_rt-linux32-gcc cpp_rt-linux64-clang
env:
CMAKE_EXTRA_ARGS: "-DZSERIO_ENABLE_WERROR=1 -DCMAKE_BUILD_TYPE=Debug"
GCOVR_BIN: "gcovr"
LLVM_PROFDATA_BIN: "llvm-profdata${{matrix.clang-version-suffix}}"
LLVM_COV_BIN: "llvm-cov${{matrix.clang-version-suffix}}"
SANITIZERS_ENABLED: 1
- name: Pack Zserio release
run: scripts/release.sh
- name: Run Zserio tests
# clang-tidy cannot be run because of time limit
# -DZSERIO_ENABLE_WERROR=1 fails for gcc because of false positive warning
run: |
unset JAVA_TOOL_OPTIONS # workaround https://github.com/actions/virtual-environments/issues/1437
scripts/test.sh all-linux64-gcc cpp-linux32-gcc cpp-linux64-clang cpp-linux32-clang
env:
CMAKE_EXTRA_ARGS: "-DCMAKE_BUILD_TYPE=Release"
- name: Run Zserio C++ tests (Debug Build)
# clang-tidy cannot be run because of time limit
# sanitizers do not work on cpp-linux32-clang when cross-compiling
run: scripts/test.sh cpp-linux32-gcc cpp-linux64-gcc cpp-linux64-clang
env:
CMAKE_EXTRA_ARGS: "-DZSERIO_ENABLE_WERROR=1 -DCMAKE_BUILD_TYPE=Debug"
SANITIZERS_ENABLED: 1
- name: Compare all blobs created by Zserio tests
run: |
scripts/compare_test_data.sh \
build/test/cpp/linux64-gcc/debug \
build/test/cpp/linux64-gcc/release \
build/test/cpp/linux32-gcc/debug \
build/test/cpp/linux32-gcc/release \
build/test/cpp/linux64-clang/debug \
build/test/cpp/linux64-clang/release \
build/test/cpp/linux32-clang/release \
build/test/java \
build/test/python
- name: Run Zserio integration tests for repeated generation
run: |
unset JAVA_TOOL_OPTIONS # workaround https://github.com/actions/virtual-environments/issues/1437
scripts/test_gen.sh all-linux64-gcc cpp-linux32-gcc cpp-linux64-clang cpp-linux32-clang
- name: Run Zserio tests and compares produced BLOBs to check binary compatibility
run: |
unset JAVA_TOOL_OPTIONS # workaround https://github.com/actions/virtual-environments/issues/1437
scripts/test_compat.sh
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Run Zserio performance tests
run: |
unset JAVA_TOOL_OPTIONS # workaround https://github.com/actions/virtual-environments/issues/1437
scripts/test_perf.sh cpp-linux64-gcc cpp-linux64-clang cpp-linux32-gcc cpp-linux32-clang \
python python-cpp java \
--source-dir test/others/gif/zs --source gif.zs \
--blob-name gif.GifFile --blob-file test/others/gif/data/1pix.gif \
--num-iterations 1000 --test-config READ_WRITE
- name: Run Zserio benchmarks
run: |
unset JAVA_TOOL_OPTIONS # workaround https://github.com/actions/virtual-environments/issues/1437
scripts/benchmark.sh cpp-linux64-gcc cpp-linux64-clang cpp-linux32-gcc cpp-linux32-clang \
python python-cpp java --num-iterations 10
- name: Archive Zserio release artifacts
uses: actions/upload-artifact@v3
with:
name: zserio-release-${{matrix.os}}-${{matrix.python-version}}
path: release-*
- name: Archive Zserio build artifacts
uses: actions/upload-artifact@v3
with:
name: zserio-build-${{matrix.os}}-${{matrix.python-version}}
path: |
build/runtime_libs/python/zserio_cpp/**/*.so
build/runtime_libs/cpp/**/runtime/*.a