|
| 1 | +name: CI Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +# cancel already running builds of the same branch or pull request |
| 13 | +concurrency: |
| 14 | + group: ci-${{ github.head_ref }} || concat(${{ github.ref }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +env: |
| 18 | + MATE_PANEL_DEP: 1.27.1 |
| 19 | + CONFIGURE_FLAGS: --enable-compile-warnings=maximum |
| 20 | + CFLAGS: -g -O2 -Werror=pointer-arith -Werror=implicit-function-declaration |
| 21 | + JOBS: 2 |
| 22 | + DEBUG: 1 |
| 23 | + # Useful URL: https://github.com/mate-desktop/debian-packages |
| 24 | + # Useful URL: https://salsa.debian.org/debian-mate-team/mate-panel |
| 25 | + DEB_LIBRARY_DEPS: | |
| 26 | + libcaja-extension-dev |
| 27 | + libglib2.0-dev |
| 28 | + libgtk-3-dev |
| 29 | + libjson-glib-dev |
| 30 | + libmagic-dev |
| 31 | + DEB_BUILD_DEPS: | |
| 32 | + ccache |
| 33 | + autoconf-archive |
| 34 | + autopoint |
| 35 | + git |
| 36 | + gettext |
| 37 | + make |
| 38 | + mate-common |
| 39 | + yelp-tools |
| 40 | + # Useful URL: https://git.archlinux.org/svntogit/community.git/tree/mate-panel |
| 41 | + ARCH_BUILD_DEPS: | |
| 42 | + ccache |
| 43 | + autoconf-archive |
| 44 | + caja |
| 45 | + clang |
| 46 | + file |
| 47 | + gcc |
| 48 | + git |
| 49 | + gtk3 |
| 50 | + json-glib |
| 51 | + make |
| 52 | + mate-common |
| 53 | + which |
| 54 | + yelp-tools |
| 55 | +
|
| 56 | +jobs: |
| 57 | + build: |
| 58 | + name: Build on ${{matrix.container}} with in-process=${{matrix.in-process}} (using ${{matrix.cc}}) |
| 59 | + runs-on: ubuntu-latest |
| 60 | + container: ${{matrix.container}} |
| 61 | + |
| 62 | + strategy: |
| 63 | + fail-fast: false # don't cancel other jobs in the matrix if one fails |
| 64 | + matrix: |
| 65 | + container: ['debian:testing', 'ubuntu:rolling', 'archlinux:latest'] |
| 66 | + cc: ['gcc'] |
| 67 | + cxx: ['g++'] |
| 68 | + include: |
| 69 | + # test with clang on archlinux:latest |
| 70 | + - container: 'archlinux:latest' |
| 71 | + cc: 'clang' |
| 72 | + cxx: 'clang++' |
| 73 | + |
| 74 | + env: |
| 75 | + # Speed up build with ccache |
| 76 | + CC: ccache ${{matrix.cc}} |
| 77 | + CXX: ccache ${{matrix.cxx}} |
| 78 | + |
| 79 | + steps: |
| 80 | + # For Debian and Ubuntu (apt-based with reasonably compatible packages) |
| 81 | + - name: Install dependencies |
| 82 | + if: ${{ startsWith(matrix.container, 'debian:') || startsWith(matrix.container, 'ubuntu:') }} |
| 83 | + run: | |
| 84 | + apt-get update -qq |
| 85 | + apt-get install --assume-yes --no-install-recommends \ |
| 86 | + ${DEB_BUILD_DEPS} ${DEB_LIBRARY_DEPS} |
| 87 | +
|
| 88 | + # For ArchLinux |
| 89 | + - name: Install dependencies |
| 90 | + if: ${{ startsWith(matrix.container, 'archlinux:') }} |
| 91 | + # don't upgrade, although told otherwise (see link below), because |
| 92 | + # apparently in the container it doesn't quit work... |
| 93 | + # https://wiki.archlinux.org/title/System_maintenance#Partial_upgrades_are_unsupported |
| 94 | + run: | |
| 95 | + pacman --noconfirm -Syu |
| 96 | + pacman --noconfirm -S ${ARCH_BUILD_DEPS} |
| 97 | +
|
| 98 | + # Checkout the repository |
| 99 | + - uses: actions/checkout@v3 |
| 100 | + with: |
| 101 | + path: engrampa |
| 102 | + submodules: true |
| 103 | + |
| 104 | + # Setup ccache cache |
| 105 | + - name: ccache |
| 106 | + uses: hendrikmuhs/[email protected] |
| 107 | + |
| 108 | + # Follows regular build and test steps |
| 109 | + |
| 110 | + - name: Configure |
| 111 | + run: | |
| 112 | + cd engrampa |
| 113 | + NOCONFIGURE=1 ./autogen.sh |
| 114 | + { ./configure ${CONFIGURE_FLAGS} || { cat config.log; exit 1; } ; } |
| 115 | +
|
| 116 | + - name: Build |
| 117 | + run: make -C engrampa -j ${{ env.JOBS }} |
| 118 | + |
| 119 | + - name: Run Tests |
| 120 | + run: make -C engrampa -j ${{ env.JOBS }} check |
| 121 | + |
| 122 | + - name: Run distcheck |
| 123 | + # We only run distcheck on one container, because it takes time and |
| 124 | + # doesn't seem so useful to repeat everywhere -- it mostly checks the |
| 125 | + # build system itself, rather than the build. |
| 126 | + if: ${{ startsWith(matrix.container, 'debian:') }} |
| 127 | + run: make -C engrampa -j ${{ env.JOBS }} distcheck |
| 128 | + |
| 129 | + # Do we need the real build for cppcheck run? I don't think so |
| 130 | + cppcheck: |
| 131 | + name: Run cppcheck |
| 132 | + runs-on: ubuntu-latest |
| 133 | + |
| 134 | + steps: |
| 135 | + - uses: actions/checkout@v3 |
| 136 | + with: |
| 137 | + submodules: true |
| 138 | + |
| 139 | + # Install code dependencies so that cppcheck has more info |
| 140 | + - name: Install dependencies |
| 141 | + run: | |
| 142 | + sudo apt-get update -qq |
| 143 | + sudo apt-get install --assume-yes --no-install-recommends \ |
| 144 | + cppcheck ${DEB_LIBRARY_DEPS} |
| 145 | +
|
| 146 | + # - define relevant configuration I can think of |
| 147 | + # - X11-related stuff |
| 148 | + # - Wayland-related stuff |
| 149 | + # - in-process for Wayland |
| 150 | + # - optional features |
| 151 | + # - _Noreturn: this is to avoid false positive with functions that |
| 152 | + # don't return, like g_assert(false). Here, we rely on G_NORETURN |
| 153 | + # (GLib 2.68+) using _Noreturn C11 attribute if __STDC_VERSION__ is |
| 154 | + # high enough (cppcheck sets it for us in newer versions, but not on |
| 155 | + # here yet); but the version of cppcheck we run on don't know about |
| 156 | + # the C11 attribute, so map it to the GCC one it does know. |
| 157 | + # This is a tad over-specific, but it removes some spurious warnings, |
| 158 | + # and defining e.g. __GNUC__=12 is simpler, but is a *lot* slower |
| 159 | + # (more than 3 times slower), and doesn't seem to yield other |
| 160 | + # benefits for the moment. |
| 161 | + # - -I flags from pkg-config (grepped from configure.ac) |
| 162 | + # - ignore non-source directories |
| 163 | + - name: cppcheck |
| 164 | + env: |
| 165 | + checks: warning,style,performance,portability,information,missingInclude |
| 166 | + defines: > |
| 167 | + -DGETTEXT_PACKAGE="engrampa" |
| 168 | + -D__STDC_VERSION__=201112 -D_Noreturn=__attribute__((__noreturn__)) |
| 169 | + packages: > |
| 170 | + gio-2.0 |
| 171 | + gio-unix-2.0 |
| 172 | + gtk+-3.0 |
| 173 | + ice |
| 174 | + json-glib-1.0 |
| 175 | + libcaja-extension |
| 176 | + sm |
| 177 | + run: | |
| 178 | + cppcheck --enable="$checks" \ |
| 179 | + -j $JOBS \ |
| 180 | + $defines \ |
| 181 | + $(pkg-config --cflags-only-I $packages) \ |
| 182 | + -i engrampa/mate-submodules/ \ |
| 183 | + . |
0 commit comments