summaryrefslogtreecommitdiff
path: root/third_party/heimdal/.github/workflows/ubsan.yml
blob: d4bb2eda476a508c4c85b07b44c1533e669b4a01 (plain)
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
name: Linux UBSAN Build

on:
    push:
      branches:
         - 'master'
         - 'ubsan'
      paths:
         - '!docs/**'
         - '!**.md'
         - '!**.[1-9]'
         - '**.[chly]'
         - '**.hin'
         - '**.in'
         - '**.am'
         - '**.m4'
         - '**.ac'
         - '**.pl'
         - '**.py'
         - '**.asn1'
         - '**.opt'
         - '**/COPYING'
         - '**/INSTALL'
         - '**/README*'
         - '.github/workflows/ubsan.yml'
         - '!appveyor.yml'
         - '!.travis.yml'

    pull_request:
      paths:
         - '!docs/**'
         - '!**.md'
         - '!**.[1-9]'
         - '**.[chly]'
         - '**.hin'
         - '**.in'
         - '**.am'
         - '**.m4'
         - '**.ac'
         - '**.pl'
         - '**.py'
         - '**.asn1'
         - '**.opt'
         - '**/COPYING'
         - '**/INSTALL'
         - '**/README*'
         - '.github/workflows/ubsan.yml'
         - '!appveyor.yml'
         - '!.travis.yml'

jobs:
    unix:
        runs-on: ${{ matrix.os }}
        strategy:
            fail-fast: false
            matrix:
                name: [linux-clang, linux-gcc]
                include:
                    - name: linux-clang
                      os: ubuntu-18.04
                      compiler: clang
                      cflags: '-fsanitize=undefined'
                      ldflags: ''
                    - name: linux-gcc
                      os: ubuntu-18.04
                      compiler: gcc
                      cflags: '-Wnonnull -fsanitize=undefined'
                      ldflags: ''
        steps:
            - name: Clone repository
              uses: actions/checkout@v1
            - name: Install packages
              if: startsWith(matrix.os, 'ubuntu')
              run: |
                sudo apt-get update -qq
                sudo apt-get install -y bison comerr-dev flex doxygen
                sudo apt-get install -y libcap-ng-dev libdb-dev libedit-dev libjson-perl
                sudo apt-get install -y libldap2-dev libncurses5-dev libperl4-corelibs-perl
                sudo apt-get install -y libsqlite3-dev libkeyutils-dev pkg-config python
                sudo apt-get install -y ss-dev texinfo unzip netbase keyutils ldap-utils
                sudo apt-get install -y gdb apport curl libmicrohttpd-dev jq valgrind
                # Temporary workaround for:
                # https://github.com/actions/virtual-environments/issues/3185
                sudo hostname localhost
            - name: Build
              env:
                CC: ${{ matrix.compiler }}
                MAKEVARS: ${{ matrix.makevars }}
              run: |
                /bin/sh ./autogen.sh
                mkdir build
                cd build
                ../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 }}"
                make -j4
            - name: Test
              env:
                CC: ${{ matrix.compiler }}
                MAKEVARS: ${{ matrix.makevars }}
              run: |
                cd build
                ulimit -c unlimited
                make check
            - name: Make Install
              env:
                CC: ${{ matrix.compiler }}
                MAKEVARS: ${{ matrix.makevars }}
              run: |
                cd build || true
                make DESTDIR=/tmp/h5l install
                cd /tmp/h5l
                tar czf $HOME/heimdal-install-linux-${{ matrix.compiler }}.tgz .
            - name: Core dump stacks
              run: |
                echo "thread apply all bt" > /tmp/x
                find . -name core -print | while read core; do gdb -batch -x x `file "$core"|sed -e "s/^[^']*'//" -e "s/[ '].*$//"` "$core"; done
                if [ "$(find . -name core -print | wc -l)" -gt 0 ]; then false; fi
            - name: Test logs
              run: |
                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 -
                find build -name \*.trs | xargs grep -lw FAIL | sed -e 's/trs$/log/' | xargs cat
            - name: Failed Test logs
              if: ${{ failure() }}
              run: |
                find build -name \*.trs | xargs grep -lw FAIL | sed -e 's/trs$/log/' | xargs cat
            - name: All Test logs
              if: true
              run: |
                find build -name \*.trs | sed -e 's/trs$/log/' | xargs cat
            - name: Upload Logs Tarball
              uses: actions/upload-artifact@v2
              with:
                name: Test Logs
                path: '~/logs-linux-${{ matrix.compiler }}.tgz'