-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI workflows for DEB, RPM, and AppImage builds
- 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 15, 2024
1 parent
e650f59
commit d3dce69
Showing
4 changed files
with
347 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
name: Build and Test AppImage | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
pull_request: | ||
branches: | ||
- main | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Determine Version | ||
id: version | ||
run: | | ||
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") | ||
TAGGED_COMMIT=$(git describe --tags --exact-match 2>/dev/null || echo "notag") | ||
if [ "$TAGGED_COMMIT" = "notag" ]; then | ||
VERSION="${LATEST_TAG}+" | ||
DIST="-git" | ||
else | ||
VERSION=$LATEST_TAG | ||
DIST="" | ||
fi | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
echo "DIST=$DIST" >> $GITHUB_ENV | ||
- name: Install Dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y python3 python3-pip | ||
pip3 install appimage-builder | ||
- name: Verify Installation | ||
run: | | ||
which appimage-builder | ||
appimage-builder --version | ||
- name: Build AppImage | ||
run: | | ||
docker run --rm -v $(pwd):/workspace -w /workspace centos:7 /bin/bash -c " | ||
set -eux | ||
# Update repository URLs to use the correct vault since CentOS 7.9.2009 has reached EOL | ||
echo 'Updating repository URLs...' | ||
sed -i 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/CentOS-*.repo | ||
sed -i 's|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=http://vault.centos.org/7.9.2009/os/x86_64|g' /etc/yum.repos.d/CentOS-*.repo | ||
yum clean all && yum makecache | ||
# Install EPEL repository first | ||
echo 'Installing epel-release...' | ||
yum install -y epel-release | ||
# Install all required packages | ||
echo 'Installing dependencies...' | ||
yum install -y gcc make automake autoconf gtk3-devel \ | ||
gettext-devel libtool fuse fuse-libs patchelf wget | ||
# Build the application | ||
echo 'Building the application...' | ||
./autogen.sh && ./configure && make | ||
# Prepare AppDir and copy necessary files | ||
echo 'Preparing AppDir...' | ||
mkdir -p AppDir/usr/bin AppDir/usr/share/icons/hicolor/scalable/apps AppDir/usr/share/applications | ||
# Install the application into AppDir | ||
echo 'Installing the application...' | ||
make install DESTDIR=$(pwd)/AppDir | ||
# Manually copy files to their destinations within AppDir | ||
cp src/xnec2c AppDir/usr/bin/xnec2c | ||
cp resources/xnec2c.svg AppDir/usr/share/icons/hicolor/scalable/apps/xnec2c.svg | ||
cp files/xnec2c.desktop AppDir/usr/share/applications/xnec2c.desktop | ||
" | ||
- name: Generate AppImage with appimage-builder | ||
run: | | ||
appimage-builder --recipe appimage-builder.yml | ||
- name: Test AppImage | ||
run: | | ||
chmod +x xnec2c-${VERSION}${DIST}.AppImage | ||
./xnec2c-${VERSION}${DIST}.AppImage -h | ||
- name: Upload AppImage | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: xnec2c-appimage | ||
path: xnec2c-${VERSION}${DIST}.AppImage |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
name: Build DEB Packages | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
pull_request: | ||
branches: | ||
- main | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-24.04 | ||
- ubuntu-22.04 | ||
- ubuntu-20.04 | ||
- ubuntu-18.04 | ||
- debian-11 | ||
- debian-10 | ||
- debian-9 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 # Fetch full Git history and tags | ||
|
||
- name: Set up the build environment | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y build-essential autoconf automake libtool \ | ||
libgtk-3-dev libglib2.0-dev gettext desktop-file-utils devscripts fakeroot lintian autopoint dh-make dh-autoreconf | ||
- name: Determine version and dist | ||
id: version | ||
run: | | ||
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0") | ||
TAGGED_COMMIT=$(git describe --tags --exact-match 2>/dev/null || echo "notag") | ||
if [ "$TAGGED_COMMIT" = "notag" ]; then | ||
VERSION="${LATEST_TAG}+" | ||
DIST="-git" | ||
else | ||
VERSION=$LATEST_TAG | ||
DIST="" | ||
fi | ||
# Remove the 'v' prefix and ensure the version starts with a digit | ||
VERSION=$(echo $VERSION | sed 's/^v//') | ||
VERSION=$(echo $VERSION | sed 's/[+]//g') # Replace '+' with '.' | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
echo "DIST=$DIST" >> $GITHUB_ENV | ||
- name: Generate Debian Packaging Files | ||
run: | | ||
rm -rf ./debian | ||
dh_make --createorig -y --single --native --packagename xnec2c_$VERSION | ||
echo -e '#!/usr/bin/make -f\n%:\n\tdh $@' > debian/rules | ||
chmod +x debian/rules | ||
echo "9" > debian/compat | ||
echo "Source: xnec2c" > debian/control | ||
echo "Section: utils" >> debian/control | ||
echo "Priority: optional" >> debian/control | ||
echo "Maintainer: Your Name <you@example.com>" >> debian/control | ||
echo "Build-Depends: debhelper (>= 9), autotools-dev, automake, autoconf, libtool, libgtk-3-dev, libglib2.0-dev, gettext, desktop-file-utils" >> debian/control | ||
echo "Standards-Version: 3.9.6" >> debian/control | ||
echo "Homepage: https://www.example.com" >> debian/control | ||
echo "" >> debian/control | ||
echo "Package: xnec2c" >> debian/control | ||
echo "Architecture: any" >> debian/control | ||
echo "Depends: \${shlibs:Depends}, \${misc:Depends}" >> debian/control | ||
echo "Description: A multi-threaded EM tool to model antenna near- and far-field radiation patterns." >> debian/control | ||
echo " Xnec2c is a high-performance multi-threaded electromagnetic simulation" >> debian/control | ||
echo " package to model antenna near- and far-field radiation patterns for" >> debian/control | ||
echo " Linux and UNIX operating systems." >> debian/control | ||
- name: Generate Debian Changelog from Git Log | ||
run: | | ||
VERSION=${{ steps.version.outputs.VERSION }}${{ steps.version.outputs.DIST }} | ||
PACKAGE_NAME="xnec2c" | ||
DISTRIBUTION="unstable" | ||
MAINTAINER="Your Name <you@example.com>" | ||
echo "$PACKAGE_NAME ($VERSION) $DISTRIBUTION; urgency=low" > debian/changelog | ||
echo "" >> debian/changelog | ||
git log --pretty=format:" * %s" >> debian/changelog | ||
echo "" >> debian/changelog | ||
echo " -- $MAINTAINER $(date -R)" >> debian/changelog | ||
- name: Verify Debian Directory | ||
run: | | ||
if [ ! -f "debian/rules" ]; then | ||
echo "Error: debian/rules file not found!" | ||
exit 1 | ||
fi | ||
- 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 | ||
xnec2c -h | ||
- name: Upload the DEB package | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: xnec2c-${{ matrix.os }}.deb | ||
path: ../xnec2c_*.deb |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: Build RPM Package | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
pull_request: | ||
branches: | ||
- main | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Determine Version | ||
id: version | ||
run: | | ||
# Get the most recent tag | ||
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") | ||
# Check if the latest commit is tagged | ||
TAGGED_COMMIT=$(git describe --tags --exact-match 2>/dev/null || echo "notag") | ||
if [ "$TAGGED_COMMIT" = "notag" ]; then | ||
VERSION="${LATEST_TAG}+" | ||
DIST="-git" | ||
else | ||
VERSION=$LATEST_TAG | ||
DIST="" | ||
fi | ||
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
echo "DIST=$DIST" >> $GITHUB_ENV | ||
- name: Build RPM | ||
run: | | ||
docker run --rm -v $(pwd):/workspace -w /workspace almalinux:9 /bin/bash -c " | ||
set -x | ||
# Install dependencies | ||
dnf install -y epel-release | ||
dnf install -y gcc make automake autoconf gtk3-devel gettext-devel libtool \ | ||
rpm-build rpmdevtools git desktop-file-utils intltool | ||
# Prepare the RPM build environment | ||
rpmdev-setuptree | ||
./autogen.sh | ||
./configure | ||
make xnec2c.spec | ||
make dist | ||
# Copy the spec file to the SPECS directory | ||
cp xnec2c.spec /root/rpmbuild/SPECS/ | ||
find . /workspace | ||
pwd | ||
ls -ltr | ||
# Create a properly versioned tarball | ||
TAR_FILE=$(ls /workspace/xnec2c-*.tar.gz) | ||
mkdir -p /root/rpmbuild/SOURCES/xnec2c-${VERSION} | ||
tar -xzf $TAR_FILE --strip-components=1 -C /root/rpmbuild/SOURCES/xnec2c-${VERSION} | ||
tar -czf /root/rpmbuild/SOURCES/xnec2c-${VERSION}.tar.gz -C /root/rpmbuild/SOURCES xnec2c-${VERSION} | ||
# Build the RPM | ||
rpmbuild -ba --define \"_version ${VERSION}\" --define \"_dist ${DIST}\" \ | ||
--define \"_topdir /root/rpmbuild\" /root/rpmbuild/SPECS/xnec2c.spec | ||
# Check the RPM files | ||
ls -l /root/rpmbuild/RPMS/x86_64 | ||
" | ||
- name: Install and Test RPM | ||
run: | | ||
docker run --rm -v $(pwd):/workspace -w /workspace almalinux:9 /bin/bash -c " | ||
# Install the RPM package | ||
dnf install -y /root/rpmbuild/RPMS/x86_64/xnec2c-*.rpm | ||
# Run the test to verify the package | ||
xnec2c -h | ||
" | ||
- name: Upload RPM | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: xnec2c-rpm | ||
path: /root/rpmbuild/RPMS/x86_64/xnec2c-*.rpm |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
version: 1 | ||
|
||
AppDir: | ||
path: ./AppDir | ||
app_info: | ||
id: xnec2c | ||
name: xnec2c | ||
icon: usr/share/icons/hicolor/scalable/apps/xnec2c.svg | ||
exec: usr/bin/xnec2c | ||
exec_args: "$@" | ||
version: "${VERSION}${DIST}" | ||
|
||
apt: | ||
arch: amd64 | ||
sources: | ||
- sourceline: 'deb [arch=amd64] http://vault.centos.org/7.9.2009/os/ x86_64 main' | ||
include: | ||
- glibc | ||
- libgtk-3-0 | ||
- libglib2.0-0 | ||
- fuse | ||
- other-dependencies | ||
|
||
AppImage: | ||
arch: x86_64 | ||
update-information: None | ||
sign-key: None |