Skip to content

.deb packaging buildx #9

.deb packaging buildx

.deb packaging buildx #9

name: .deb packaging buildx
on:
workflow_dispatch:
jobs:
build_job:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: arm32v7
distro: ubuntu16.04
- arch: arm32v7
distro: ubuntu18.04
- arch: arm32v7
distro: ubuntu22.04
- arch: arm32v7
distro: ubuntu24.04
- arch: arm32v7
distro: ubuntu24.10
- arch: arm32v7
distro: bullseye
- arch: arm32v7
distro: bookworm
- arch: aarch64
distro: ubuntu18.04
- arch: aarch64
distro: ubuntu20.04
- arch: aarch64
distro: ubuntu22.04
- arch: aarch64
distro: ubuntu24.04
- arch: aarch64
distro: ubuntu24.10
- arch: aarch64
distro: buster
- arch: aarch64
distro: bullseye
- arch: aarch64
distro: bookworm
- arch: amd64
distro: buster
- arch: i386
distro: buster
- arch: amd64
distro: bullseye
- arch: amd64
distro: bookworm
- arch: i386
distro: bullseye
- arch: i386
distro: bookworm
- arch: amd64
distro: ubuntu16.04
- arch: i386
distro: ubuntu16.04
- arch: amd64
distro: ubuntu18.04
- arch: i386
distro: ubuntu18.04
- arch: amd64
distro: ubuntu20.04
- arch: amd64
distro: ubuntu22.04
- arch: amd64
distro: ubuntu24.04
- arch: amd64
distro: ubuntu24.10
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
- name: Create artifacts directory
run: mkdir -p "${GITHUB_WORKSPACE}/artifacts"
- name: Build deb package
run: |
echo "Matrix arch: ${{ matrix.arch }}"
echo "Matrix distro: ${{ matrix.distro }}"
# Convert the matrix distro into a shell variable.
MY_DISTRO="${{ matrix.distro }}"
if [[ "$MY_DISTRO" == ubuntu* ]]; then
# Remove the 'ubuntu' prefix to get the version tag.
VERSION_TAG="${MY_DISTRO#ubuntu}"
DEFAULT_IMAGE="ubuntu:${VERSION_TAG}"
else
DEFAULT_IMAGE="debian:${MY_DISTRO}"
fi
echo "Default IMAGE: ${DEFAULT_IMAGE}"
# Determine the base image and platform based on the target architecture.
case "${{ matrix.arch }}" in
arm32v7)
if [[ "$MY_DISTRO" == ubuntu* ]]; then
BASE_IMAGE="arm32v7/ubuntu:${VERSION_TAG}"
else
BASE_IMAGE="arm32v7/debian:${MY_DISTRO}"
fi
PLATFORM="linux/arm/v7"
;;
aarch64)
if [[ "$MY_DISTRO" == ubuntu* ]]; then
BASE_IMAGE="arm64v8/ubuntu:${VERSION_TAG}"
else
BASE_IMAGE="arm64v8/debian:${MY_DISTRO}"
fi
PLATFORM="linux/arm64"
;;
i386)
if [[ "$MY_DISTRO" == ubuntu* ]]; then
BASE_IMAGE="i386/ubuntu:${VERSION_TAG}"
else
BASE_IMAGE="i386/debian:${MY_DISTRO}"
fi
PLATFORM="linux/386"
;;
amd64)
BASE_IMAGE="$DEFAULT_IMAGE"
PLATFORM="linux/amd64"
;;
*)
echo "Unsupported architecture: ${{ matrix.arch }}"
exit 1
;;
esac
echo "Using base image: ${BASE_IMAGE}"
echo "Using platform: ${PLATFORM}"
docker run --rm --platform "${PLATFORM}" \
-v "${GITHUB_WORKSPACE}/artifacts:/artifacts" \
"${BASE_IMAGE}" bash -c "\
apt-get update && \
apt-get install -y ca-certificates wget curl lsb-release && \
cd /artifacts && \
curl -O https://deb.goaccess.io/provision/provision.dpkg.sh && \
chmod +x provision.dpkg.sh && \
./provision.dpkg.sh && \
ls -lath && \
echo 'Build Success'"
- name: Test deb package installation
run: |
DEB_FILE=$(find "${GITHUB_WORKSPACE}/artifacts" -name "goaccess_*.deb")
echo "Found deb package: $DEB_FILE"
case "${{ matrix.distro }}" in
bookworm) TEST_IMAGE="debian:bookworm" ;;
bullseye) TEST_IMAGE="debian:bullseye" ;;
buster) TEST_IMAGE="debian:buster" ;;
ubuntu16.04) TEST_IMAGE="ubuntu:16.04" ;;
ubuntu18.04) TEST_IMAGE="ubuntu:18.04" ;;
ubuntu20.04) TEST_IMAGE="ubuntu:20.04" ;;
ubuntu22.04) TEST_IMAGE="ubuntu:22.04" ;;
ubuntu24.04) TEST_IMAGE="ubuntu:24.04" ;;
ubuntu24.10) TEST_IMAGE="ubuntu:24.10" ;;
*) echo "Unknown distro: ${{ matrix.distro }}" && exit 1 ;;
esac
echo "Using Docker image for testing: $TEST_IMAGE"
case "${{ matrix.arch }}" in
arm32v7) TEST_PLATFORM="linux/arm/v7" ;;
aarch64) TEST_PLATFORM="linux/arm64" ;;
i386) TEST_PLATFORM="linux/386" ;;
amd64) TEST_PLATFORM="linux/amd64" ;;
*) echo "Unsupported architecture: ${{ matrix.arch }}" && exit 1 ;;
esac
echo "Using platform for testing: $TEST_PLATFORM"
docker run --rm --platform "$TEST_PLATFORM" \
-v "${GITHUB_WORKSPACE}/artifacts:/artifacts" \
"$TEST_IMAGE" bash -c "\
apt-get update && \
apt-get install -y /artifacts/$(basename $DEB_FILE) && \
goaccess --version && \
apt-get remove -y goaccess"
- name: Upload deb package
uses: actions/upload-artifact@v4
with:
name: deb-package-${{ matrix.distro }}-${{ matrix.arch }}
path: artifacts/*.deb
retention-days: 1