-
Notifications
You must be signed in to change notification settings - Fork 1
226 lines (199 loc) · 8.75 KB
/
zlib-ng-crossbuild.yml
File metadata and controls
226 lines (199 loc) · 8.75 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
name: zlib-ng crossbuild package release
on:
workflow_dispatch:
inputs:
skip_rerun:
description: "Skip rerun?"
required: true
default: false
type: boolean
retries:
description: "Number of rerun retries"
required: true
default: "1"
type: choice
options: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
build:
runs-on: ubuntu-24.04
permissions:
contents: read
outputs:
zlib_ng_v1: ${{ steps.version_info.outputs.zlib_ng_v1 }}
zlib_ng_v2: ${{ steps.version_info.outputs.zlib_ng_v2 }}
strategy:
fail-fast: false
matrix:
name: [zlib-ng]
os_id: [debian, ubuntu]
os_codename: [bullseye, bookworm, trixie, jammy, noble]
arch: [amd64, armhf, arm64]
zlib_compat: ["", "-D ZLIB_COMPAT=ON"]
include:
- zlib_compat: ""
pretty_name: v2
header_name: ZLIBNG_VERSION
- zlib_compat: "-D ZLIB_COMPAT=ON"
pretty_name: v1
header_name: ZLIB_VERSION
exclude:
- os_id: debian
os_codename: jammy
- os_id: debian
os_codename: noble
- os_id: ubuntu
os_codename: bullseye
- os_id: ubuntu
os_codename: bookworm
- os_id: ubuntu
os_codename: trixie
name: ${{ matrix.os_id }}:${{ matrix.os_codename }} ${{ matrix.name }}${{ matrix.pretty_name }} ${{ matrix.arch }}
env:
opt_dir_name: "opt/local"
github_branch: "develop"
cxx_standard: "17"
GH_TOKEN: "${{ github.token }}"
steps:
- name: Host - Checkout action
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Host - Bootstrap qemu
uses: userdocs/actions/qemu@e8f57bd585c7bb6dcce011694d6772bab657abca # v1.0.7
with:
target_arch: ${{ matrix.arch }}
- name: Host - Bootstrap docker container
uses: userdocs/actions/qbt_docker@e8f57bd585c7bb6dcce011694d6772bab657abca # v1.0.7
with:
os_id: ghcr.io/userdocs/dcb
os_version_id: ${{ matrix.os_id }}-${{ matrix.os_codename }}-${{ matrix.arch }}
- name: Docker - cmake and ninja download and install
run: |
docker exec "${container_name}" curl -sNL "https://github.com/userdocs/cmake-crossbuild/releases/latest/download/${{ matrix.os_id }}-${{ matrix.os_codename }}-cmake-${{ matrix.arch }}.deb" -o ${{ matrix.os_id }}-${{ matrix.os_codename }}-cmake-${{ matrix.arch }}.deb
docker exec "${container_name}" sudo dpkg -i ${{ matrix.os_id }}-${{ matrix.os_codename }}-cmake-${{ matrix.arch }}.deb
- name: Host - Git clone ${{ matrix.name }} ${{ env.github_branch }}
run: git clone --single-branch --branch "${github_branch}" --shallow-submodules --recurse-submodules --depth=1 https://github.com/zlib-ng/zlib-ng.git ${{ matrix.name }}
- name: Host - Set ${{ matrix.name }} version to variable
id: version_info
run: |
zlib_ng_version="$(cat ${{ matrix.name }}/zlib.h.in | sed -rn 's|#define ${{ matrix.header_name }} "(.*)"|\1|p' | sed 's/\.[^.]*$//')"
printf '%s\n' "zlib_ng_version=${zlib_ng_version}" >> $GITHUB_ENV
printf '%s\n' "zlib_ng_${{ matrix.pretty_name }}=${zlib_ng_version}" >> $GITHUB_OUTPUT
- name: Docker - ${{ matrix.name }} configure
run: >
docker exec -w ${wd}/${{ matrix.name }} "${container_name}" cmake -Wno-dev -Wno-deprecated -G Ninja -B build
${{ matrix.zlib_compat }}
-D CMAKE_VERBOSE_MAKEFILE="ON"
-D CMAKE_CXX_STANDARD="${cxx_standard}"
-D CMAKE_INSTALL_PREFIX="${wd}/build/${opt_dir_name}"
- name: Docker - ${{ matrix.name }} - cmake build
run: docker exec -w ${wd}/${{ matrix.name }} "${container_name}" cmake --build build
- name: Docker - ${{ matrix.name }} - cmake install
run: docker exec -w ${wd}/${{ matrix.name }} "${container_name}" cmake --install build
- name: Docker - ldconfig - create /etc/ld.so.conf.d/zlib-ng.conf
run: |
docker exec -w "${wd}/build" "${container_name}" mkdir -p etc/ld.so.conf.d
docker exec -w ${wd}/build/etc/ld.so.conf.d "${container_name}" bash -c "printf '%s\n' '/${opt_dir_name}/lib' > zlib-ng.conf"
- name: Host - Create deb packages
uses: jiro4989/build-deb-action@a883c65147d80579cb359548b9a902ff0a35ae5b # v4.3.0
with:
package: "${{ matrix.name }}"
package_root: build
maintainer: userdocs
compress_type: gzip
version: "${{ env.zlib_ng_version }}"
depends: ""
arch: "${{ matrix.arch }}"
desc: "${{ matrix.name }}-${{ env.zlib_ng_version }}-${{ matrix.arch }} for ${{ matrix.os_id }}-${{ matrix.os_codename }}"
- name: Host - Remove version from release name and use hyphens
run: mv -f "${{ matrix.name }}_${zlib_ng_version}_${{ matrix.arch }}.deb" "${{ matrix.os_id }}-${{ matrix.os_codename }}-${{ matrix.name }}-${{ matrix.arch }}.deb"
- name: Host - upload artifacts
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: "${{ matrix.pretty_name }}-${{ matrix.os_id }}-${{ matrix.os_codename }}-${{ matrix.name }}-${{ matrix.arch }}-deb"
path: "${{ matrix.os_id }}-${{ matrix.os_codename }}-${{ matrix.name }}-${{ matrix.arch }}.deb"
release:
name: Upload artifacts to release
runs-on: ubuntu-24.04-arm
permissions:
contents: write
needs: [build]
if: needs.build.result == 'success'
strategy:
fail-fast: false
matrix:
name: [zlib-ng]
zlib_ng_version: ["v1", "v2"]
include:
- zlib_ng_version: "v1"
prerelease: false
- zlib_ng_version: "v2"
prerelease: true
env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
zlib_ng_v1: "${{ needs.build.outputs.zlib_ng_v1 }}"
zlib_ng_v2: "${{ needs.build.outputs.zlib_ng_v2 }}"
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Host - Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- name: Host - v1 artifacts organise for release
if: matrix.zlib_ng_version == 'v1'
run: |
mkdir -p "releases"
for files in v1-*-deb; do
cp -rf ${files}/* "releases/"
done
printf '%s\n' "zlib_ng_version=${zlib_ng_v1}" >> $GITHUB_ENV
- name: Host - v2 artifacts organise for release
if: matrix.zlib_ng_version == 'v2'
run: |
mkdir -p "releases"
for files in v2-*-deb; do
cp -rf ${files}/* "releases/"
done
printf '%s\n' "zlib_ng_version=${zlib_ng_v2}" >> $GITHUB_ENV
- name: Host - "Create release - tag - assets"
uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1.20.0
with:
prerelease: ${{ matrix.prerelease }}
artifacts: releases/*.deb
replacesArtifacts: true
tag: "${{ env.zlib_ng_version }}"
name: "${{ matrix.name }} ${{ env.zlib_ng_version }}"
body: "${{ matrix.name }} built from github master on amd64 arm64 armhf for Debian Bullseye Bookworm Trixie and Ubuntu Jammy Noble"
allowUpdates: true
ci-auto-rerun-failed-jobs:
if: failure() && (github.event.inputs.skip_rerun || 'false') == 'false'
needs: [release]
concurrency:
group: ci-auto-rerun-failed-jobs
cancel-in-progress: true
permissions:
actions: write
runs-on: ubuntu-24.04-arm
env:
GH_TOKEN: "${{ secrets.AUTO_RERUN || github.token }}"
github_repo: "" # To use ci-auto-rerun-failed-jobs.yml hosted in a remote repository else default to the current repository. Requires PAT token AUTO_RERUN
retries: ${{ github.event.inputs.retries || '1' }}
distinct_id: ${{ github.event.inputs.distinct_id }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: ci-auto-rerun-failed-jobs via ${{ env.github_repo || github.repository }}
run: >
gh workflow run ci-auto-rerun-failed-jobs-action.yml
--repo "${github_repo:-$GITHUB_REPOSITORY}"
-f github_repo=${GITHUB_REPOSITORY}
-f run_id=${GITHUB_RUN_ID}
-f attempts=${GITHUB_RUN_ATTEMPT}
-f retries=${retries}
-f distinct_id=${distinct_id}