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