forked from sleuthkit/sleuthkit
-
Notifications
You must be signed in to change notification settings - Fork 2
271 lines (238 loc) · 9.46 KB
/
build-unix.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
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
name: "Build"
# For docker container comparable to Linux build worker:
# docker run -it docker.io/library/ubuntu:22.04 bash
on:
push:
branches:
- '**'
pull_request:
branches:
- main
- develop
jobs:
build:
timeout-minutes: 30
name: ${{matrix.prefix}} ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.linkage }} ${{ matrix.compiler }} ${{ matrix.suffix }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- os: "macos"
arch: "arm64"
linkage: "shared"
compiler: "gcc"
runner: "macos-15"
configure_opts: "--with-libewf --disable-java"
make_flags: "CFLAGS=-Werror CXXFLAGS=-Werror"
codecov: "yes"
prefix: "CODECOV"
address_sanitizer: "yes"
keep_artifacts: "no"
- os: "linux"
arch: "x86_64"
linkage: "shared"
compiler: "gcc"
runner: "ubuntu-24.04"
configure_opts: "--with-libewf --with-libqcow --with-libvhdi --with-libvmdk --disable-java"
make_flags: "CFLAGS=-Werror CXXFLAGS=-Werror"
codecov: "no"
prefix:
address_sanitizer: "yes"
keep_artifacts: "yes"
suffix: "(with artifacts)"
- os: "linux"
arch: "x86_64"
linkage: "shared"
compiler: "clang"
runner: "ubuntu-24.04"
configure_opts: "--with-libewf --with-libqcow --with-libvhdi --with-libvmdk --disable-java CC=clang CXX=clang++"
make_flags: "CFLAGS=-Werror CXXFLAGS=-Werror"
codecov: "no"
prefix: ""
address_sanitizer: "yes"
keep_artifacts: "no"
- os: "mingw"
arch: "x86_64"
linkage: "shared"
compiler: "gcc"
runner: "ubuntu-24.04"
configure_opts: "--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --disable-java --enable-shared --disable-static"
winearch: 'win64'
winepath: 'Z:\usr\lib\gcc\x86_64-w64-mingw32\13-posix'
wineprefix: '/home/runner/.wine64'
codecov: "no"
prefix: ""
address_sanitizer: "no"
keep_artifacts: "no"
- os: "mingw"
arch: "x86_64"
linkage: "static"
compiler: "gcc"
runner: "ubuntu-24.04"
configure_opts: "--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --disable-java --disable-shared --enable-static"
winearch: 'win64'
winepath: 'Z:\usr\lib\gcc\x86_64-w64-mingw32\13-posix'
wineprefix: '/home/runner/.wine64'
codecov: "no"
prefix: ""
address_sanitizer: "no"
keep_artifacts: "no"
- os: "mingw"
arch: "i686"
linkage: "shared"
compiler: "gcc"
runner: "ubuntu-24.04"
configure_opts: "--host=i686-w64-mingw32 --target=i686-w64-mingw32 --enable-shared --disable-static --disable-java"
configure_optsnj: "--host=i686-w64-mingw32 --target=i686-w64-mingw32 --enable-shared --disable-static"
winearch: 'win32'
winepath: 'Z:\usr\lib\gcc\i686-w64-mingw32\13-posix'
wineprefix: '/home/runner/.wine32'
codecov: "no"
prefix: ""
address_sanitizer: "no"
keep_artifacts: "no"
- os: "mingw"
arch: "i686"
linkage: "static"
runner: "ubuntu-24.04"
compiler: "gcc"
configure_opts: "--host=i686-w64-mingw32 --target=i686-w64-mingw32 --disable-shared --enable-static --disable-java"
configure_optsnj: "--host=i686-w64-mingw32 --target=i686-w64-mingw32 --disable-shared --enable-static"
winearch: 'win32'
winepath: 'Z:\usr\lib\gcc\i686-w64-mingw32\13-posix'
wineprefix: '/home/runner/.wine32'
codecov: "no"
prefix: ""
address_sanitizer: "no"
keep_artifacts: "no"
steps:
- name: Determine number of cores
id: cores
run: |
if [ ${{ startsWith(matrix.runner, 'macos') }} = true ]; then
CORES=$(sysctl -n hw.logicalcpu)
elif [ ${{ matrix.os == 'mingw' }} = true ]; then
# mingw exhausts the memory if too many jobs run concurrently
CORES=2
else
CORES=$(nproc)
fi
echo "cores=$CORES" >>$GITHUB_OUTPUT
echo "Using $CORES cores"
- name: Install MacOS packages
if: ${{ matrix.os == 'macos' }}
run: |
brew update
brew install libtool autoconf automake libtool libewf libmagic
- name: Install Linux packages
if: ${{ matrix.os == 'linux' }}
run: |
sudo apt update
sudo apt install -y autoconf automake g++ libssl-dev libewf-dev libqcow-dev libvhdi-dev libvmdk-dev libmagic-dev libtool make pkg-config zlib1g-dev
- name: Install Mingw packages and setup for cross-compiling
if: ${{ matrix.os == 'mingw' }}
run: |
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install autoconf automake libtool make pkg-config mingw-w64 mingw-w64-tools libz-mingw-w64-dev wine32 wine64
sudo update-alternatives --set ${{ matrix.arch }}-w64-mingw32-g++ /usr/bin/${{ matrix.arch }}-w64-mingw32-g++-posix
# This is not working; also requires mingw-w64-x86_64-libgnurx
# echo === installing libmagic for mingw ===
# wget -q https://astron.com/pub/file/file-5.44.tar.gz # Check for the latest version at https://astron.com/pub/file/
# tar -xzf file-5.44.tar.gz
# cd file-5.44
# ./configure -q ${{ matrix.configure_optsnj}} && make V=0 && sudo make install
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: ${{ matrix.os == 'mingw' && 1 || 0 }}
- name: Run bootstrap
run: |
./bootstrap
- name: Run configure
run: |
./configure ${{ matrix.configure_opts }}
- name: Get the disk images
run: |
make test/get_images/test_images.txt
cat test/get_images/test_images.txt
ls -l test/from_brian
- name: Run make
run: |
make -j${{ steps.cores.outputs.cores }} check ${{ matrix.make_flags }} VERBOSE=1 TESTS=
- name: Run make check on Mac/Linux
if: ${{ matrix.os != 'mingw' }}
run: |
make -j${{ steps.cores.outputs.cores }} check ${{ matrix.make_flags }} VERBOSE=1 || result=1 ; for i in $(find test -name '*.log') ; do printf '\n%79s\n' | tr ' ' '=' ; echo "$i" ; cat "$i" ; done ; exit $result
- name: Run make check on Mingw
if: ${{ matrix.os == 'mingw' }}
env:
WINEARCH: ${{ matrix.winearch }}
WINEPATH: ${{ matrix.winepath }}
WINEPREFIX: ${{ matrix.wineprefix }}
run: |
make -j${{ steps.cores.outputs.cores }} check ${{ matrix.make_flags }} VERBOSE=1 LOG_COMPILER=scripts/wine_wrapper.sh || result=1 ; for i in $(find test -name '*.log') ; do printf '\n%79s\n' | tr ' ' '=' ; echo "$i" ; cat "$i" ; done ; exit $result
- name: Clean up
if: ${{ matrix.os != 'mingw' }}
run: |
make distclean
- name: Run configure with address-sanitizer
if: ${{ matrix.address_sanitizer == 'yes' }}
run: |
./configure ${{ matrix.configure_opts }} --enable-address-sanitizer CFLAGS=-g CXXFLAGS=-g
- name: Run make with address-sanitizer
if: ${{ matrix.address_sanitizer == 'yes' }}
run: |
make -j check VERBOSE=1
- name: Clean up
if: ${{ matrix.os != 'mingw' }}
run: |
make distclean
- name: Run configure for codecov
if: ${{ matrix.codecov == 'yes' }}
run: |
./configure ${{ matrix.configure_opts }} CFLAGS='-g -O0 -fprofile-arcs -ftest-coverage' CXXFLAGS='-g -O0 -fprofile-arcs -ftest-coverage'
- name: Run make for codecov
if: ${{ matrix.codecov == 'yes' }}
run: |
make -j test/fiwalk/fiwalk_test V=0
make -j test/runner V=0
- name: Run unit tests for codecov
if: ${{ matrix.codecov == 'yes' }}
run: |
test/fiwalk/fiwalk_test -s
test/runner -s
- name: run gcov
if: ${{ matrix.codecov == 'yes' }}
run: |
gcov $(find . -name '*.gcda')
- name: Upload codecov report
if: ${{ matrix.codecov == 'yes' }}
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
- name: Create any artifacts that we need to keep
if: ${{ matrix.keep_artifacts == 'yes' }}
run: |
./configure ${{ matrix.configure_opts }} CFLAGS='-O2' CXXFLAGS='-O2'
make tools/fiwalk/src/fiwalk
mkdir executables
mv tools/fiwalk/src/.libs/fiwalk executables
- name: Keep artifacts
if: ${{ matrix.keep_artifacts == 'yes' }}
uses: actions/upload-artifact@v4
with:
name: executables
path: |
executables/*
retention-days: 15
# - name: Run distcheck
# run: |
# ./configure
# make distcheck
#
# - uses: ammaraskar/[email protected]
# name: GCC Problem Matcher