2f46ef27a2
cppcheck 2.17.0 adds checks that a NULL pointer returned from malloc() and calloc() is not used. We do this quite a lot. I've addressed this by adding functions g_malloc_nofail() and g_calloc_nofail() which either allocate memory or abort. functions are now called in places where we are not making these checks. Many of these checks are in test programs or example programs. I've modified the list16 module to handle out-of-memory conditions.
235 lines
8.2 KiB
YAML
235 lines
8.2 KiB
YAML
name: build and test
|
|
on:
|
|
push:
|
|
branches-ignore:
|
|
- "gh-pages"
|
|
tags-ignore:
|
|
- "v0.[0-8]**"
|
|
pull_request:
|
|
branches-ignore:
|
|
- "gh-pages"
|
|
|
|
jobs:
|
|
build_and_test:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
|
|
# Minimal 64-bit arch builds
|
|
- CC: gcc
|
|
feature_set: min
|
|
arch: amd64
|
|
os: ubuntu-latest
|
|
unittests: false
|
|
DISTCHECK: false
|
|
|
|
- CC: g++
|
|
feature_set: min
|
|
arch: amd64
|
|
os: ubuntu-latest
|
|
unittests: false
|
|
DISTCHECK: false
|
|
|
|
- CC: clang
|
|
feature_set: min
|
|
arch: amd64
|
|
os: ubuntu-latest
|
|
unittests: false
|
|
DISTCHECK: false
|
|
|
|
# Maximal 64-bit arch builds
|
|
- CC: gcc
|
|
feature_set: max
|
|
arch: amd64
|
|
os: ubuntu-latest
|
|
unittests: true
|
|
DISTCHECK: true
|
|
|
|
- CC: g++
|
|
feature_set: max
|
|
arch: amd64
|
|
os: ubuntu-latest
|
|
unittests: false
|
|
DISTCHECK: false
|
|
|
|
- CC: clang
|
|
feature_set: max
|
|
arch: amd64
|
|
os: ubuntu-latest
|
|
unittests: true
|
|
DISTCHECK: true
|
|
|
|
- CC: clang
|
|
feature_set: max
|
|
arch: amd64
|
|
os: ubuntu-latest
|
|
unittests: true
|
|
DISTCHECK: false
|
|
name_extra: and AddressSanitized
|
|
CFLAGS: "-fsanitize=address -ggdb"
|
|
LDFLAGS: "-fsanitize=address"
|
|
|
|
# Maximal debug 64-bit arch builds
|
|
# Check we can also do a static build without
|
|
# installing .a files
|
|
- CC: gcc
|
|
feature_set: max
|
|
arch: amd64
|
|
os: ubuntu-latest
|
|
unittests: true
|
|
DISTCHECK: false
|
|
name_extra: and DEBUG
|
|
CONF_FLAGS_EXTRA: "--enable-devel-all --disable-static"
|
|
|
|
# Maximal 32-bit arch builds
|
|
- CC: gcc
|
|
feature_set: max
|
|
arch: i386
|
|
os: ubuntu-latest
|
|
unittests: true
|
|
DISTCHECK: false
|
|
name_extra: for 32-bit arch (legacy OS)
|
|
CFLAGS: "-m32"
|
|
LDFLAGS: "-m32"
|
|
|
|
- CC: g++
|
|
feature_set: max
|
|
arch: i386
|
|
os: ubuntu-latest
|
|
unittests: false
|
|
DISTCHECK: false
|
|
name_extra: for 32-bit arch (legacy OS)
|
|
CFLAGS: "-m32"
|
|
LDFLAGS: "-m32"
|
|
|
|
- CC: clang
|
|
feature_set: max
|
|
arch: i386
|
|
os: ubuntu-latest
|
|
unittests: true
|
|
DISTCHECK: false
|
|
name_extra: for 32-bit arch (legacy OS)
|
|
CFLAGS: "-m32"
|
|
LDFLAGS: "-m32"
|
|
|
|
name: ${{ matrix.feature_set }} features with ${{ matrix.CC }} ${{ matrix.name_extra }}
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
CC: ${{ matrix.CC }}
|
|
CFLAGS: ${{ matrix.CFLAGS }}
|
|
LDFLAGS: ${{ matrix.LDFLAGS }}
|
|
|
|
# HACK (2020-11-16): github actions doesn't support YAML anchors/aliases to
|
|
# avoid repeating long config values. So instead the config values are defined
|
|
# as environment variables using a naming convention with fields that come from
|
|
# the job config. These environment variables are then referenced as regular
|
|
# environment variables via the naming convention in the "define env" step to
|
|
# define the standard environment variable used in the rest of the steps.
|
|
CONF_FLAGS_amd64_min: "--disable-ipv6 --disable-jpeg --disable-fuse --disable-mp3lame
|
|
--disable-fdkaac --disable-opus --disable-rfxcodec --disable-painter
|
|
--disable-pixman --disable-utmp"
|
|
CONF_FLAGS_amd64_max: "--enable-ibus --enable-ipv6 --enable-jpeg --enable-fuse
|
|
--enable-mp3lame --enable-fdkaac --enable-opus --enable-rfxcodec
|
|
--enable-painter --enable-pixman --enable-utmp
|
|
--with-imlib2 --with-freetype2 --enable-tests --with-x264
|
|
--enable-openh264"
|
|
CONF_FLAGS_i386_max: "--enable-ipv6 --enable-jpeg
|
|
--enable-mp3lame --enable-opus --enable-rfxcodec
|
|
--enable-painter --disable-pixman
|
|
--with-freetype2 --host=i686-linux --enable-tests"
|
|
|
|
PKG_CONFIG_PATH_i386: "/usr/lib/i386-linux-gnu/pkgconfig"
|
|
steps:
|
|
- name: "Define feature and arch dependent environment variables"
|
|
# Note: any "variable=value" written to the $GITHUB_ENV file will be
|
|
# defined as an environment variable for all future steps in this job
|
|
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
|
|
run: |
|
|
echo "CONF_FLAGS=$CONF_FLAGS_${{ matrix.arch }}_${{ matrix.feature_set }} ${{ matrix.CONF_FLAGS_EXTRA }}" >> $GITHUB_ENV
|
|
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH_${{ matrix.arch }}" >> $GITHUB_ENV
|
|
- uses: actions/checkout@v4
|
|
- name: "Install Dependencies"
|
|
# See https://github.com/actions/runner-images/issues/7192
|
|
run: |
|
|
echo RESET grub-efi/install_devices | sudo debconf-communicate grub-pc
|
|
sudo scripts/install_xrdp_build_dependencies_with_apt.sh ${{ matrix.feature_set }} ${{ matrix.arch }} --allow-downgrades --allow-remove-essential --allow-change-held-packages
|
|
- name: Bootstrap
|
|
run: ./bootstrap
|
|
- name: configure
|
|
run: ./configure $CONF_FLAGS
|
|
- name: make
|
|
run: make -j $(nproc)
|
|
- name: unittests
|
|
if: ${{ matrix.unittests }}
|
|
run: make check -j $(nproc) || (cat tests/*/test-suite.log && exit 1)
|
|
- name: distcheck
|
|
id: dist_check
|
|
if: ${{ matrix.DISTCHECK }}
|
|
run: make distcheck -j $(nproc)
|
|
- name: "Artifact: test-suite.log distcheck"
|
|
uses: actions/upload-artifact@v4
|
|
if: always() && steps.dist_check.outcome == 'failure'
|
|
with:
|
|
name: test-suite-distcheck-${{ matrix.cc }}-${{ matrix.feature_set }}
|
|
path: ${{ github.workspace }}/xrdp-*/_build/sub/tests/xrdp/test-suite.log
|
|
|
|
cppcheck:
|
|
name: cppcheck
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
CC: gcc
|
|
# This is required to use a version of cppcheck other than that
|
|
# supplied with the operating system
|
|
CPPCHECK_VER: "2.17.0"
|
|
CPPCHECK_REPO: https://github.com/danmar/cppcheck.git
|
|
steps:
|
|
# Set steps.os.outputs.image to the specific OS (e.g. 'ubuntu20')
|
|
- name: Get operating system name and version.
|
|
id: os
|
|
run: echo "image=$ImageOS" >>$GITHUB_OUTPUT
|
|
shell: bash
|
|
- uses: actions/checkout@v4
|
|
- name: Cache cppcheck
|
|
uses: actions/cache@v4
|
|
env:
|
|
cache-name: cache-cppcheck
|
|
with:
|
|
path: ~/cppcheck.local
|
|
key: ${{ steps.os.outputs.image }}-build-${{ env.cache-name }}-${{ env.CPPCHECK_VER }}
|
|
- run: sudo scripts/install_cppcheck_dependencies_with_apt.sh $CPPCHECK_VER
|
|
- run: ./bootstrap
|
|
- run: ./configure
|
|
- run: scripts/install_cppcheck.sh $CPPCHECK_REPO $CPPCHECK_VER
|
|
- run: scripts/run_cppcheck.sh -v $CPPCHECK_VER
|
|
|
|
code_formatting_check:
|
|
name: code formatting check
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
CC: gcc
|
|
# This is required to use a version of astyle other than that
|
|
# supplied with the operating system
|
|
ASTYLE_VER: 3.4.14
|
|
ASTYLE_REPO: https://gitlab.com/saalen/astyle.git
|
|
steps:
|
|
# Set steps.os.outputs.image to the specific OS (e.g. 'ubuntu20')
|
|
- name: Get operating system name and version.
|
|
id: os
|
|
run: echo "image=$ImageOS" >>$GITHUB_OUTPUT
|
|
shell: bash
|
|
- uses: actions/checkout@v4
|
|
- name: Cache astyle
|
|
uses: actions/cache@v4
|
|
env:
|
|
cache-name: cache-astyle
|
|
with:
|
|
path: ~/astyle.local
|
|
key: ${{ steps.os.outputs.image }}-build-${{ env.cache-name }}-${{ env.ASTYLE_VER }}
|
|
- run: sudo scripts/install_astyle_dependencies_with_apt.sh
|
|
- run: scripts/install_astyle.sh $ASTYLE_REPO $ASTYLE_VER
|
|
- name: Format code with astyle
|
|
run: scripts/run_astyle.sh -v $ASTYLE_VER
|
|
- name: Check code formatting
|
|
run: git diff --exit-code
|