forked from adplug/adplug
-
Notifications
You must be signed in to change notification settings - Fork 0
217 lines (183 loc) · 8.39 KB
/
build.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
name: AdPlug autotools CI
on:
- push
- pull_request
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
compiler: [gcc, clang]
include:
- compiler: gcc-4.8 # To test compatibility with older systems
os: ubuntu-latest
- compiler: djgpp-2.0.5-gcc-12.2.0 # To test compatibility for Adplay - DOS
os: ubuntu-latest
- compiler: djgpp-2.0.5-gcc-4.8.5 # To test compatibility for Adplay - DOS
os: ubuntu-latest
fail-fast: false
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- name: Install packages (Linux)
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt update
sudo apt install -y texlive-latex-base texinfo
if [[ ${{ matrix.compiler }} == "clang" ]]; then
sudo apt install -y libncurses5
fi
if [[ ${{ matrix.compiler }} == "gcc-4.8" ]]; then
wget http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/g++-4.8_4.8.5-4ubuntu8_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/libstdc++-4.8-dev_4.8.5-4ubuntu8_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/gcc-4.8-base_4.8.5-4ubuntu8_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/gcc-4.8_4.8.5-4ubuntu8_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/libgcc-4.8-dev_4.8.5-4ubuntu8_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/cpp-4.8_4.8.5-4ubuntu8_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/libasan0_4.8.5-4ubuntu8_amd64.deb
sudo apt install ./gcc-4.8_4.8.5-4ubuntu8_amd64.deb ./gcc-4.8-base_4.8.5-4ubuntu8_amd64.deb ./libstdc++-4.8-dev_4.8.5-4ubuntu8_amd64.deb ./cpp-4.8_4.8.5-4ubuntu8_amd64.deb ./libgcc-4.8-dev_4.8.5-4ubuntu8_amd64.deb ./libasan0_4.8.5-4ubuntu8_amd64.deb ./g++-4.8_4.8.5-4ubuntu8_amd64.deb
fi
if [[ ${{ matrix.compiler }} = djgpp* ]]; then
# Flex is required, but even though it's in the GitHub runner image, and marked as installed
# it's still missing some things, see https://github.com/orgs/community/discussions/45029
sudo apt install -y libfl2 libfl-dev
if [[ ${{ matrix.compiler }} == "djgpp-2.0.5-gcc-12.2.0" ]]; then
wget https://github.com/andrewwutw/build-djgpp/releases/download/v3.4/djgpp-linux64-gcc1220.tar.bz2
bzcat djgpp-linux64-gcc1220.tar.bz2 | sudo tar -x --directory /usr/local
fi
if [[ ${{ matrix.compiler }} == "djgpp-2.0.5-gcc-4.8.5" ]]; then
wget https://github.com/andrewwutw/build-djgpp/releases/download/v1.6/djgpp-linux64-gcc485.tar.bz2
bzcat djgpp-linux64-gcc485.tar.bz2 | sudo tar -x --directory /usr/local
fi
fi
- name: Install packages (macOS)
if: ${{ runner.os == 'macOS' }}
run: |
# Allow core dumps
sudo sh -c 'touch /cores/test && rm /cores/test && chmod -R 0777 /cores'
brew update
# See comment in 'make' step (this takes good 20 mins)
#brew install --cask mactex-no-gui
brew install automake texinfo libtool
- name: Install LLVM and Clang (Linux)
if: ${{ matrix.compiler == 'clang' && runner.os != 'macOS' }}
uses: KyleMayes/install-llvm-action@v1
with:
version: "10.0"
- name: Set GCC environment (Linux)
if: ${{ matrix.compiler == 'gcc' && runner.os == 'Linux'}}
run: echo "compile_opts=CC=gcc CXX=g++ CXXFLAGS='-fsanitize=address -fsanitize=leak' CPPFLAGS='-fsanitize=address -fsanitize=leak'" >> $GITHUB_ENV
- name: Set GCC-4.8 environment (Linux)
if: ${{ matrix.compiler == 'gcc-4.8' }}
run: echo 'compile_opts=CC=gcc-4.8 CXX=g++-4.8' >> $GITHUB_ENV
- name: Set GCC environment (macOS)
if: ${{ matrix.compiler == 'gcc' && runner.os == 'macOS' }}
run: echo 'compile_opts=CC=gcc CXX=g++' >> $GITHUB_ENV
- name: Set Clang environment
if: ${{ matrix.compiler == 'clang' }}
run: echo 'compile_opts=CC=clang CXX=clang++' >> $GITHUB_ENV
- name: Set DJGPP environment
if: ${{ startsWith(matrix.compiler, 'djgpp') }}
run: |
echo 'compile_opts=--host=i586-pc-msdosdjgpp --prefix=/usr/local/djgpp CXXFLAGS=-Wno-deprecated CPPFLAGS=-Wno-deprecated PKG_CONFIG_PATH=/usr/local/djgpp/lib/pkgconfig' >> $GITHUB_ENV
echo 'usr/local//djgpp/bin/' >> $GITHUB_PATH
- name: Install libbinio
run: |
git clone http://github.com/adplug/libbinio.git
pushd libbinio && autoreconf -i && ./configure --enable-maintainer-mode ${{ env.compile_opts }} && make && sudo env PATH=$PATH make install && popd
- name: autoreconf
run: autoreconf -i
- name: configure
run: ./configure ${{ env.compile_opts }} || cat config.log
- name: make
run: |
ulimit -c unlimited -S
if [[ ${{ runner.os }} == "macOS" ]]; then
# - macOS's /usr/bin/texi2dvi is broken
# - Furthermore, trying to get a working
# TeX installation on macOS is a futile
# endeavour, hence just run tests.
make check ${{ env.compile_opts }}
elif [[ ${{ matrix.compiler }} = djgpp* ]]; then
# Just verify it compiles and installs,
# we can't run tests because of binary incompatibility with host OS when cross compiling
# Note: compile_opts is not used here, since DJGPP requires stuff like --host for ./configure
# which will mess with make's command-line parsing
make all
elif [[ ${{ runner.os }} == "Linux" ]]; then
make distcheck ${{ env.compile_opts }}
fi
- name: Prepare test results (Linux)
if: ${{ runner.os == 'Linux' && !startsWith(matrix.compiler, 'djgpp')}}
run: make check
- name: Show test results
if: ${{ !startsWith(matrix.compiler, 'djgpp')}}
run: |-
for I in test/*.log; do
[ -e "$I" ] || continue
echo === $I ===
cat $I
done
- name: Handle failure
if: failure()
run: |-
if [[ ${{ runner.os }} == "Linux" ]]; then
# When "make distcheck" fails, following directory will be used for all files
pushd adplug-*/_build/sub
fi
for I in test/*.log; do
[ -e "$I" ] || continue
echo === $I ===
cat $I
done
if [[ ${{ runner.os }} == "Linux" ]]; then
if [ -f core ]; then
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:./src/.libs/"
if [ -e "./tests/.libs/tests" ]; then
gdb ./tests/.libs/tests core -ex "thread apply all bt" -ex "set pagination 0" -batch
else
# This needs to be fixed
echo "./tests/.libs/tests: not found"
fi
else
echo "No core dump; skipping gdb for backtrace"
fi
elif [[ ${{ runner.os }} == "macOS" ]]; then
# Make the build output lib dir located where dylib looks as default fallback,
# since setting DYLD_FALLBACK_LIBRARY_PATH doesn't seem to work
ln -s `pwd`"/src/.libs" "$HOME/lib"
# Run the tests with core dumps enabled
if [ -e "./tests/.libs/tests" ]; then
ulimit -c unlimited && ./tests/.libs/tests --no_catch_system_errors
else
# This needs to be fixed
echo "./tests/.libs/tests: not found"
fi
# Look for a core dump and examine it if found
COREFILE=`ls -t /cores/* | head -n1`
if [ -f "$COREFILE" ]; then
echo "Found core dump: $COREFILE"
lldb -c "$COREFILE" --batch -o 'thread backtrace all' -o 'quit'
else
echo "No core dump; skipping lldb for backtrace"
fi
else
echo "Unknown OS, cannot check for core dump"
fi
for I in *.test; do
[ -e "$I" ] || continue
echo === Failed test output for $I [first 200 lines only] ===
head -n 200 $I
done
echo == End of test log ==
if [[ ${{ runner.os }} == "Linux" ]]; then
popd
fi
- name: Upload failed test output
if: failure()
uses: actions/upload-artifact@v3
with:
name: adplug-tests-${{runner.os}}-${{matrix.compiler}}-${{github.sha}}
path: |
adplug-*/_build/sub/*.test
*.test