diff options
| -rw-r--r-- | .github/dependabot.yml | 8 | ||||
| -rwxr-xr-x | .github/workflows/archlinux.sh | 47 | ||||
| -rwxr-xr-x | .github/workflows/builds.sh | 65 | ||||
| -rw-r--r-- | .github/workflows/builds.yml | 84 | ||||
| -rwxr-xr-x | .github/workflows/debian.sh | 54 | ||||
| -rwxr-xr-x | .github/workflows/fedora.sh | 46 | ||||
| -rw-r--r-- | .github/workflows/release.yml | 35 | ||||
| -rwxr-xr-x | .github/workflows/ubuntu.sh | 54 | 
8 files changed, 393 insertions, 0 deletions
| diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..80851cd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +# Enable dependabot to keep our GHA pins automatically +# updated, so we don't fall too far behind in the future +version: 2 +updates: +  - package-ecosystem: github-actions +    directory: "/" +    schedule: +      interval: weekly diff --git a/.github/workflows/archlinux.sh b/.github/workflows/archlinux.sh new file mode 100755 index 0000000..0ba1ef7 --- /dev/null +++ b/.github/workflows/archlinux.sh @@ -0,0 +1,47 @@ +#!/usr/bin/bash + +# 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 +) + +requires+=( +	autoconf-archive +	appstream-glib +	autoconf-archive +	desktop-file-utils +	exempi +	gcc +	git +	glib2-devel +	gobject-introspection +	imagemagick +	itstool +	lcms2 +	libexif +	libjpeg-turbo +	libpeas +	make +	mate-desktop +	mate-common +	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..c80e76a --- /dev/null +++ b/.github/workflows/builds.sh @@ -0,0 +1,65 @@ +#!/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 && $1 == "meson" ]]; 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 +	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} +	ninja -C _build dist +	infoend +fi + +if [[ -f autogen.sh && $1 == "autotools" ]]; 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 || { +		find -name test-suite.log -exec cat {} \; +		exit 1 +	} +	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..43db606 --- /dev/null +++ b/.github/workflows/builds.yml @@ -0,0 +1,84 @@ +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 + +jobs: +  build: +    name: ${{matrix.container}} (${{matrix.cc}} ${{matrix.build-system}}) +    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++"] +        build-system: ["autotools", "meson"] +        include: +          - container: "archlinux:latest" +            build-system: "autotools" +            cc: "clang" +            cxx: "clang++" +          - container: "archlinux:latest" +            build-system: "meson" +            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@v4 +        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 }} +      - name: Build the source code +        run: .github/workflows/builds.sh ${{ matrix.build-system }} diff --git a/.github/workflows/debian.sh b/.github/workflows/debian.sh new file mode 100755 index 0000000..f9bba4f --- /dev/null +++ b/.github/workflows/debian.sh @@ -0,0 +1,54 @@ +#!/usr/bin/bash + +# 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 +	desktop-file-utils +	git +	gobject-introspection +	gtk-doc-tools +	libdconf-dev +	libexempi-dev +	libexif-dev +	libgirepository1.0-dev +	libglib2.0-dev +	libgtk-3-dev +	libjpeg-dev +	liblcms2-dev +	libmagickwand-dev +	libmate-desktop-dev +	libpeas-dev +	librsvg2-dev +	libstartup-notification0-dev +	libxml2-dev +	make +	mate-common +	shared-mime-info +	x11proto-core-dev +	yelp-tools +	zlib1g-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..4c1ffcf --- /dev/null +++ b/.github/workflows/fedora.sh @@ -0,0 +1,46 @@ +#!/usr/bin/bash + +# 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 +	desktop-file-utils +	exempi-devel +	gcc +	git +	gobject-introspection-devel +	gtk3-devel +	ImageMagick-devel +	lcms2-devel +	libappstream-glib-devel +	libexif-devel +	libjpeg-turbo-devel +	libpeas1-devel +	librsvg2-devel +	libxml2-devel +	make +	mate-common +	mate-desktop-devel +	redhat-rpm-config +	zlib-devel +) + +infobegin "Update system" +dnf update -y +infoend + +infobegin "Install dependency packages" +dnf install -y ${requires[@]} +infoend diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8d60b7f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Release Version +on: +  push: +    tags: +      - "v*.*.*" + +env: +  CACHE_PATH: /tmp/.cache + +jobs: +  release: +    name: Release New Version +    runs-on: ubuntu-latest +    steps: +      - name: Repository checkout +        uses: actions/checkout@v4 +        with: +          submodules: "true" + +      - name: Install dependency packages +        run: sudo .github/workflows/ubuntu.sh + +      - name: Build the source code +        run: .github/workflows/builds.sh meson + +      - name: Install GH CLI +        uses: dev-hanz-ops/[email protected] +        with: +          gh-cli-version: 2.39.1 + +      - name: Create github release +        run: | +          gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --generate-notes _build/meson-dist/* +        env: +          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ubuntu.sh b/.github/workflows/ubuntu.sh new file mode 100755 index 0000000..e55baa6 --- /dev/null +++ b/.github/workflows/ubuntu.sh @@ -0,0 +1,54 @@ +#!/usr/bin/bash + +# 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 +	desktop-file-utils +	git +	gobject-introspection +	gtk-doc-tools +	libdconf-dev +	libexempi-dev +	libexif-dev +	libgirepository1.0-dev +	libglib2.0-dev +	libgtk-3-dev +	libjpeg-dev +	liblcms2-dev +	libmagickwand-dev +	libmate-desktop-dev +	libpeas-dev +	librsvg2-dev +	libstartup-notification0-dev +	libxml2-dev +	make +	mate-common +	shared-mime-info +	x11proto-core-dev +	yelp-tools +	zlib1g-dev +) + +infobegin "Update system" +apt-get update -y +infoend + +infobegin "Install dependency packages" +env DEBIAN_FRONTEND=noninteractive \ +	apt-get install --assume-yes \ +	${requires[@]} +infoend | 
