-
Notifications
You must be signed in to change notification settings - Fork 281
197 lines (185 loc) · 7.32 KB
/
build.yaml
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
name: build
# GitHub action to compile pkg on ubuntu-24.04, ubuntu-latest/22.04 (amd64) and macos-latest (aarch64)
# * set-up prerequisites
# * configure && make && make check && make install
# * upload installed binaries as well as kyua reports as build artefact
#
# We run in a matrix with os/sanitize flags.
on:
pull_request:
branches:
- main
push:
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: build ${{ join(matrix.sanitize, '+') }} ${{ matrix.build-os }} ${{ matrix.compiler }}
runs-on: "${{ matrix.build-os }}"
strategy:
fail-fast: false
matrix:
build-os:
- ubuntu-24.04
- ubuntu-latest
- macos-latest
sanitize:
- ""
- [ "asan", "lsan" ]
- ubsan
- tsan
exclude:
# don't run the sanitizers on Ubuntu 22.04
- build-os: ubuntu-latest
sanitize: [ "asan", "lsan" ]
- build-os: ubuntu-latest
sanitize: ubsan
- build-os: ubuntu-latest
sanitize: tsan
include:
- build-os: macos-latest
compiler: clang-19
pkgs:
- pkg-config
- libarchive
- llvm@19
llvm-bindir: /opt/homebrew/opt/llvm@19/bin
- build-os: ubuntu-24.04
compiler: clang-18
pkgs:
- clang-18
- libcurl4-openssl-dev
- libsqlite3-dev
- libbsd-dev
- libarchive-tools
- libarchive-dev
- libssl-dev
- liblzma-dev
- liblua5.2-dev
- liblzo2-dev
- libattr1-dev
- libacl1-dev
- libatf-dev
- kyua
- atf-sh
- build-essential
- zlib1g-dev
- libbz2-dev
- python3
- pkg-config
- m4
llvm-bindir: /usr/lib/llvm-18/bin
- build-os: ubuntu-latest
compiler: clang-15
pkgs:
- clang-15
- libcurl4-openssl-dev
- libsqlite3-dev
- libbsd-dev
- libarchive-tools
- libarchive-dev
- libssl-dev
- liblzma-dev
- liblua5.2-dev
- liblzo2-dev
- libattr1-dev
- libacl1-dev
- libatf-dev
- kyua
- atf-sh
- build-essential
- zlib1g-dev
- libbz2-dev
- python3
- pkg-config
- m4
llvm-bindir: /usr/lib/llvm-15/bin
steps:
- name: install packages (macOS)
if: runner.os == 'macOS'
run: |
# on MacOS we build with
# * latest clang@19 from brew (system provided clang lacks sanitizers)
# * ld from system
# * libarchive from brew (system provided libarchive has issues)
# * openssl from brew
# * libcurl from system
#
brew update --quiet || true
brew remove [email protected] || true # otherwise we get spurious errors with pkgconf
brew install ${{ join(matrix.pkgs, ' ') }}
# kyua was kicked out of brew due to lack of activity
# we patch away the disabled line and install the last built binary version
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/k/kyua.rb | sed 's/[[:space:]]*disable.*$//' > kyua.rb
brew install --formula ./kyua.rb
echo PKG_CONFIG_PATH=$(brew --prefix libarchive)/lib/pkgconfig >> "${GITHUB_ENV}"
- name: install packages (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update --quiet || true
sudo apt-get -yq --no-install-suggests --no-install-recommends install ${{ join(matrix.pkgs, ' ') }}
- uses: actions/checkout@v4
with:
path: src.pkg
- name: setup environment
run: |
echo "CC=${{ matrix.llvm-bindir }}/clang" >> "${GITHUB_ENV}"
echo "CXX=${{ matrix.llvm-bindir }}/clang++" >> "${GITHUB_ENV}"
echo "CPP=${{ matrix.llvm-bindir }}/clang-cpp" >> "${GITHUB_ENV}"
# this is miraculously not picked up by automake as the default
echo "CC_FOR_BUILD=${{ matrix.llvm-bindir }}/clang" >> "${GITHUB_ENV}"
echo "SRC_PKG=${GITHUB_WORKSPACE}/src.pkg" >> "${GITHUB_ENV}"
echo "BUILD_PKG=${GITHUB_WORKSPACE}/build.pkg" >> "${GITHUB_ENV}"
echo "INST_PKG=${GITHUB_WORKSPACE}/inst.pkg" >> "${GITHUB_ENV}"
echo "NPROC=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1`" >> "${GITHUB_ENV}"
- name: build pkg
run: |
CFG_OPTS=""
for i in ${{ join(matrix.sanitize, ' ') }}; do
CFG_OPTS="${CFG_OPTS} --with-${i}"
done
echo Building pkg with ${{ matrix.sanitize }} .. ${CFG_OPTS}
echo uname -a: $(uname -a)
echo uname -m: $(uname -m)
echo uname -p: $(uname -p)
echo NPROC="${NPROC}"
echo CC="${CC}"
echo CPP="${CPP}"
echo PKG_CONFIG_PATH="${PKG_CONFIG_PATH}"
echo SRC_PKG="${SRC_PKG}"
echo BUILD_PKG="${BUILD_PKG}"
echo INST_PKG="${INST_PKG}"
mkdir -p "${BUILD_PKG}"
cd "${BUILD_PKG}"
${SRC_PKG}/configure --prefix=${INST_PKG} --with-libarchive.pc --with-libcurl --with-openssl.pc ${CFG_OPTS}
make -j${NPROC}
- name: test&install pkg
run: |
echo Checking and installing pkg
cd "${BUILD_PKG}"
if make check; then
echo "All mandatory checks passed"
kyua report --results-filter=xfail,broken,failed >> $GITHUB_STEP_SUMMARY
kyua report
kyua report-html
else
kyua report --results-filter=xfail,broken,failed >> $GITHUB_STEP_SUMMARY
kyua report --verbose
kyua report-html
exit 0
fi
# only install non-debug builds
make install
- name: tar build & test reports
run: |
test -d ${INST_PKG} && tar cvf pkg-${{ matrix.build-os }}-${{ matrix.compiler }}.tar -C ${INST_PKG} .
tar cvf pkg-${{ matrix.build-os }}-${{ matrix.compiler }}-report${{ join(matrix.sanitize, '_') }}.tar -C "${BUILD_PKG}/html" .
- name: archive build artefacts
uses: actions/upload-artifact@v4
with:
name: pkg-test${{ join(matrix.sanitize, '_') }}-${{ matrix.build-os }}-${{ matrix.compiler }}
path: pkg*.tar
compression-level: 0
retention-days: 10
overwrite: true