cppcheck/.github/workflows/CI-unixish-docker.yml

136 lines
4.0 KiB
YAML
Raw Normal View History

# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
name: CI-unixish-docker
on: [push, pull_request]
permissions:
contents: read
jobs:
build_cmake:
strategy:
matrix:
image: ["centos:7", "ubuntu:14.04", "ubuntu:16.04", "ubuntu:18.04"]
fail-fast: false # Prefer quick result
runs-on: ubuntu-22.04
container:
image: ${{ matrix.image }}
steps:
- uses: actions/checkout@v2
- name: Install missing software on CentOS 7
if: matrix.image == 'centos:7'
run: |
yum install -y cmake gcc-c++ make pcre-devel
- name: Install missing software on ubuntu
if: matrix.image != 'centos:7'
run: |
apt-get update
apt-get install -y cmake g++ make libxml2-utils libpcre3-dev
# required so a default Qt installation is configured
- name: Install missing software on ubuntu 18.04
if: false # matrix.os == 'ubuntu-18.04'
run: |
sudo apt-get install qt5-default
# tests require CMake 3.4
- name: Test CMake build (no tests)
if: matrix.image != 'ubuntu:22.10'
run: |
mkdir cmake.output
cd cmake.output
cmake -G "Unix Makefiles" -DHAVE_RULES=On ..
2021-12-15 19:36:34 +01:00
cmake --build . -- -j$(nproc)
cd ..
- name: Test CMake build
if: matrix.image == 'ubuntu:22.10'
run: |
mkdir cmake.output
cd cmake.output
cmake -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On ..
2021-12-15 19:36:34 +01:00
cmake --build . --target check -- -j$(nproc)
cd ..
build_make:
strategy:
matrix:
image: ["centos:7", "ubuntu:14.04", "ubuntu:16.04", "ubuntu:18.04"]
fail-fast: false # Prefer quick result
runs-on: ubuntu-22.04
container:
image: ${{ matrix.image }}
steps:
- uses: actions/checkout@v2
- name: Install missing software on CentOS 7
if: matrix.image == 'centos:7'
run: |
yum install -y gcc-c++ make which python3 pcre-devel
yum --enablerepo=extras install -y epel-release
yum install -y ccache
- name: Install missing software on ubuntu
if: matrix.image != 'centos:7'
run: |
apt-get update
apt-get install -y g++ make python3 libxml2-utils libpcre3-dev
# needs to be called after the package installation since
# - it doesn't call "apt-get update"
# - it doesn't support centos
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
if: matrix.image != 'ubuntu:14.04' # no support for --set-config
with:
key: ${{ github.workflow }}-${{ matrix.image }}
- name: Build cppcheck
run: |
# "/usr/lib64" for centos / "/usr/lib" for ubuntu
export PATH="/usr/lib64/ccache:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j$(nproc) HAVE_RULES=yes
- name: Build test
run: |
# "/usr/lib64" for centos / "/usr/lib" for ubuntu
export PATH="/usr/lib64/ccache:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j$(nproc) testrunner HAVE_RULES=yes
- name: Run test
run: |
make -j$(nproc) check HAVE_RULES=yes
# requires python3
- name: Run extra tests
run: |
tools/generate_and_run_more_tests.sh
# requires which
- name: Validate
run: |
make -j$(nproc) checkCWEEntries validateXML
- name: Test addons
run: |
./cppcheck --addon=threadsafety addons/test/threadsafety
./cppcheck --addon=threadsafety --std=c++03 addons/test/threadsafety
- name: Generate Qt help file on ubuntu 18.04
if: false # matrix.os == 'ubuntu-18.04'
run: |
pushd gui/help
qcollectiongenerator online-help.qhcp -o online-help.qhc