Skip to content

Commit

Permalink
Add CI workflows for DEB, RPM, and AppImage builds
Browse files Browse the repository at this point in the history
- Added `build-deb-packages.yml` to automate the creation of DEB
  packages using `debuild` for all supported Ubuntu and Debian versions.

- Added `build-rpm-packages.yml` to automate the creation of RPM
  packages using `rpmbuild` for all supported Fedora and AlmaLinux
  versions.

- Added `build-appimage.yml` to build an AppImage on CentOS 7, ensuring
  compatibility with systems using `glibc <= 2.17`.

Each workflow includes automated tests and artifact uploads, improving
the packaging and distribution process across multiple Linux
distributions.
  • Loading branch information
Eric Wheeler committed Aug 14, 2024
1 parent d41c39f commit 8e42f4c
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build-appimage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build AppImage

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Set up CentOS 7 Docker
run: |
docker run --rm -v $(pwd):/workspace -w /workspace centos:7 /bin/bash -c "
yum install -y epel-release
yum groupinstall -y 'Development Tools'
yum install -y gtk3-devel glib2-devel gettext-devel desktop-file-utils \
patchelf wget libtool autoconf automake pkgconfig
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
./autogen.sh
./configure
make
./linuxdeploy-x86_64.AppImage --appdir AppDir --init-appdir
cp src/xnec2c AppDir/usr/bin/
cp resources/xnec2c.svg AppDir/usr/share/icons/hicolor/scalable/apps/
cp files/xnec2c.desktop AppDir/usr/share/applications/
./linuxdeploy-x86_64.AppImage --appdir AppDir --output appimage
mv *.AppImage xnec2c-${{ github.sha }}.AppImage
chmod +x xnec2c-${{ github.sha }}.AppImage
./xnec2c-${{ github.sha }}.AppImage --appimage-extract-and-run -h
"
- name: Upload the AppImage
uses: actions/upload-artifact@v2
with:
name: xnec2c.AppImage
path: xnec2c-${{ github.sha }}.AppImage
46 changes: 46 additions & 0 deletions .github/workflows/build-deb-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build DEB Packages

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04, debian-11, debian-10, debian-9]

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up the build environment
run: |
sudo apt-get update
sudo apt-get install -y build-essential autoconf automake libtool \
gtk3-dev libglib2.0-dev gettext desktop-file-utils devscripts fakeroot lintian
- name: Build the DEB package using debuild
run: |
./autogen.sh
./configure
make
debuild -us -uc -b
- name: Test DEB package
run: |
dpkg -i ../xnec2c_*.deb || true # Install DEB package
xnec2c -h # Run test
- name: Upload the DEB package
uses: actions/upload-artifact@v2
with:
name: xnec2c-${{ matrix.os }}.deb
path: ../xnec2c_*.deb
74 changes: 74 additions & 0 deletions .github/workflows/build-rpm-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build RPM Packages

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [fedora-38, fedora-37, almalinux-9, almalinux-8]

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Cache dnf packages
uses: actions/cache@v2
with:
path: /var/cache/dnf
key: ${{ runner.os }}-dnf-${{ hashFiles('**/Dockerfile') }}
restore-keys: |
${{ runner.os }}-dnf-
- name: Determine version and dist
id: version
run: |
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0")
TAG=$(git describe --tags --exact-match 2>/dev/null || echo "notag")
if [ "$TAG" = "notag" ]; then
DIST="-git"
else
DIST=""
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "DIST=$DIST" >> $GITHUB_ENV
- name: Build RPM packages in Docker
run: |
docker run --rm -v $(pwd):/workspace -w /workspace ${{ matrix.os }} /bin/bash -c "
sudo dnf install -y rpm-build make autoconf automake libtool gcc gettext-devel gtk3-devel desktop-file-utils glib2-devel intltool
./autogen.sh
./configure
make
mkdir -p ~/rpmbuild/SOURCES ~/rpmbuild/SPECS
mv . ~/rpmbuild/SOURCES/xnec2c-v${VERSION}
tar -czvf ~/rpmbuild/SOURCES/xnec2c-v${VERSION}.tar.gz -C ~/rpmbuild/SOURCES xnec2c-v${VERSION}
rpmbuild -ba -D \"_topdir $(pwd)/rpmbuild\" -D \"dist $DIST\" ~/rpmbuild/SPECS/xnec2c.spec
cp ~/rpmbuild/RPMS/x86_64/xnec2c-*.rpm ."
- name: Test RPM Package
run: |
docker run --rm -v $(pwd):/workspace -w /workspace ${{ matrix.os }} /bin/bash -c "
sudo dnf install -y ./xnec2c-*.rpm
xnec2c -h"
- name: Upload the RPM package
uses: actions/upload-artifact@v2
with:
name: xnec2c-${{ matrix.os }}.rpm
path: xnec2c-*.rpm

0 comments on commit 8e42f4c

Please sign in to comment.