Attempt packaging for Ubuntu 24.04 #207
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
jobs: | |
build: | |
# Perform a generic build in case of any critical errors | |
name: Build | |
runs-on: ubuntu-22.04 | |
steps: | |
# Checks out under $GITHUB_WORKSPACE | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Check series file | |
run: | | |
for patch in $(ls *.patch); do | |
grep "$patch" series | |
if [ $? != 0 ]; then | |
echo "::error title=$patch::Patch is missing from series file" | |
exit 1 | |
fi | |
done | |
- name: Get GTK Version | |
run: | | |
source PKGBUILD | |
echo "GTK_VERSION=${_gtkver}" >> $GITHUB_ENV | |
- name: Install Dependencies | |
run: | | |
echo "deb-src http://gb.archive.ubuntu.com/ubuntu/ focal main" | sudo tee -a /etc/apt/sources.list | |
sudo apt-get update | |
sudo apt-get build-dep gtk+3.0 | |
sudo apt-get install quilt sassc meson ninja-build cmake | |
sudo apt-get install libgif-dev libelf-dev | |
- name: Cache GTK Source | |
uses: actions/cache@v3 | |
id: gtksrc | |
with: | |
path: 'gtk+*.tar.xz' | |
key: gtk-${{ env.GTK_VERSION }} | |
- name: Download GTK Source | |
#if: steps.gtksrc.outputs.cache-hit != 'true' | |
run: | | |
source PKGBUILD | |
wget https://download.gnome.org/sources/gtk+/${pkgver%.*}/gtk+-${_gtkver}.tar.xz | |
- name: Extract GTK Source | |
run: | | |
source PKGBUILD | |
tar -xJf gtk+*.tar.xz | |
# Uses PKGBUILD prepare() directly | |
- name: Apply Patches | |
run: | | |
source PKGBUILD | |
srcdir="$(pwd)" | |
prepare | |
# Based on PKGBUILD build() | |
# Build system may connect to GNOME's GitLab to retrieve glib dependency | |
- name: Build | |
run: | | |
source PKGBUILD | |
CFLAGS+=" -DG_DISABLE_CAST_CHECKS" | |
meson gtk+-${_gtkver} build \ | |
-D broadway_backend=true \ | |
-D colord=auto \ | |
-D demos=false \ | |
-D examples=false \ | |
-D introspection=true \ | |
-D tests=false \ | |
-D installed_tests=false | |
ninja -C build | |
makepkg: | |
# Create artifacts for the Arch packages for convenient testing, and to | |
# validate the package integrity with changes. | |
name: 'Package / Arch' | |
runs-on: ubuntu-latest | |
steps: | |
# Checks out under $GITHUB_WORKSPACE | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get GTK Version | |
run: | | |
source PKGBUILD | |
echo "GTK_VERSION=${_gtkver}" >> $GITHUB_ENV | |
- name: Cache Pacman Packages | |
uses: actions/cache@v3 | |
env: | |
cache-name: pacman-cache | |
with: | |
path: ~/pacman-cache | |
key: pacman-cache | |
- name: Cache GTK Source | |
uses: actions/cache@v3 | |
id: gtksrc | |
with: | |
path: 'gtk+*.tar.xz' | |
key: gtk-${{ env.GTK_VERSION }} | |
- name: Generate Checksum | |
run: | | |
cp PKGBUILD PKGBUILD.before | |
md5sum PKGBUILD >> PKGBUILD.md5 | |
- name: Start Arch Linux | |
run: | | |
# Start and update Arch Linux within a Docker container | |
docker run --privileged -d -t -v ~/pacman-cache/pkg:/var/cache/pacman/pkg -v $GITHUB_WORKSPACE:/workspace --name archlinux archlinux:base-devel | |
docker exec archlinux pacman -Syu --noconfirm namcap | |
# Add user | |
docker exec archlinux useradd builder | |
docker exec archlinux /bin/bash -c "echo 'builder ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers" | |
docker exec archlinux chown -R builder /workspace | |
- name: Validate Package | |
run: | | |
# Validate the PKGBUILD is the same and free from errors | |
docker exec --workdir=/workspace --user builder archlinux makepkg --geninteg | |
docker exec --workdir=/workspace --user builder archlinux namcap -i PKGBUILD | |
- name: Build Arch Package | |
run: | | |
docker exec --workdir=/workspace --user builder archlinux makepkg -s --noconfirm | |
- name: Stop Arch Linux | |
run: | | |
docker stop archlinux -t 1 | |
docker rm archlinux | |
- name: Verify Checksum | |
run: | | |
echo "If this fails, the PKGBUILD needs updating" | |
diff PKGBUILD.before PKGBUILD | |
md5sum -c PKGBUILD.md5 | |
- name: 'Upload Artifact: gtk3-classic' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: gtk3-classic-run${{github.run_number}}-pkg | |
path: gtk3-classic-*.pkg* |