Skip to content

ci: Add a GitHub Actions build #1

ci: Add a GitHub Actions build

ci: Add a GitHub Actions build #1

Workflow file for this run

name: CI Build
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
# cancel already running builds of the same branch or pull request
concurrency:
group: ci-${{ github.head_ref }} || concat(${{ github.ref }}
cancel-in-progress: true
env:
MATE_PANEL_DEP: 1.27.1
CONFIGURE_FLAGS: --enable-compile-warnings=maximum
CFLAGS: -g -O2 -Werror=pointer-arith -Werror=implicit-function-declaration
JOBS: 2
DEBUG: 1
# Useful URL: https://github.com/mate-desktop/debian-packages
# Useful URL: https://salsa.debian.org/debian-mate-team/mate-panel
DEB_LIBRARY_DEPS: |
libcaja-extension-dev
libglib2.0-dev
libgtk-3-dev
libjson-glib-dev
libmagic-dev
DEB_BUILD_DEPS: |
ccache
autoconf-archive
autopoint
git
gettext
make
mate-common
yelp-tools
# Useful URL: https://git.archlinux.org/svntogit/community.git/tree/mate-panel
ARCH_BUILD_DEPS: |
ccache
autoconf-archive
caja
clang
file
gcc
git
gtk3
json-glib
make
mate-common
which
yelp-tools
jobs:
build:
name: Build on ${{matrix.container}} with in-process=${{matrix.in-process}} (using ${{matrix.cc}})
runs-on: ubuntu-latest
container: ${{matrix.container}}
strategy:
fail-fast: false # don't cancel other jobs in the matrix if one fails
matrix:
container: ['debian:testing', 'ubuntu:rolling', 'archlinux:latest']
cc: ['gcc']
cxx: ['g++']
include:
# test with clang on archlinux:latest
- container: 'archlinux:latest'
cc: 'clang'
cxx: 'clang++'
env:
# Speed up build with ccache
CC: ccache ${{matrix.cc}}
CXX: ccache ${{matrix.cxx}}
steps:
# For Debian and Ubuntu (apt-based with reasonably compatible packages)
- name: Install dependencies
if: ${{ startsWith(matrix.container, 'debian:') || startsWith(matrix.container, 'ubuntu:') }}
run: |
apt-get update -qq
apt-get install --assume-yes --no-install-recommends \
${DEB_BUILD_DEPS} ${DEB_LIBRARY_DEPS}
# For ArchLinux
- name: Install dependencies
if: ${{ startsWith(matrix.container, 'archlinux:') }}
# don't upgrade, although told otherwise (see link below), because
# apparently in the container it doesn't quit work...
# https://wiki.archlinux.org/title/System_maintenance#Partial_upgrades_are_unsupported
run: |
pacman --noconfirm -Syu
pacman --noconfirm -S ${ARCH_BUILD_DEPS}
# Checkout the repository
- uses: actions/checkout@v3
with:
path: engrampa
submodules: true
# Setup ccache cache
- name: ccache
uses: hendrikmuhs/[email protected]
# Follows regular build and test steps
- name: Configure
run: |
cd engrampa
NOCONFIGURE=1 ./autogen.sh
{ ./configure ${CONFIGURE_FLAGS} || { cat config.log; exit 1; } ; }
- name: Build
run: make -C engrampa -j ${{ env.JOBS }}
- name: Run Tests
run: make -C engrampa -j ${{ env.JOBS }} check
- name: Run distcheck
# We only run distcheck on one container, because it takes time and
# doesn't seem so useful to repeat everywhere -- it mostly checks the
# build system itself, rather than the build.
if: ${{ startsWith(matrix.container, 'debian:') }}
run: make -C engrampa -j ${{ env.JOBS }} distcheck
# Do we need the real build for cppcheck run? I don't think so
cppcheck:
name: Run cppcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
# Install code dependencies so that cppcheck has more info
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install --assume-yes --no-install-recommends \
cppcheck ${DEB_LIBRARY_DEPS}
# - define relevant configuration I can think of
# - X11-related stuff
# - Wayland-related stuff
# - in-process for Wayland
# - optional features
# - _Noreturn: this is to avoid false positive with functions that
# don't return, like g_assert(false). Here, we rely on G_NORETURN
# (GLib 2.68+) using _Noreturn C11 attribute if __STDC_VERSION__ is
# high enough (cppcheck sets it for us in newer versions, but not on
# here yet); but the version of cppcheck we run on don't know about
# the C11 attribute, so map it to the GCC one it does know.
# This is a tad over-specific, but it removes some spurious warnings,
# and defining e.g. __GNUC__=12 is simpler, but is a *lot* slower
# (more than 3 times slower), and doesn't seem to yield other
# benefits for the moment.
# - -I flags from pkg-config (grepped from configure.ac)
# - ignore non-source directories
- name: cppcheck
env:
checks: warning,style,performance,portability,information,missingInclude
defines: >
-DGETTEXT_PACKAGE="engrampa"
-D__STDC_VERSION__=201112 -D_Noreturn=__attribute__((__noreturn__))
packages: >
gio-2.0
gio-unix-2.0
gtk+-3.0
ice
json-glib-1.0
libcaja-extension
sm
run: |
cppcheck --enable="$checks" \
-j $JOBS \
$defines \
$(pkg-config --cflags-only-I $packages) \
-i engrampa/mate-submodules/ \
.