Repository navigation
144 lines (144 loc) · 5.35 KB
/
Copy pathlinux-packages.yml
File metadata and controls
144 lines (144 loc) · 5.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Installable Linux packages
on:
pull_request:
paths-ignore:
- upstream-patches/**
push:
paths-ignore:
- upstream-patches/**
branches: [master]
tags: ["[0-9]*.[0-9]*.[0-9]*"]
workflow_dispatch:
permissions:
contents: read
jobs:
deb:
name: Debian packages (${{ matrix.name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: ubuntu24
image: ubuntu:24.04
package_suffix: ubuntu24.04
- name: debian13
image: debian:trixie
package_suffix: debian13
container: ${{ matrix.image }}
steps:
- name: Install build tools and system codecs
run: |
apt-get update
apt-get install -y build-essential git ca-certificates python3 debhelper cmake ninja-build pkg-config \
libjpeg-dev libpng-dev libtiff-dev libopenjp2-7-dev libwebp-dev libraw-dev libopenexr-dev zlib1g-dev
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Trust checked-out workspace
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Test release input safeguards
run: python3 -m unittest discover -s packaging/tests -p 'test_release_inputs.py'
- name: Check package release identity
run: >-
python3 packaging/scripts/prepare-ci.py --output /tmp/package-inputs
--distro ${{ matrix.package_suffix }}
- name: Build binary packages
run: dpkg-buildpackage -b -us -uc -j2
- name: Install and test packages
run: |
apt-get install -y ../libfreeimage-maintained3_*.deb ../libfreeimage-maintained-dev_*.deb
packaging/tests/installed.sh
- name: Inspect packaged SONAME
run: readelf -d /usr/lib/*/libfreeimage.so.3 | grep 'SONAME.*libfreeimage.so.3'
- name: Collect package downloads
run: |
mkdir -p dist
cp ../*.deb ../*.buildinfo ../*.changes dist/
# Ubuntu's debhelper names debug-symbol packages .ddeb; Debian uses .deb.
for ddeb in ../*.ddeb; do
if [ -e "$ddeb" ]; then cp "$ddeb" dist/; fi
done
- uses: actions/upload-artifact@v4
with:
name: deb-${{ matrix.name }}
path: dist/*
if-no-files-found: error
arch:
name: Arch Linux package
runs-on: ubuntu-latest
container: archlinux:base
steps:
- name: Install build tools and system codecs
run: |
pacman -Syu --noconfirm
pacman -S --needed --noconfirm base-devel git python cmake ninja pkgconf \
zlib libjpeg-turbo libpng libtiff openjpeg2 libwebp libraw openexr
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Trust checked-out workspace
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Build package as an unprivileged user
run: |
useradd -m builder
mkdir /tmp/arch-build
python3 packaging/scripts/prepare-ci.py --output /tmp/arch-build
chown -R builder:builder /tmp/arch-build
su builder -c 'cd /tmp/arch-build && makepkg --noconfirm'
- name: Install and test package
run: |
pacman -U --noconfirm /tmp/arch-build/*.pkg.tar.zst
packaging/tests/installed.sh
readelf -d /usr/lib/libfreeimage.so.3 | grep 'SONAME.*libfreeimage.so.3'
cp /tmp/arch-build/*.pkg.tar.zst /tmp/arch-build/*-linux-source.tar.gz .
package_version=$(sed -n 's/^pkgver=//p' /tmp/arch-build/PKGBUILD)
cp /tmp/arch-build/PKGBUILD "FreeImage-$package_version-linux-PKGBUILD"
- uses: actions/upload-artifact@v4
with:
name: arch-x86_64
path: |
*.pkg.tar.zst
*-linux-source.tar.gz
*-linux-PKGBUILD
if-no-files-found: error
publish:
name: Attach Linux packages to tagged release
if: github.event_name == 'push' && github.ref_type == 'tag'
needs: [deb, arch]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: deb-*
path: linux-assets
merge-multiple: true
- uses: actions/download-artifact@v4
with:
pattern: arch-*
path: linux-assets
merge-multiple: true
- name: Checksum release assets
working-directory: linux-assets
shell: bash
run: |
shopt -s nullglob
# GitHub replaces "~" with "." in uploaded asset names. Rename first so
# the checksum file lists the names users actually download.
for asset in *~*; do
mv -- "$asset" "${asset//\~/.}"
done
sha256sum -- *.deb *.ddeb *.pkg.tar.zst *-linux-source.tar.gz *-linux-PKGBUILD > SHA256SUMS-linux.txt
- name: Publish or update matching GitHub release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ github.ref_name }}
run: |
if gh release view "$RELEASE_TAG" >/dev/null 2>&1; then
gh release upload "$RELEASE_TAG" linux-assets/* --clobber
else
gh release create "$RELEASE_TAG" linux-assets/* --verify-tag --title "FreeImage $RELEASE_TAG" --generate-notes
fi