diff options
| author | mbkma <[email protected]> | 2026-01-27 23:12:49 +0100 |
|---|---|---|
| committer | Victor Kareh <[email protected]> | 2026-04-10 10:22:36 -0400 |
| commit | 7027666c9a0b988e38176ce02f94a1bfa23a28d6 (patch) | |
| tree | e3fe43cfce361a8886552e0b63be05a217a8e210 /.github/workflows | |
| parent | 239eecf1017a480b4f3abb1db6c8742d820ece12 (diff) | |
| download | mate-power-manager-7027666c9a0b988e38176ce02f94a1bfa23a28d6.tar.bz2 mate-power-manager-7027666c9a0b988e38176ce02f94a1bfa23a28d6.tar.xz | |
ci: migrate from Travis CI to GitHub Actions
Replace Travis CI configuration with GitHub Actions workflows.
Add CI build workflow for Debian, Fedora, Ubuntu, and Archlinux.
Add release workflow for automated GitHub releases on tags.
Add dependabot configuration for GHA pin updates.
Remove obsolete .travis.yml.
Diffstat (limited to '.github/workflows')
| -rwxr-xr-x | .github/workflows/archlinux.sh | 49 | ||||
| -rwxr-xr-x | .github/workflows/builds.sh | 66 | ||||
| -rw-r--r-- | .github/workflows/builds.yml | 95 | ||||
| -rwxr-xr-x | .github/workflows/debian.sh | 59 | ||||
| -rwxr-xr-x | .github/workflows/fedora.sh | 51 | ||||
| -rwxr-xr-x | .github/workflows/mate-desktop.sh | 99 | ||||
| -rw-r--r-- | .github/workflows/release.yml | 33 | ||||
| -rwxr-xr-x | .github/workflows/ubuntu.sh | 57 |
8 files changed, 509 insertions, 0 deletions
diff --git a/.github/workflows/archlinux.sh b/.github/workflows/archlinux.sh new file mode 100755 index 0000000..c58c655 --- /dev/null +++ b/.github/workflows/archlinux.sh @@ -0,0 +1,49 @@ +#!/usr/bin/bash + +set -eo pipefail + +# Use grouped output messages +infobegin() { + echo "::group::${1}" +} +infoend() { + echo "::endgroup::" +} + +# Required packages on Archlinux +requires=( + ccache # Use ccache to speed up build + clang # Build with clang on Archlinux + meson # Used for meson build +) + +# https://gitlab.archlinux.org/archlinux/packaging/packages/mate-power-manager +requires+=( + autoconf-archive + dbus-glib + gcc + gettext + git + glib2-devel + gobject-introspection + itstool + libcanberra + libnotify + libsecret + make + mate-common + mate-panel + polkit + python + upower + which + yelp-tools +) + +infobegin "Update system" +pacman --noconfirm -Syu +infoend + +infobegin "Install dependency packages" +pacman --noconfirm -S ${requires[@]} +infoend diff --git a/.github/workflows/builds.sh b/.github/workflows/builds.sh new file mode 100755 index 0000000..992281a --- /dev/null +++ b/.github/workflows/builds.sh @@ -0,0 +1,66 @@ +#!/usr/bin/bash + +set -e +set -o pipefail + +CPUS=$(grep processor /proc/cpuinfo | wc -l) + +# Use grouped output messages +infobegin() { + echo "::group::${1}" +} +infoend() { + echo "::endgroup::" +} + +# Run meson first, then run autotools +# Because meson dist requires a clean git workspace +# Autotools will modify some files (such as po, etc.), making them dirty. +if [ -f meson.build ]; then + + infobegin "Configure (meson)" + meson setup _build --prefix=/usr + infoend + + infobegin "Build (meson)" + meson compile -C _build + infoend + + infobegin "Test (meson)" + ninja -C _build test || { + true + } + infoend + + infobegin "Dist (meson)" + # Git safedirectory stop ninja dist + # https://github.com/git/git/commit/8959555cee7ec045958f9b6dd62e541affb7e7d9 + # https://git-scm.com/docs/git-config/2.35.2#Documentation/git-config.txt-safedirectory + git config --global --add safe.directory ${PWD} + meson dist -C _build --no-tests + infoend +fi + +if [ -f autogen.sh ]; then + infobegin "Configure (autotools)" + NOCONFIGURE=1 ./autogen.sh + ./configure --prefix=/usr --enable-compile-warnings=maximum || { + cat config.log + exit 1 + } + infoend + + infobegin "Build (autotools)" + make -j ${CPUS} + infoend + + infobegin "Check (autotools)" + make -j ${CPUS} check || { + true + } + infoend + + infobegin "Distcheck (autotools)" + make -j ${CPUS} distcheck + infoend +fi diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml new file mode 100644 index 0000000..c45df72 --- /dev/null +++ b/.github/workflows/builds.yml @@ -0,0 +1,95 @@ +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.workflow }}-${{ github.event.pull_request.number || github.head_ref || github.sha }} + cancel-in-progress: true + +env: + MATE_DESKTOP_VERSION: 1.28.2 + CACHE_PATH: /tmp/.cache + + +jobs: + build: + name: Build on ${{matrix.container}} (using ${{matrix.cc}}) + runs-on: ubuntu-latest + container: + image: ${{matrix.container}} + volumes: + - /tmp/.cache + - /var/cache/apt + + strategy: + fail-fast: false # don't cancel other jobs in the matrix if one fails + matrix: + container: + [ + "debian:testing", + "fedora:latest", + "ubuntu:rolling", + "archlinux:latest", + ] + cc: ["gcc"] + cxx: ["g++"] + include: + - container: "archlinux:latest" + cc: "clang" + cxx: "clang++" + + env: + # Speed up build with ccache + CC: ccache ${{ matrix.cc }} + CXX: ccache ${{ matrix.cxx }} + CONTAINER: ${{ matrix.container }} + + steps: + - name: Setup environment variables + id: distro-name + shell: bash + run: | + split=(${CONTAINER//:/ }) + distro=${split[0]} + short_sha=${SHA:0:8} + echo "DISTRO=$distro" | tee -a $GITHUB_ENV + - name: Install git command + shell: bash + run: | + echo "::group::Install git ..." + apt-get update -qq && apt-get install --assume-yes git || true + dnf update -y && dnf install -y git || true + pacman --noconfirm -Sy git || true + echo "::endgroup::" + - name: Repository checkout + uses: actions/checkout@v6 + with: + submodules: "true" + - name: Install dependency packages + run: .github/workflows/${{ env.DISTRO }}.sh + - name: Enable ccache to speed up builds + uses: hendrikmuhs/[email protected] + with: + key: ${{ env.DISTRO }}-${{ matrix.cc }} + + # INFO: mate-power-manager depends on newer mate-desktop APIs, so we should install it from source. + - name: Cache mate-desktop binary packages + uses: actions/cache@v5 + id: cache-mate-desktop + with: + path: ${{ env.CACHE_PATH }} + key: ${{ env.DISTRO }}-build-mate-desktop-${{env.MATE_DESKTOP_VERSION}} + - name: Built and install mate-desktop from source + run: .github/workflows/mate-desktop.sh ${{env.MATE_DESKTOP_VERSION}} ${{ env.CACHE_PATH }} + # INFO: mate-desktop install finished. + + - name: Build the source code + run: .github/workflows/builds.sh diff --git a/.github/workflows/debian.sh b/.github/workflows/debian.sh new file mode 100755 index 0000000..b85052b --- /dev/null +++ b/.github/workflows/debian.sh @@ -0,0 +1,59 @@ +#!/usr/bin/bash + +set -eo pipefail + +# Use grouped output messages +infobegin() { + echo "::group::${1}" +} +infoend() { + echo "::endgroup::" +} + +# Required packages on Debian +requires=( + ccache # Use ccache to speed up build + meson # Used for meson build +) + +requires+=( + autoconf-archive + autopoint + gcc + git + libcanberra-gtk3-dev + libdbus-glib-1-dev + libgcrypt20-dev + libglib2.0-dev + libgtk-3-dev + libmate-panel-applet-dev + libnotify-dev + libsecret-1-dev + libtool-bin + libupower-glib-dev + libx11-dev + libxext-dev + libxml-parser-perl + libxrandr-dev + make + mate-common + pkg-config + xmlto + yelp-tools + appstream + libpolkit-gobject-1-dev + iso-codes + gobject-introspection + libgirepository1.0-dev + libdconf-dev +) + +infobegin "Update system" +apt-get update -qq +infoend + +infobegin "Install dependency packages" +env DEBIAN_FRONTEND=noninteractive \ + apt-get install --assume-yes \ + ${requires[@]} +infoend diff --git a/.github/workflows/fedora.sh b/.github/workflows/fedora.sh new file mode 100755 index 0000000..b71a495 --- /dev/null +++ b/.github/workflows/fedora.sh @@ -0,0 +1,51 @@ +#!/usr/bin/bash + +set -eo pipefail + +# Use grouped output messages +infobegin() { + echo "::group::${1}" +} +infoend() { + echo "::endgroup::" +} + +# Required packages on Fedora +requires=( + ccache # Use ccache to speed up build + meson # Used for meson build +) + +requires+=( + autoconf-archive + cairo-devel + dbus-glib-devel + desktop-file-utils + gcc + git + glib2-devel + gtk3-devel + libcanberra-devel + libgnome-keyring-devel + libnotify-devel + libsecret-devel + make + mate-common + mate-panel-devel + mesa-libGL-devel + polkit-devel + popt-devel + redhat-rpm-config + upower-devel + iso-codes-devel + gobject-introspection-devel + dconf-devel +) + +infobegin "Update system" +dnf update -y +infoend + +infobegin "Install dependency packages" +dnf install -y ${requires[@]} +infoend diff --git a/.github/workflows/mate-desktop.sh b/.github/workflows/mate-desktop.sh new file mode 100755 index 0000000..ab4c6fd --- /dev/null +++ b/.github/workflows/mate-desktop.sh @@ -0,0 +1,99 @@ +#!/usr/bin/bash + +set -e +set -o pipefail + +NAME="mate-desktop" +TEMP_DIR=$(mktemp -d) +OS=$(cat /etc/os-release | grep ^ID | head -n 1 | awk -F= '{ print $2}') +TAG=$1 +CACHE_DIR=$2 + +# Use grouped output messages +infobegin() { + echo "::group::${1}" +} +infoend() { + echo "::endgroup::" +} + +# Required packages to build mate-desktop +debian_requires=( + libgirepository1.0-dev + yelp-tools + iso-codes + gobject-introspection +) + +fedora_requires=( + iso-codes + gobject-introspection +) + +ubuntu_requires=( + libgirepository1.0-dev + yelp-tools + iso-codes + gobject-introspection +) + +requires=$(eval echo '${'"${OS}_requires[@]}") + +infobegin "Install Depends for mate-desktop" +case ${OS} in +arch) + #pacman --noconfirm -Syu + #pacman --noconfirm -S ${requires[@]} + ;; +debian | ubuntu) + apt-get update -qq + env DEBIAN_FRONTEND=noninteractive \ + apt-get install --assume-yes --no-install-recommends ${requires[@]} + ;; +fedora) + dnf update -y + dnf install -y ${requires[@]} + ;; +esac +infoend + +# Use cached packages first +if [ -f $CACHE_DIR/${NAME}-${TAG}.tar.xz ]; then + echo "Found cache package, reuse it" + tar -C / -Jxf $CACHE_DIR/${NAME}-${TAG}.tar.xz +else + git clone --recurse-submodules https://github.com/mate-desktop/${NAME} + + # Foldable output information + infobegin "Configure" + cd ${NAME} + git checkout v${TAG} + if [[ ${OS} == "debian" || ${OS} == "ubuntu" ]]; then + ./autogen.sh --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/x86_64-linux-gnu || { + cat config.log + exit 1 + } + else + ./autogen.sh --prefix=/usr || { + cat config.log + exit 1 + } + fi + infoend + + infobegin "Build" + make -j ${JOBS} + infoend + + infobegin "Install" + make install + infoend + + # Cache this package version + infobegin "Cache" + [ -d ${CACHE_DIR} ] || mkdir -p ${CACHE_DIR} + make install DESTDIR=${TEMP_DIR} + cd $TEMP_DIR + tar -J -cf $CACHE_DIR/${NAME}-${TAG}.tar.xz * + infoend +fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8f35631 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: Release Version +on: + push: + tags: + - "v*.*.*" + +env: + MATE_DESKTOP_VERSION: 1.28.2 + CACHE_PATH: /tmp/.cache + +jobs: + release: + name: Release New Version + runs-on: ubuntu-latest + steps: + - name: Repository checkout + uses: actions/checkout@v6 + with: + submodules: "true" + + - name: Install dependency packages + run: sudo .github/workflows/ubuntu.sh + + - name: Install higher version mate-desktop component packages + run: sudo .github/workflows/mate-desktop.sh ${{env.MATE_DESKTOP_VERSION}} ${{ env.CACHE_PATH }} + + - name: Build the source code + run: .github/workflows/builds.sh autotools + - name: Create github release + run: | + gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --generate-notes mate-power-manager-*.tar.xz + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ubuntu.sh b/.github/workflows/ubuntu.sh new file mode 100755 index 0000000..888fde1 --- /dev/null +++ b/.github/workflows/ubuntu.sh @@ -0,0 +1,57 @@ +#!/usr/bin/bash + +set -eo pipefail + +# Use grouped output messages +infobegin() { + echo "::group::${1}" +} +infoend() { + echo "::endgroup::" +} + +# Required packages on Ubuntu +requires=( + ccache # Use ccache to speed up build + meson # Used for meson build +) + +requires+=( + autoconf-archive + autopoint + gcc + git + libcanberra-gtk3-dev + libdbus-glib-1-dev + libgcrypt20-dev + libglib2.0-dev + libgtk-3-dev + libmate-panel-applet-dev + libnotify-dev + libsecret-1-dev + libtool-bin + libupower-glib-dev + libx11-dev + libxext-dev + libxml-parser-perl + libxrandr-dev + make + mate-common + pkg-config + xmlto + yelp-tools + iso-codes + gobject-introspection + libgirepository1.0-dev + libdconf-dev +) + +infobegin "Update system" +apt-get update -y +infoend + +infobegin "Install dependency packages" +env DEBIAN_FRONTEND=noninteractive \ + apt-get install --assume-yes \ + ${requires[@]} +infoend |
