Skip to content

Add a one-command parallel runner for the whole test suite #58

Add a one-command parallel runner for the whole test suite

Add a one-command parallel runner for the whole test suite #58

Workflow file for this run

name: Build
on:
# Build on new commits or pull requests.
push:
paths-ignore:
- '**.md'
- '**.po'
- '**.pot'
pull_request:
env:
DOTNET_VERSION: 10.0.x
jobs:
build-ubuntu:
runs-on: ubuntu-24.04
# Test building with .NET 10 (and .NET 11 when available)
strategy:
matrix:
dotnet_version: [10.0.x] # [10.0.x, 11.0.x]
env:
# Skip pkg-config version checks. Ubuntu 22.04 doesn't have a recent
# enough version of the libraries for some symbols needed at runtime,
# but this doesn't matter for building.
ADW_1_CFLAGS: undefined
ADW_1_LIBS: undefined
GTK_CFLAGS: undefined
GTK_LIBS: undefined
steps:
- uses: actions/checkout@v7
# configure.ac is the single source of truth for the version, and it's what
# names the release zip - so read it from there rather than duplicating it.
- name: Set environment variables
run: |
version=$(sed -n 's/^AC_INIT(\[impasto\], \[\(.*\)\])/\1/p' configure.ac)
echo "IMPASTO_VERSION=$version" >> $GITHUB_ENV
echo "BUILD_DIR=${{runner.temp}}/impasto-$version" >> $GITHUB_ENV
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{matrix.dotnet_version}}
- name: Install Apt Dependencies
run: |
sudo apt update
sudo apt install autotools-dev autoconf-archive gettext intltool libadwaita-1-dev xvfb fonts-liberation
- name: Generate Tarball
run: |
./autogen.sh
make dist
mkdir ${{env.BUILD_DIR}}
tar -xzf impasto-${{env.IMPASTO_VERSION}}.tar.gz -C ${{runner.temp}}
- name: Create temporary global.json
if: matrix.dotnet_version == '11.0.x'
run: mv .github/workflows/dotnet11.global.json ${{env.BUILD_DIR}}/global.json
- name: Build
working-directory: ${{env.BUILD_DIR}}
run: |
./configure --prefix ${{runner.temp}}/impasto-install
make build
- name: Test
working-directory: ${{env.BUILD_DIR}}
# GTK4 opens the default display eagerly during Application/Window setup - even though
# the test harness never realizes a window, without a display at all it aborts the whole
# test host instead of degrading gracefully.
run: xvfb-run --auto-servernum make test
- name: Verify code formatting
if: matrix.dotnet_version == '10.0.x'
run: dotnet format --no-restore --verify-no-changes
- name: Test Install
working-directory: ${{env.BUILD_DIR}}
run: make install
- name: Build Installer
working-directory: ${{env.BUILD_DIR}}
run: make releasezip
- name: Upload Installer
uses: actions/upload-artifact@v7
with:
name: Impasto-linux-dotnet-${{matrix.dotnet_version}}.zip
path: ${{env.BUILD_DIR}}/impasto-${{env.IMPASTO_VERSION}}.zip
if-no-files-found: error
build-flatpak:
runs-on: ubuntu-24.04
env:
GNOME_RUNTIME: '50'
steps:
- uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{env.DOTNET_VERSION}}
- name: Install flatpak-builder and the GNOME runtime
run: |
sudo apt update
sudo apt install -y flatpak flatpak-builder
sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
sudo flatpak install -y --noninteractive flathub \
org.gnome.Platform//${{env.GNOME_RUNTIME}} org.gnome.Sdk//${{env.GNOME_RUNTIME}}
# Self-contained so the flatpak needs no .NET runtime extension at runtime.
- name: Publish
run: |
dotnet publish Impasto/Impasto.csproj -c Release -r linux-x64 --self-contained true \
-p:PublishDir=$PWD/release
cd release && zip -r ../impasto-linux-x64.zip * -x "*.pdb"
- name: Build flatpak
run: |
flatpak-builder --repo=repo --force-clean --disable-rofiles-fuse \
flatpak-build com.github.zbcoding.Impasto.yml
flatpak build-bundle repo Impasto-x86_64.flatpak com.github.zbcoding.Impasto stable
- name: Upload flatpak
uses: actions/upload-artifact@v7
with:
name: Impasto-x86_64.flatpak
path: Impasto-x86_64.flatpak
if-no-files-found: error
build-macos:
# Build for both intel and arm64
strategy:
matrix:
build: [ { dotnet_rid: osx-arm64, lib_path: "/opt/homebrew/lib", runner: macos-14 }, { dotnet_rid: osx-x64, lib_path: "/usr/local/lib", runner: macos-15-intel }]
name: build-macos (${{matrix.build.dotnet_rid}})
runs-on: ${{matrix.build.runner}}
steps:
- uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{env.DOTNET_VERSION}}
- name: Install Dependencies
env:
# Work around webp-pixbuf-loader issue: https://github.com/Homebrew/homebrew-core/issues/139497
HOMEBREW_NO_INSTALL_FROM_API: 1
run: brew install libadwaita adwaita-icon-theme gettext webp-pixbuf-loader libavif
- name: Build
run: dotnet build Pinta.sln -c Release
- name: Test
env:
# Add libraries from homebrew to the search path so they can be loaded by gir.core
DYLD_LIBRARY_PATH: ${{matrix.build.lib_path}}
run: dotnet test Pinta.sln -c Release
# ponytail: this fork has no Apple Developer ID, so the dmg is always
# unsigned - Gatekeeper needs a right-click > Open on first launch.
- name: Build Installer
if: github.event_name != 'pull_request'
run: |
cd installer/macos
./build_installer.sh ${{matrix.build.dotnet_rid}}
- name: Upload Installer
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v7
with:
name: "Impasto-${{matrix.build.dotnet_rid}}-unsigned.dmg"
path: installer/macos/Impasto.dmg
if-no-files-found: error
build-windows:
# Build for both x64 and arm64
strategy:
matrix:
build: [ { dotnet_rid: win-x64, mingw_folder: "${MINGW_PREFIX}/../clang64", mingw_system: clang64, mingw_repo: clang-x86_64, setup_arch: x64os, runner: windows-2025 }, { dotnet_rid: win-arm64, mingw_folder: "${MINGW_PREFIX}/../clangarm64", mingw_system: clangarm64, mingw_repo: clang-aarch64, setup_arch: arm64, runner: windows-11-arm }]
name: build-windows (${{matrix.build.dotnet_rid}})
runs-on: ${{matrix.build.runner}}
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v7
- uses: microsoft/setup-msbuild@v3.0.0
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{env.DOTNET_VERSION}}
- name: Install dependencies
uses: msys2/setup-msys2@v2
with:
path-type: inherit # Inherit the path so that dotnet can be found
update: true
msystem: ${{matrix.build.mingw_system}}
install: mingw-w64-${{matrix.build.mingw_repo}}-libadwaita mingw-w64-${{matrix.build.mingw_repo}}-webp-pixbuf-loader mingw-w64-${{matrix.build.mingw_repo}}-libavif mingw-w64-${{matrix.build.mingw_repo}}-aom
- name: Build
run: dotnet build Pinta.sln -c Release -p:MinGWFolder=${{matrix.build.mingw_folder}}
- name: Test
run: dotnet test Pinta.sln -c Release -p:MinGWFolder=${{matrix.build.mingw_folder}}
# Note that msgfmt is already available from the Git for Windows installation!
- name: Build Installer
run: |
choco install innosetup -y -v
dotnet publish Impasto/Impasto.csproj -p:BuildTranslations=true -p:MinGWFolder=${{matrix.build.mingw_folder}} -c Release -r ${{matrix.build.dotnet_rid}} --self-contained true -p:PublishDir=../release/bin
cp -r release/bin/icons release/bin/locale release/share/
rm -rf release/bin/icons release/bin/locale
cp installer/macos/hicolor.index.theme release/share/icons/hicolor/index.theme
version=$(sed -n 's/^AC_INIT(\[impasto\], \[\(.*\)\])/\1/p' configure.ac)
iscc -DProductArch="${{matrix.build.setup_arch}}" -DProductVersion="$version" installer/windows/installer.iss
- name: Upload Installer
uses: actions/upload-artifact@v7
with:
name: "Impasto-${{matrix.build.dotnet_rid}}.exe"
path: installer/windows/Impasto.exe
if-no-files-found: error
# On a v* tag, publish the built artifacts as a GitHub release.
release:
needs: [build-ubuntu, build-flatpak, build-macos, build-windows]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/download-artifact@v6
with:
path: artifacts
- name: Flatten (artifact dir names are already the filenames)
run: |
mkdir out
for d in artifacts/*/; do mv "$d"* "out/$(basename "$d")"; done
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "$GITHUB_REF_NAME" out/* --generate-notes --repo "$GITHUB_REPOSITORY"
# Keep only the 2 most recent artifacts per name to stay under storage quota.
prune-artifacts:
needs: build-ubuntu
if: always() && github.event_name != 'pull_request'
runs-on: ubuntu-24.04
permissions:
actions: write
steps:
- name: Delete all but newest 2 artifacts per name
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
run: |
gh api "repos/$REPO/actions/artifacts?per_page=100" --paginate \
--jq '.artifacts | group_by(.name)[] | sort_by(.created_at) | reverse | .[2:][] | .id' \
| while read -r id; do
[ -n "$id" ] && gh api -X DELETE "repos/$REPO/actions/artifacts/$id"
done