mirror of
https://github.com/GwynethLlewelyn/goswi.git
synced 2026-08-14 09:02:27 +00:00
83 lines
2.9 KiB
YAML
83 lines
2.9 KiB
YAML
# A workflow to build `gOSWI` using GitHub Actions.
|
|
|
|
# Note the extra complexity to make sure this compiles with Cgo,
|
|
# meaning that we need to install the ImageMagick 7 C/C++ development libraries & headers
|
|
# ... which, in turn, means getting the packages from Debian, since Ubuntu doesn't
|
|
# have the latest versions; they're still stuck with ImageMagick 6.9, as of late 2024,
|
|
# (Ubuntu 24.04).
|
|
|
|
# This is getting impossible to keep up with; we're switching to compiling everything and
|
|
# see how it goes. Soon, oh, soon we'll just fork/spawn a `magick` process and no more
|
|
# compilation will be required... (gwyneth 20251023)
|
|
|
|
name: 'gOSWI built with compiled ImageMagick 7'
|
|
|
|
on:
|
|
push:
|
|
branches: [ "master" ]
|
|
pull_request:
|
|
branches: [ "master" ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
env:
|
|
IMAGEMAGICK_VERSION: 7.1.2-7
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# Note: Ubuntu doesn't like ImageMagick 7, we'll compile everything instead
|
|
- name: Install packages needed for compilation
|
|
# Need more packages? Just add their names below!
|
|
#
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --quiet wget autoconf pkgconf build-essential curl pkgconf libbz2-dev libfontconfig-dev libfreetype-dev libgs-dev libgvc6 libjpeg-dev libpng-dev libtiff-dev libxml2-dev
|
|
|
|
- name: Download ImageMagick source files to /tmp
|
|
run: |
|
|
cd /tmp
|
|
wget https://github.com/ImageMagick/ImageMagick/archive/refs/tags/$IMAGEMAGICK_VERSION.tar.gz
|
|
tar xzf $IMAGEMAGICK_VERSION.tar.gz
|
|
rm $IMAGEMAGICK_VERSION.tar.gz
|
|
|
|
- name: Configure the ImageMagick build
|
|
run: |
|
|
cd /tmp/ImageMagick-$IMAGEMAGICK_VERSION
|
|
sh ./configure --prefix=/usr/local --with-bzlib --with-fontconfig --with-freetype --with-gslib --with-gvc --with-jpeg --with-png --with-tiff --with-xml --with-gs-font-dir
|
|
|
|
- name: Compile ImageMagick
|
|
run: |
|
|
cd /tmp/ImageMagick-$IMAGEMAGICK_VERSION
|
|
make -j
|
|
|
|
- name: Install ImageMagick
|
|
# For the sake of completude, we'll also add the required included shared libraries on the path
|
|
# for dynamically linked binaries via `ld.so`. This may not be necessary for Go, but who knows...
|
|
# (gwyneth 20251023)
|
|
run: |
|
|
cd /tmp/ImageMagick-$IMAGEMAGICK_VERSION
|
|
sudo make install
|
|
sudo ldconfig /usr/local/lib/
|
|
|
|
- name: Check if ImageMagick was built successfully
|
|
# Note: this is just for debugging the compilation, to make sure it's all fine
|
|
run: $(which identify) -list configure
|
|
|
|
# Moving on to Go...
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
# go-version: '1.24'
|
|
go-version-file: './go.mod'
|
|
|
|
# Make sure that Cgo is enabled
|
|
- name: Build
|
|
# I need to check the new build tags
|
|
run: CGO_CFLAGS_ALLOW='-Xpreprocessor' go build -v ./...
|
|
|
|
# Tests haven't been done yet.
|
|
# - name: Test
|
|
# run: go test -v ./...
|