Debian Codegraph @

.github/workflows/build.yml

raw
1 name: AdPlug autotools CI
2
3 on:
4 - push
5 - pull_request
6
7 jobs:
8 build:
9
10 strategy:
11
12 matrix:
13 os: [ubuntu-latest, macos-latest]
14 compiler: [gcc, clang]
15 include:
16 - compiler: gcc-4.8 # To test compatibility with older systems
17 os: ubuntu-latest
18 - compiler: djgpp-2.0.5-gcc-12.2.0 # To test compatibility for Adplay - DOS
19 os: ubuntu-latest
20
21 fail-fast: false
22
23 runs-on: ${{matrix.os}}
24
25 steps:
26 - uses: actions/checkout@v3
27
28 - name: Install packages (Linux)
29 if: ${{ runner.os == 'Linux' }}
30 run: |
31 sudo apt update
32 sudo apt install -y texlive-latex-base texinfo
33
34 if [[ ${{ matrix.compiler }} == "clang" ]]; then
35 sudo apt install -y build-essential clang
36 fi
37
38 if [[ ${{ matrix.compiler }} == "gcc-4.8" ]]; then
39 wget http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/g++-4.8_4.8.5-4ubuntu8_amd64.deb
40 wget http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/libstdc++-4.8-dev_4.8.5-4ubuntu8_amd64.deb
41 wget http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/gcc-4.8-base_4.8.5-4ubuntu8_amd64.deb
42 wget http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/gcc-4.8_4.8.5-4ubuntu8_amd64.deb
43 wget http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/libgcc-4.8-dev_4.8.5-4ubuntu8_amd64.deb
44 wget http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/cpp-4.8_4.8.5-4ubuntu8_amd64.deb
45 wget http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-4.8/libasan0_4.8.5-4ubuntu8_amd64.deb
46 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
47 fi
48
49 if [[ ${{ matrix.compiler }} = djgpp* ]]; then
50 # Flex is required, but even though it's in the GitHub runner image, and marked as installed
51 # it's still missing some things, see https://github.com/orgs/community/discussions/45029
52 sudo apt install -y libfl2 libfl-dev software-properties-common
53 # Install dosemu2 for testing
54 sudo add-apt-repository -y ppa:dosemu2/ppa
55 sudo apt install -y dosemu2 unzip
56 # We need CWSDPMI as well if we want to run any DOS programs.
57 wget https://www.delorie.com/pub/djgpp/current/v2misc/csdpmi7b.zip
58 unzip -j -o "csdpmi7b.zip" "bin/CWSDPMI.EXE" -d ./test
59
60 if [[ ${{ matrix.compiler }} == "djgpp-2.0.5-gcc-12.2.0" ]]; then
61 wget https://github.com/andrewwutw/build-djgpp/releases/download/v3.4/djgpp-linux64-gcc1220.tar.bz2
62 bzcat djgpp-linux64-gcc1220.tar.bz2 | sudo tar -x --directory /usr/local
63 fi
64 fi
65
66 - name: Install packages (macOS)
67 if: ${{ runner.os == 'macOS' }}
68 run: |
69 # Allow core dumps
70 sudo sh -c 'touch /cores/test && rm /cores/test && chmod -R 0777 /cores'
71 brew update
72 # See comment in 'make' step (this takes good 20 mins)
73 #brew install --cask mactex-no-gui
74 brew install automake texinfo libtool
75
76 # - name: Install LLVM and Clang (Linux)
77 # if: ${{ matrix.compiler == 'clang' && runner.os != 'macOS' }}
78 # uses: KyleMayes/install-llvm-action@v1
79 # with:
80 # version: "10.0"
81
82 - name: Set GCC environment (Linux)
83 if: ${{ matrix.compiler == 'gcc' && runner.os == 'Linux'}}
84 run: echo "compile_opts=CC=gcc CXX=g++ CXXFLAGS='-fsanitize=address -fsanitize=leak' CPPFLAGS='-fsanitize=address -fsanitize=leak'" >> $GITHUB_ENV
85
86 - name: Set GCC-4.8 environment (Linux)
87 if: ${{ matrix.compiler == 'gcc-4.8' }}
88 run: echo 'compile_opts=CC=gcc-4.8 CXX=g++-4.8' >> $GITHUB_ENV
89
90 - name: Set GCC environment (macOS)
91 if: ${{ matrix.compiler == 'gcc' && runner.os == 'macOS' }}
92 run: echo 'compile_opts=CC=gcc CXX=g++' >> $GITHUB_ENV
93
94 - name: Set Clang environment
95 if: ${{ matrix.compiler == 'clang' }}
96 run: echo 'compile_opts=CC=clang CXX=clang++' >> $GITHUB_ENV
97
98 - name: Set DJGPP environment
99 if: ${{ startsWith(matrix.compiler, 'djgpp') }}
100 run: |
101 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
102 echo '/usr/local/djgpp/bin/' >> $GITHUB_PATH
103
104 - name: Install libbinio
105 run: |
106 git clone http://github.com/adplug/libbinio.git
107 pushd libbinio && autoreconf -i && ./configure --enable-maintainer-mode ${{ env.compile_opts }} && make && sudo env PATH=$PATH make install && popd
108
109 - name: autoreconf
110 run: autoreconf -i
111 - name: configure
112 run: ./configure ${{ env.compile_opts }} || cat config.log
113
114 - name: make
115 run: |
116 ulimit -c unlimited -S
117 if [[ ${{ runner.os }} == "macOS" ]]; then
118 # - macOS's /usr/bin/texi2dvi is broken
119 # - Furthermore, trying to get a working
120 # TeX installation on macOS is a futile
121 # endeavour, hence just run tests.
122 make check ${{ env.compile_opts }}
123 elif [[ ${{ matrix.compiler }} = djgpp* ]]; then
124 # Setup dosemu as testing tool
125 export LOG_COMPILER="dosemu"
126 export AM_LOG_FLAGS="-dumb $f"
127 # Note: compile_opts is not used here, since DJGPP requires stuff like --host for ./configure
128 # which will mess with make's command-line parsing
129 # -j1 is there to fix race conditions when building checks and then running dosemu
130 make -j1 check
131 elif [[ ${{ runner.os }} == "Linux" ]]; then
132 make distcheck ${{ env.compile_opts }}
133 fi
134
135 - name: Prepare test results (Linux)
136 if: ${{ runner.os == 'Linux' && !startsWith(matrix.compiler, 'djgpp')}}
137 run: make check
138
139 - name: Show test results
140 run: |-
141 for I in test/*.log; do
142 [ -e "$I" ] || continue
143 echo === $I ===
144 cat $I
145 done
146
147 - name: Handle failure
148 if: failure()
149 run: |-
150 if [[ ${{ runner.os }} == "Linux" ]]; then
151 # When "make distcheck" fails, following directory will be used for all files
152 pushd adplug-*/_build/sub || true
153 fi
154
155 for I in test/*.log; do
156 [ -e "$I" ] || continue
157 echo === $I ===
158 cat $I
159 done
160
161 if [[ ${{ runner.os }} == "Linux" ]]; then
162 if [ -f core ]; then
163 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:./src/.libs/"
164 if [ -e "./tests/.libs/tests" ]; then
165 gdb ./tests/.libs/tests core -ex "thread apply all bt" -ex "set pagination 0" -batch
166 else
167 # This needs to be fixed
168 echo "./tests/.libs/tests: not found"
169 fi
170 else
171 echo "No core dump; skipping gdb for backtrace"
172 fi
173
174 elif [[ ${{ runner.os }} == "macOS" ]]; then
175 # Make the build output lib dir located where dylib looks as default fallback,
176 # since setting DYLD_FALLBACK_LIBRARY_PATH doesn't seem to work
177 ln -s `pwd`"/src/.libs" "$HOME/lib"
178
179 # Run the tests with core dumps enabled
180 if [ -e "./tests/.libs/tests" ]; then
181 ulimit -c unlimited && ./tests/.libs/tests --no_catch_system_errors
182 else
183 # This needs to be fixed
184 echo "./tests/.libs/tests: not found"
185 fi
186
187 # Look for a core dump and examine it if found
188 COREFILE=`ls -t /cores/* | head -n1`
189 if [ -f "$COREFILE" ]; then
190 echo "Found core dump: $COREFILE"
191 lldb -c "$COREFILE" --batch -o 'thread backtrace all' -o 'quit'
192 else
193 echo "No core dump; skipping lldb for backtrace"
194 fi
195 else
196 echo "Unknown OS, cannot check for core dump"
197 fi
198
199 for I in *.test; do
200 [ -e "$I" ] || continue
201 echo === Failed test output for $I [first 200 lines only] ===
202 head -n 200 $I
203 done
204 echo == End of test log ==
205
206 if [[ ${{ runner.os }} == "Linux" ]]; then
207 popd || true
208 fi
209
210 - name: Upload failed test output
211 if: failure()
212 uses: actions/upload-artifact@v4
213 with:
214 name: adplug-tests-${{runner.os}}-${{matrix.compiler}}-${{github.sha}}
215 path: |
216 adplug-*/_build/sub/*.test
217 *.test
218 *.log
219 libbinio/*.log