Fix some coverity warnings #943
Workflow file for this run
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
name: C/C++ CI | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: master | |
paths: | |
- '**' | |
- '!**.yml' | |
- '!**/.github' | |
- '!**.md' | |
- '!docker/**' | |
- '!packaging/**' | |
- '**/c-cpp.yml' | |
pull_request: | |
branches: master | |
paths: | |
- '**' | |
- '!**.yml' | |
- '!**/.github' | |
- '!**.md' | |
- '!docker/**' | |
- '!packaging/**' | |
- '**/c-cpp.yml' | |
env: | |
TERM: xterm | |
jobs: | |
build: | |
name: ${{ matrix.name }}-${{ matrix.os }}-${{ matrix.cc }} | |
strategy: | |
fail-fast: false | |
matrix: | |
name: [default] | |
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04] | |
cc: [gcc, clang] | |
include: | |
- name: btrfs-clone | |
os: ubuntu-latest | |
- name: epochalypse | |
os: ubuntu-latest | |
setup_options: -Db_sanitize=none | |
install_packages: faketime | |
- name: dist-test | |
os: ubuntu-latest | |
dist: true | |
- name: Slackware | |
os: ubuntu-latest | |
container: 'andy5995/slackware-build-essential:15.0' | |
- name: without-nls | |
os: ubuntu-latest | |
setup: -Dnls=false | |
- name: without-curses | |
os: ubuntu-latest | |
setup: -Dwithout-curses=true | |
- name: Alpine | |
os: ubuntu-latest | |
container: andy5995/rmw:build-env-alpine | |
setup_options: -Db_sanitize=none | |
runs-on: ${{ matrix.os }} | |
container: ${{ matrix.container }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: false | |
- name: Set CC | |
run: | | |
CC=${{ matrix.cc }} | |
if [ "$CC" = "gcc" ] || [ -z "$CC" ]; then | |
CC=gcc | |
CXX=g++ | |
else | |
CC=clang | |
CXX=clang++ | |
fi | |
echo "CC=$CC" >> $GITHUB_ENV | |
echo "CXX=$CXX" >> $GITHUB_ENV | |
- name: Show info | |
run: | | |
export -p | |
echo '${{ toJSON(matrix) }}' | |
- if: ${{ matrix.container == null }} | |
run: | | |
sudo apt update | |
sudo apt remove -y firefox | |
sudo apt upgrade -y | |
sudo apt-get install -y \ | |
python3-pip \ | |
python3-setuptools \ | |
xvfb | |
if [ -n "${{ matrix.install_packages }}" ]; then | |
sudo apt install -y ${{ matrix.install_packages }} | |
fi | |
sudo -H python3 -m pip install meson ninja | |
- if: ${{ contains(matrix.name, 'without-nls') && matrix.container == null }} | |
run: sudo apt remove -y gettext | |
- if: ${{ contains(matrix.name, 'without-nls') == false && matrix.container == null }} | |
run: sudo apt install -y gettext | |
- name: Add lto | |
if: ${{ env.CC == 'gcc' }} | |
run: echo "SETUP_OPTIONS=-Db_lto=true" >> $GITHUB_ENV | |
- if: ${{ contains(matrix.container, 'alpine') }} | |
run: | | |
apk update | |
apk upgrade | |
- if: ${{ matrix.name == 'btrfs-clone' }} | |
uses: actions/cache@v4 | |
id: btrfs-img-cache | |
with: | |
path: test/rmw-btrfs-test.img | |
key: ${{ matrix.name }}-${{ hashFiles('test/rmw-btrfs-test.img.sha256sum') }} | |
- if: ${{ steps.btrfs-img-cache.outputs.cache-hit != 'true' && matrix.name == 'btrfs-clone' }} | |
run: curl -L -o test/rmw-btrfs-test.img 'https://www.dropbox.com/scl/fi/57g3ixd3w3tuz4qoc2zp1/rmw-btrfs-test.img?rlkey=yc7krtntswsa1bwz0sbugy4gi&st=hkgrht05&dl=0' | |
- name: Configure | |
run: meson setup builddir $SETUP_OPTIONS ${{ matrix.setup_options }} | |
- name: Build | |
run: | | |
cd builddir | |
ninja -v | |
- name: Test | |
run: cd builddir && meson test -v | |
- name: Test fake media root | |
run: cd builddir && meson test -v --setup=fake_media_root --suite rmw | |
- if: ${{ contains(matrix.name, 'dist') }} | |
run: cd builddir && meson dist --include-subprojects | |
- if: ${{ matrix.name == 'epochalypse' }} | |
name: Epochalypse test | |
run: meson test -C builddir --setup=epochalypse | |
openbsd: | |
runs-on: ubuntu-latest | |
name: A job to run test in OpenBSD | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: false | |
- name: Test in OpenBSD | |
id: test | |
uses: vmactions/openbsd-vm@v1 | |
with: | |
usesh: true | |
prepare: | | |
pkg_add gettext git meson ninja | |
run: | | |
meson setup builddir -Db_sanitize=none $SETUP_OPTIONS || cat builddir/meson-logs/meson-log.txt | |
cd builddir | |
meson compile -v | |
meson test -v --suite rmw |