-
Notifications
You must be signed in to change notification settings - Fork 6
170 lines (148 loc) · 4.87 KB
/
ci.yml
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
name: GitHub CI
on:
pull_request:
push:
workflow_dispatch:
defaults:
run:
shell: 'bash -Eeuo pipefail -x {0}'
jobs:
generate-matrix:
runs-on: ubuntu-24.04
outputs:
matrix-alpine: ${{ steps.set-matrix.outputs.matrix-alpine }}
matrix-ubuntu: ${{ steps.set-matrix.outputs.matrix-ubuntu }}
matrix-redhat: ${{ steps.set-matrix.outputs.matrix-redhat }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Figure out what targets we're building for
working-directory: debian
run: |
targets=""
for target in $(make list-all-modules | cut -d ' ' -f 1); do
targets="$targets module-$target";
done
echo targets="base $targets" >> $GITHUB_ENV
- name: set-matrix
id: set-matrix
run: |
for os in alpine ubuntu; do
jq -nRr '"matrix-" + $os +"=" + ( { include: [ $ARGS.positional[] | {target: . } ] } | tojson)' --arg os $os --args $targets >> $GITHUB_OUTPUT
done
for os in redhat; do
jq -nRr '"matrix-" + $os +"=" + ( { include: [ $ARGS.positional[] | {target: . } ] } | tojson)' --arg os $os --args ${targets/ module-geoip/} >> $GITHUB_OUTPUT
done
alpine:
needs: generate-matrix
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix-alpine)}}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Alpine Linux
uses: jirutka/setup-alpine@v1
with:
branch: v3.20
packages: >
abuild
build-base
coreutils
curl
findutils
git
make
xz
- name: Create build depends
shell: alpine.sh {0}
working-directory: alpine
run: |
make abuild-${{ matrix.target }}
- name: Install build depends
shell: alpine.sh --root {0}
working-directory: alpine
run: |
apk add $(. ./abuild-${{ matrix.target }}/APKBUILD; echo $makedepends;)
- name: Build ${{ matrix.target }}
shell: alpine.sh {0}
working-directory: alpine
run: |
make ${{ matrix.target }}
- name: List what has been built
shell: alpine.sh {0}
if: ${{ !cancelled() }}
run: |
find ~/packages/alpine -type f | xargs ls -ld
ubuntu:
runs-on: ubuntu-24.04
needs: generate-matrix
strategy:
fail-fast: false
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix-ubuntu)}}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Ubuntu
run: |
sudo apt-get update
sudo apt-get install -y --no-install-suggests --no-install-recommends \
curl \
devscripts \
equivs \
git \
libxml2-utils \
lsb-release \
xsltproc
- name: Create and install build depends for ${{ matrix.target }} and build it
working-directory: debian
run: |
NGINX_VERSION=$(make --eval 'nv:; @echo $(BASE_VERSION)' nv)
make rules-${{ matrix.target }}
sudo mk-build-deps --install --tool="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes" \
debuild-${{ matrix.target }}/nginx-${NGINX_VERSION}/debian/control
make ${{ matrix.target }}
- name: List what has been built
if: ${{ !cancelled() }}
run: |
find .. -mindepth 1 -maxdepth 1 -name "*.deb" | xargs ls -ld
redhat:
needs: generate-matrix
runs-on: ubuntu-24.04
container: almalinux:9
strategy:
fail-fast: false
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix-redhat )}}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup AlmaLinux
run: |
dnf makecache
dnf install -y \
g++ \
gcc \
git \
epel-release \
libxslt \
make \
rpm-build \
which \
xz \
'dnf-command(config-manager)'
dnf config-manager --set-enabled crb
- name: Create and install build depends for ${{ matrix.target }} and build it
working-directory: rpm/SPECS
run: |
case ${{ matrix.target }} in
base)
spec="nginx.spec"
;;
*)
spec="nginx-${{ matrix.target }}.spec"
;;
esac
make $spec
dnf -y builddep ./${spec}
make ${{ matrix.target }}
- name: List what has been built
if: ${{ !cancelled() }}
run: |
find rpm/RPMS -type f | xargs ls -ld