Skip to content

Commit

Permalink
Static builds for Linux ARM and x64 + Download Windows Portable builds
Browse files Browse the repository at this point in the history
This is a workflow based on the upstream workflow, release.yml. It is needed because:

- Upstream doesn't publish ARM64 binaries for Linux
- The Windows portable releases are not part of the artifacts attached to the GitHub release

The goal here is to have 4 standalone binaries - Linux x64, Linux ARM, Win x64,
Win ARM. These are cobbled together and attached to a draft release which we can
then publish and use to pull these binaries.
  • Loading branch information
mnvr committed Jan 21, 2025
1 parent 5eafac9 commit df895cc
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 49 deletions.
125 changes: 125 additions & 0 deletions .github/workflows/binaries-for-ente.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
on:
workflow_dispatch:
push: # Push a tag to build and create a draft release
tags:
- "*"

name: binaries-for-ente
jobs:
create_magick_binary:
name: Create magick binary (Linux)
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm]
compiler: [gcc]
include:
- os: ubuntu-24.04
arch: x86_64
- os: ubuntu-24.04-arm
arch: aarch64
- compiler: gcc
cxx_compiler: g++
packages: gcc g++

steps:
- name: Install dependencies
run: |
set -e
export DEBIAN_FRONTEND=noninteractive
sudo apt update -y
sudo apt install -y autoconf curl fuse git kmod libbz2-dev libdjvulibre-dev libfontconfig-dev libfreetype6-dev libfribidi-dev libharfbuzz-dev liblcms-dev libopenexr-dev libopenjp2-7-dev libturbojpeg0-dev liblqr-dev libraqm-dev libtiff-dev libwebp-dev libx11-dev libxml2-dev liblzma-dev make software-properties-common wget ${{ matrix.packages }}
sudo add-apt-repository ppa:git-core/ppa -y
sudo apt install -y git
sudo add-apt-repository ppa:strukturag/libheif -y
sudo add-apt-repository ppa:strukturag/libde265 -y
sudo apt install libheif-dev -y
- name: Checkout
uses: actions/checkout@v4

# Avoid fatal: detected dubious ownership in repository at '/__w/ImageMagick/ImageMagick'
# Possible workaround: https://github.com/actions/runner/issues/2033#issuecomment-1598547465
- name: Flag current workspace as safe for git
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}

- name: Download AppImage
run: |
set -e
sudo apt install -y file
mkdir -p out/app-image
cd out/app-image
wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases/expanded_assets/continuous -O - | grep "appimagetool-.*-${{ matrix.arch }}.AppImage" | head -n 1 | cut -d '"' -f 2)
chmod +x appimagetool-*.AppImage
- name: Build ImageMagick
env:
CFLAGS: -Wno-deprecated-declarations -Wdeclaration-after-statement -Wno-error=unused-variable
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.cxx_compiler }}
run: |
set -e
./configure --with-quantum-depth=16 --without-magick-plus-plus --without-perl --without-x --disable-docs --prefix=/usr
make
make install DESTDIR=$(readlink -f out/appdir)
- name: Create ImageMagick AppImage
run: |
set -e
mkdir -p out/appdir/usr/share/applications/
cp app-image/imagemagick.desktop out/appdir/usr/share/applications/
mkdir -p out/appdir/usr/share/icons/hicolor/256x256/apps/
cp app-image/icon.png out/appdir/usr/share/icons/hicolor/256x256/apps/imagemagick.png
unset QTDIR
unset QT_PLUGIN_PATH
unset LD_LIBRARY_PATH
export VERSION=7
cd out
./app-image/appimagetool-*.AppImage --appimage-extract-and-run -s deploy appdir/usr/share/applications/*.desktop
chmod +x appdir/usr/lib/ld-linux-aarch64.so.1 || true
./app-image/appimagetool-*.AppImage --appimage-extract-and-run appdir
mkdir artifacts
cp ImageMagick*.AppImage artifacts/magick-${{ matrix.arch }}
- name: Upload ImageMagick AppImage
uses: actions/upload-artifact@v4
with:
name: magick-${{ matrix.arch }}
path: out/artifacts

- name: Create a draft GitHub release
uses: ncipollo/release-action@v1
with:
artifacts: "out/artifacts/*"
draft: true
allowUpdates: true
updateOnlyUnreleased: true

download_and_keep_windows_binaries:
name: Download magick binary (Windows)
runs-on: ubuntu-24.04
steps:
- name: Download
run: |
mkdir -p out/artifacts
curl -LO https://imagemagick.org/archive/binaries/ImageMagick-7.1.1-43-portable-Q16-x64.zip
unzip ImageMagick-7.1.1-43-portable-Q16-x64.zip
cp ImageMagick-7.1.1-43-portable-Q16-x64/magick.exe out/artifacts/magick-x64.exe
curl -LO https://imagemagick.org/archive/binaries/ImageMagick-7.1.1-43-portable-Q16-arm64.zip
unzip ImageMagick-7.1.1-43-portable-Q16-arm64.zip
cp ImageMagick-7.1.1-43-portable-Q16-arm64/magick.exe out/artifacts/magick-arm64.exe
- name: Upload ImageMagick exes
uses: actions/upload-artifact@v4
with:
name: magick-${{ matrix.arch }}
path: out/artifacts

- name: Create a draft GitHub release
uses: ncipollo/release-action@v1
with:
artifacts: "out/artifacts/*"
draft: true
allowUpdates: true
updateOnlyUnreleased: true
14 changes: 7 additions & 7 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
on:
workflow_dispatch:
schedule:
- cron: 0 6 * * *
push:
branches:
- main
paths:
- '.github/workflows/codeql-analysis.yml'
# schedule:
# - cron: 0 6 * * *
# push:
# branches:
# - main
# paths:
# - '.github/workflows/codeql-analysis.yml'

name: codeql analysis
jobs:
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
on:
workflow_dispatch:
schedule:
- cron: 0 6 * * *
push:
branches:
- main
paths:
- '.github/workflows/daily.yml'
pull_request:
branches:
- main
paths:
- '.github/workflows/daily.yml'
# schedule:
# - cron: 0 6 * * *
# push:
# branches:
# - main
# paths:
# - '.github/workflows/daily.yml'
# pull_request:
# branches:
# - main
# paths:
# - '.github/workflows/daily.yml'

name: daily
jobs:
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
on:
push:
branches:
- main
tags:
- '!*'
pull_request:
branches:
- main
workflow_dispatch:
# push:
# branches:
# - main
# tags:
# - '!*'
# pull_request:
# branches:
# - main

name: main
jobs:
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
on:
workflow_dispatch:
schedule:
- cron: 0 6 * * *
push:
tags:
- '*'
pull_request:
branches:
- main
paths:
- '.github/workflows/release.yml'
# schedule:
# - cron: 0 6 * * *
# push:
# tags:
# - '*'
# pull_request:
# branches:
# - main
# paths:
# - '.github/workflows/release.yml'

name: release
jobs:
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/windows-release.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'configure'
- 'm4/version.m4'
- '.github/workflows/windows-release.yml'
pull_request:
branches:
- main
paths:
- '.github/workflows/windows-release.yml'
# push:
# branches:
# - main
# paths:
# - 'configure'
# - 'm4/version.m4'
# - '.github/workflows/windows-release.yml'
# pull_request:
# branches:
# - main
# paths:
# - '.github/workflows/windows-release.yml'

name: windows release
jobs:
Expand Down

0 comments on commit df895cc

Please sign in to comment.