Skip to content

Commit

Permalink
ci
Browse files Browse the repository at this point in the history
  • Loading branch information
gionn committed Jun 20, 2024
1 parent 768db15 commit 5193d01
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 24 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ jobs:
maven-password: ${{ secrets.NEXUS_PASSWORD }}

build_ubuntu:
name: Build on ubuntu:${{ matrix.image_tag }} for x86_64
name: Build on ${{ matrix.base_image }} for ${{ matrix.target_arch }}
runs-on: ubuntu-latest
needs:
- configure
Expand All @@ -167,11 +167,11 @@ jobs:
echo "imagemagick_release=$(cat ./release-version)" >> $GITHUB_OUTPUT
- name: Prepare image
run: docker build . -t buildenv --build-arg IMAGE_TAG=${{ matrix.image_tag }}
run: docker build . -t buildenv --build-arg BASE_IMAGE=${{ matrix.base_image }}
working-directory: debs

- name: Build and Install
run: docker run --name build buildenv ${{ steps.variables.outputs.imagemagick_version }}
run: docker run --name build buildenv ${{ steps.variables.outputs.imagemagick_version }} ${{ matrix.target_arch }}

- name: Retrieve built packages
env:
Expand All @@ -182,7 +182,7 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: ubuntu${{ matrix.image_tag }}-deb
name: ${{ matrix.nexus_classifier }}-deb
path: "*.deb"

test_ubuntu:
Expand Down
9 changes: 5 additions & 4 deletions debs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
ARG IMAGE_TAG
FROM ubuntu:$IMAGE_TAG
ARG BASE_IMAGE

ARG IMAGE_TAG
FROM ${BASE_IMAGE}

ARG BASE_IMAGE
ENV BASE_IMAGE=${BASE_IMAGE}
ENV DEBIAN_FRONTEND=noninteractive
ENV DEBIAN_PRIORITY=critical
ENV DEBCONF_NOWARNINGS=yes
ENV IMAGE_TAG=$IMAGE_TAG
ENV LOGNAME=root

RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/99yes
Expand Down
31 changes: 21 additions & 10 deletions debs/config.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
{
"include": [
{
"image_tag": "22.04"
},
{
"image_tag": "20.04"
},
{
"image_tag": "18.04"
}
{
"base_image": "ubuntu:22.04",
"target_arch": "x86_64",
"nexus_classifier": "2204-amd64"
},
{
"base_image": "ubuntu:22.04",
"target_arch": "aarch64",
"nexus_classifier": "2204-arm64"
},
{
"base_image": "ubuntu:20.04",
"target_arch": "x86_64",
"nexus_classifier": "2004-amd64"
},
{
"base_image": "ubuntu:18.04",
"target_arch": "x86_64",
"nexus_classifier": "1804-amd64"
}
]
}
}
18 changes: 12 additions & 6 deletions debs/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
#!/bin/bash
set -e -o pipefail -x

if [ -z "$IMAGE_TAG" ]; then
echo "IMAGE_TAG env needs to be set"
if [ -z "$BASE_IMAGE" ]; then
echo "BASE_IMAGE env needs to be set"
exit 1
fi

if [ -z "$1" ]; then
echo "first argument needs to be set - IMAGEMAGICK_VERSION"
echo "first argument must be provided: IMAGEMAGICK_VERSION"
exit 1
fi

if [ -z "$2" ]; then
echo "second argument must be provided: TARGET_ARCH"
exit 1
fi

IMAGEMAGICK_VERSION=$1
TARGET_ARCH=$2

git clone --depth 1 -b $IMAGEMAGICK_VERSION https://github.com/ImageMagick/ImageMagick.git
git clone --depth 1 -b "$IMAGEMAGICK_VERSION" https://github.com/ImageMagick/ImageMagick.git

mv debian ImageMagick/

cd ImageMagick

AFTER_CHECKOUT_HOOK_SCRIPT="../after-checkout-$IMAGE_TAG-$IMAGEMAGICK_VERSION.sh"
AFTER_CHECKOUT_HOOK_SCRIPT="../after-checkout-${BASE_IMAGE//:/}-$IMAGEMAGICK_VERSION.sh"
if [ -x "$AFTER_CHECKOUT_HOOK_SCRIPT" ]; then
"$AFTER_CHECKOUT_HOOK_SCRIPT"
fi
Expand All @@ -28,7 +34,7 @@ sed -i "1s/\${version}/$IMAGEMAGICK_VERSION/g" "debian/changelog" "debian/README

mk-build-deps -Bi

dpkg-buildpackage -b -uc
dpkg-buildpackage -b -uc --target-arch "${TARGET_ARCH}-linux"

echo "Imagemagick $IMAGEMAGICK_VERSION built successfully."
ls -l ../*.deb
Expand Down

0 comments on commit 5193d01

Please sign in to comment.