GHA: Make UBSAN build run
[heimdal.git] / .github / workflows / ubsan.yml
blobd4bb2eda476a508c4c85b07b44c1533e669b4a01
1 name: Linux UBSAN Build
3 on:
4     push:
5       branches:
6          - 'master'
7          - 'ubsan'
8       paths:
9          - '!docs/**'
10          - '!**.md'
11          - '!**.[1-9]'
12          - '**.[chly]'
13          - '**.hin'
14          - '**.in'
15          - '**.am'
16          - '**.m4'
17          - '**.ac'
18          - '**.pl'
19          - '**.py'
20          - '**.asn1'
21          - '**.opt'
22          - '**/COPYING'
23          - '**/INSTALL'
24          - '**/README*'
25          - '.github/workflows/ubsan.yml'
26          - '!appveyor.yml'
27          - '!.travis.yml'
29     pull_request:
30       paths:
31          - '!docs/**'
32          - '!**.md'
33          - '!**.[1-9]'
34          - '**.[chly]'
35          - '**.hin'
36          - '**.in'
37          - '**.am'
38          - '**.m4'
39          - '**.ac'
40          - '**.pl'
41          - '**.py'
42          - '**.asn1'
43          - '**.opt'
44          - '**/COPYING'
45          - '**/INSTALL'
46          - '**/README*'
47          - '.github/workflows/ubsan.yml'
48          - '!appveyor.yml'
49          - '!.travis.yml'
51 jobs:
52     unix:
53         runs-on: ${{ matrix.os }}
54         strategy:
55             fail-fast: false
56             matrix:
57                 name: [linux-clang, linux-gcc]
58                 include:
59                     - name: linux-clang
60                       os: ubuntu-18.04
61                       compiler: clang
62                       cflags: '-fsanitize=undefined'
63                       ldflags: ''
64                     - name: linux-gcc
65                       os: ubuntu-18.04
66                       compiler: gcc
67                       cflags: '-Wnonnull -fsanitize=undefined'
68                       ldflags: ''
69         steps:
70             - name: Clone repository
71               uses: actions/checkout@v1
72             - name: Install packages
73               if: startsWith(matrix.os, 'ubuntu')
74               run: |
75                 sudo apt-get update -qq
76                 sudo apt-get install -y bison comerr-dev flex doxygen
77                 sudo apt-get install -y libcap-ng-dev libdb-dev libedit-dev libjson-perl
78                 sudo apt-get install -y libldap2-dev libncurses5-dev libperl4-corelibs-perl
79                 sudo apt-get install -y libsqlite3-dev libkeyutils-dev pkg-config python
80                 sudo apt-get install -y ss-dev texinfo unzip netbase keyutils ldap-utils
81                 sudo apt-get install -y gdb apport curl libmicrohttpd-dev jq valgrind
82                 # Temporary workaround for:
83                 # https://github.com/actions/virtual-environments/issues/3185
84                 sudo hostname localhost
85             - name: Build
86               env:
87                 CC: ${{ matrix.compiler }}
88                 MAKEVARS: ${{ matrix.makevars }}
89               run: |
90                 /bin/sh ./autogen.sh
91                 mkdir build
92                 cd build
93                 ../configure --srcdir=`dirname "$PWD"` --enable-maintainer-mode --enable-developer --enable-dynamic --disable-static --with-ldap $CONFIGURE_OPTS --prefix=$HOME/inst CFLAGS="${{ matrix.cflags }} -Wno-error=shadow -Wno-error=bad-function-cast -Wno-error=unused-function -Wno-error=unused-result -Wno-error=deprecated-declarations" LDFLAGS="${{ matrix.ldflags }}"
94                 make -j4
95             - name: Test
96               env:
97                 CC: ${{ matrix.compiler }}
98                 MAKEVARS: ${{ matrix.makevars }}
99               run: |
100                 cd build
101                 ulimit -c unlimited
102                 make check
103             - name: Make Install
104               env:
105                 CC: ${{ matrix.compiler }}
106                 MAKEVARS: ${{ matrix.makevars }}
107               run: |
108                 cd build || true
109                 make DESTDIR=/tmp/h5l install
110                 cd /tmp/h5l
111                 tar czf $HOME/heimdal-install-linux-${{ matrix.compiler }}.tgz .
112             - name: Core dump stacks
113               run: |
114                 echo "thread apply all bt" > /tmp/x
115                 find . -name core -print | while read core; do gdb -batch -x x `file "$core"|sed -e "s/^[^']*'//" -e "s/[ '].*$//"` "$core"; done
116                 if [ "$(find . -name core -print | wc -l)" -gt 0 ]; then false; fi
117             - name: Test logs
118               run: |
119                 find build -depth -name \*.trs | xargs grep -lw FAIL | sed -e 's/trs$/log/' | tar -czf $HOME/logs-linux-${{ matrix.compiler }}.tgz --verbatim-files-from --files-from -
120                 find build -name \*.trs | xargs grep -lw FAIL | sed -e 's/trs$/log/' | xargs cat
121             - name: Failed Test logs
122               if: ${{ failure() }}
123               run: |
124                 find build -name \*.trs | xargs grep -lw FAIL | sed -e 's/trs$/log/' | xargs cat
125             - name: All Test logs
126               if: true
127               run: |
128                 find build -name \*.trs | sed -e 's/trs$/log/' | xargs cat
129             - name: Upload Logs Tarball
130               uses: actions/upload-artifact@v2
131               with:
132                 name: Test Logs
133                 path: '~/logs-linux-${{ matrix.compiler }}.tgz'