Merge pull request #3408 from singhpratik5/develop #87
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Build" | |
| # For docker container comparable to Linux build worker: | |
| # docker run -it docker.io/library/ubuntu:22.04 bash | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| - develop-4.14 | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| - develop-4.14 | |
| jobs: | |
| build: | |
| timeout-minutes: 30 | |
| name: posix ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.linkage }} ${{ matrix.compiler }} | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: "macos" | |
| arch: "arm64" | |
| linkage: "shared" | |
| compiler: "gcc" | |
| runner: "macos-15" | |
| configure_opts: "--with-libewf --enable-java" | |
| make_flags: "CFLAGS=-Werror CXXFLAGS=-Werror" | |
| address_sanitizer: "yes" | |
| keep_artifacts: "no" | |
| enable_java: "yes" | |
| - os: "linux" | |
| arch: "x86_64" | |
| linkage: "shared" | |
| compiler: "gcc" | |
| runner: "ubuntu-24.04" | |
| configure_opts: "--with-libewf --with-libqcow --with-libvhdi --with-libvmdk --enable-java" | |
| make_flags: "CFLAGS=-Werror CXXFLAGS=-Werror" | |
| address_sanitizer: "yes" | |
| keep_artifacts: "yes" | |
| enable_java: "yes" | |
| run_distcheck: "yes" | |
| - os: "linux" | |
| arch: "x86_64" | |
| linkage: "shared" | |
| compiler: "clang" | |
| runner: "ubuntu-24.04" | |
| configure_opts: "--with-libewf --with-libqcow --with-libvhdi --with-libvmdk --enable-java CC=clang CXX=clang++" | |
| make_flags: "CFLAGS=-Werror CXXFLAGS=-Werror" | |
| address_sanitizer: "yes" | |
| keep_artifacts: "no" | |
| enable_java: "yes" | |
| - os: "linux" | |
| arch: "x86_64" | |
| linkage: "static" | |
| runner: "ubuntu-22.04" | |
| configure_opts: "--enable-static --disable-shared --disable-java --without-afflib --without-libcrypto --without-libewf --without-libvhdi --without-libvmdk" | |
| # remove after testing: configure_opts: "--enable-static --disable-shared --disable-java" | |
| codecov: "no" | |
| - os: "mingw" | |
| arch: "x86_64" | |
| linkage: "shared" | |
| compiler: "gcc" | |
| runner: "ubuntu-24.04" | |
| configure_opts: "--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --disable-java --enable-shared --disable-static" | |
| winearch: 'win64' | |
| winepath: 'Z:\usr\lib\gcc\x86_64-w64-mingw32\13-posix' | |
| wineprefix: '/home/runner/.wine64' | |
| address_sanitizer: "no" | |
| keep_artifacts: "no" | |
| - os: "mingw" | |
| arch: "x86_64" | |
| linkage: "static" | |
| compiler: "gcc" | |
| runner: "ubuntu-24.04" | |
| configure_opts: "--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --disable-java --disable-shared --enable-static" | |
| winearch: 'win64' | |
| winepath: 'Z:\usr\lib\gcc\x86_64-w64-mingw32\13-posix' | |
| wineprefix: '/home/runner/.wine64' | |
| address_sanitizer: "no" | |
| keep_artifacts: "no" | |
| - os: "mingw" | |
| arch: "i686" | |
| linkage: "shared" | |
| compiler: "gcc" | |
| runner: "ubuntu-24.04" | |
| configure_opts: "--host=i686-w64-mingw32 --target=i686-w64-mingw32 --enable-shared --disable-static --disable-java" | |
| configure_optsnj: "--host=i686-w64-mingw32 --target=i686-w64-mingw32 --enable-shared --disable-static" | |
| winearch: 'win32' | |
| winepath: 'Z:\usr\lib\gcc\i686-w64-mingw32\13-posix' | |
| wineprefix: '/home/runner/.wine32' | |
| address_sanitizer: "no" | |
| keep_artifacts: "no" | |
| - os: "mingw" | |
| arch: "i686" | |
| linkage: "static" | |
| runner: "ubuntu-24.04" | |
| compiler: "gcc" | |
| configure_opts: "--host=i686-w64-mingw32 --target=i686-w64-mingw32 --disable-shared --enable-static --disable-java" | |
| configure_optsnj: "--host=i686-w64-mingw32 --target=i686-w64-mingw32 --disable-shared --enable-static" | |
| winearch: 'win32' | |
| winepath: 'Z:\usr\lib\gcc\i686-w64-mingw32\13-posix' | |
| wineprefix: '/home/runner/.wine32' | |
| address_sanitizer: "no" | |
| keep_artifacts: "no" | |
| steps: | |
| - name: Determine number of cores and amount of free space | |
| id: cores | |
| run: | | |
| if [ ${{ startsWith(matrix.runner, 'macos') }} = true ]; then | |
| CORES=$(sysctl -n hw.logicalcpu) | |
| elif [ ${{ matrix.os == 'mingw' }} = true ]; then | |
| # mingw exhausts the memory if too many jobs run concurrently | |
| CORES=2 | |
| else | |
| CORES=$(nproc) | |
| fi | |
| echo "cores=$CORES" >>$GITHUB_OUTPUT | |
| echo "Using $CORES cores" | |
| df -h | |
| - name: Install MacOS packages | |
| env: | |
| MATRIX_ENABLE_JAVA: ${{ matrix.enable_java }} | |
| if: ${{ matrix.os == 'macos' }} | |
| run: | | |
| export CPPFLAGS=-I/opt/homebrew/include/ | |
| export LDFLAGS=-L/opt/homebrew/lib/ | |
| brew update | |
| brew install libtool autoconf automake libtool libewf libmagic afflib wget | |
| echo MATRIX_ENABLE_JAVA=$MATRIX_ENABLE_JAVA | |
| if [ ${MATRIX_ENABLE_JAVA}x == "yesx" ]; then | |
| echo Installing JAVA | |
| brew install openjdk@17 | |
| echo JAVA_HOME="$(brew --prefix openjdk)" >> $GITHUB_ENV | |
| echo PATH="$JAVA_HOME/bin:$PATH" >> $GITHUB_ENV | |
| echo JNI_CPPFLAGS="-I$JAVA_HOME/include -I$JAVA_HOME/include/darwin" >> $GITHUB_ENV | |
| export CPPFLAGS="-I$JAVA_HOME/include $CPPFLAGS" | |
| fi | |
| echo search for aff | |
| find /opt/homebrew -name 'aff*' | |
| echo "CPPFLAGS=$CPPFLAGS" >> $GITHUB_ENV | |
| echo "LDFLAGS=$LDFLAGS" >> $GITHUB_ENV | |
| - name: Install Ubuntu Linux packages | |
| if: ${{ matrix.os == 'linux' }} | |
| run: | | |
| sudo apt update | |
| sudo apt install -y ant autoconf automake g++ libssl-dev afflib-tools libewf-dev libqcow-dev libvhdi-dev libvmdk-dev libmagic-dev libtool make pkg-config zlib1g-dev wget | |
| echo ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer >> $GITHUB_ENV | |
| echo ASAN_OPTIONS="symbolize=1:abort_on_error=1" >> $GITHUB_ENV | |
| - name: Install Mingw packages and setup for cross-compiling | |
| if: ${{ matrix.os == 'mingw' }} | |
| run: | | |
| sudo dpkg --add-architecture i386 | |
| sudo apt update | |
| sudo apt install autoconf automake libtool make pkg-config mingw-w64 mingw-w64-tools libz-mingw-w64-dev wine32 wine64 wget | |
| sudo update-alternatives --set ${{ matrix.arch }}-w64-mingw32-g++ /usr/bin/${{ matrix.arch }}-w64-mingw32-g++-posix | |
| # This is not working; also requires mingw-w64-x86_64-libgnurx | |
| # echo === installing libmagic for mingw === | |
| # wget -q https://astron.com/pub/file/file-5.44.tar.gz # Check for the latest version at https://astron.com/pub/file/ | |
| # tar -xzf file-5.44.tar.gz | |
| # cd file-5.44 | |
| # ./configure -q ${{ matrix.configure_optsnj}} && make V=0 && sudo make install | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: ${{ matrix.os == 'mingw' && 1 || 0 }} | |
| - name: Run bootstrap | |
| run: | | |
| echo CPPFLAGS=$CPPFLAGS | |
| echo LDFLAGS=$LDFLAGS | |
| ./bootstrap | |
| - name: Run configure | |
| run: | | |
| ./configure ${{ matrix.configure_opts }} | |
| - name: Show config file | |
| run: cat tsk/tsk_config.h | |
| - name: Unpack and List the test data | |
| run: | | |
| cd .. | |
| pwd | |
| wget -q https://digitalcorpora.s3.amazonaws.com/corpora/drives/tsk-2024/sleuthkit_test_data.zip | |
| unzip sleuthkit_test_data.zip | |
| cd sleuthkit_test_data | |
| make unpack | |
| find . -ls | grep -v '[.]git' | |
| echo "SLEUTHKIT_TEST_DATA_DIR=$(pwd)" >> $GITHUB_ENV | |
| - name: Run make check on Mac/Linux | |
| if: ${{ matrix.os != 'mingw' }} | |
| run: | | |
| echo SLEUTHKIT_TEST_DATA_DIR=$SLEUTHKIT_TEST_DATA_DIR | |
| make -j${{ steps.cores.outputs.cores }} check ${{ matrix.make_flags }} VERBOSE=1 || result=1 ; for i in $(find test -name '*.log') ; do printf '\n%79s\n' | tr ' ' '=' ; echo "$i" ; cat "$i" ; done ; exit $result | |
| - name: Run make check on Linux (trap failure) | |
| if: ${{ matrix.os == 'linux' }} | |
| run: | | |
| ulimit -c unlimited | |
| bash -c ' | |
| make -j${{ steps.cores.outputs.cores }} check ${{ matrix.make_flags }} VERBOSE=1 | |
| ' | |
| RESULT=$? | |
| echo "make check exit code: $RESULT" | |
| if [ $RESULT -ne 0 ]; then | |
| echo "TEST_FAILED=1" >> $GITHUB_ENV | |
| fi | |
| - name: Show core dump backtrace if tests failed | |
| if: ${{ env.TEST_FAILED == '1' && matrix.os == 'linux' }} | |
| run: | | |
| echo "Checking for core dump..." | |
| COREFILE=$(find . -type f -name 'core*' | head -n 1) | |
| if [ -n "$COREFILE" ]; then | |
| echo "Found core file: $COREFILE" | |
| BINARY=$(file "$COREFILE" | sed -n "s/.*from '\(.*\)'.*/\1/p") | |
| if [ -x "$BINARY" ]; then | |
| echo "Running gdb to get backtrace..." | |
| gdb -batch -ex "thread apply all bt full" -ex "quit" "$BINARY" "$COREFILE" | |
| else | |
| echo "Could not identify executable from core file." | |
| fi | |
| else | |
| echo "No core file found." | |
| fi | |
| - name: Fail job if tests failed | |
| if: ${{ env.TEST_FAILED == '1' }} | |
| run: exit 1 | |
| - name: Run make check on Mingw | |
| if: ${{ matrix.os == 'mingw' }} | |
| env: | |
| WINEARCH: ${{ matrix.winearch }} | |
| WINEPATH: ${{ matrix.winepath }} | |
| WINEPREFIX: ${{ matrix.wineprefix }} | |
| TZ: UTC | |
| run: | | |
| make -j${{ steps.cores.outputs.cores }} check ${{ matrix.make_flags }} VERBOSE=1 LOG_COMPILER=scripts/wine_wrapper.sh || result=1 ; for i in $(find test -name '*.log') ; do printf '\n%79s\n' | tr ' ' '=' ; echo "$i" ; cat "$i" ; done ; exit $result | |
| - name: Clean up | |
| run: | | |
| if [ -x Makefile ]; then make distclean ; fi | |
| - name: Run configure with address-sanitizer and undefined-sanitizer | |
| if: ${{ matrix.address_sanitizer == 'yes' }} | |
| run: | | |
| ./configure ${{ matrix.configure_opts }} --enable-address-sanitizer --enable-undefined-sanitizer CFLAGS=-g CXXFLAGS=-g | |
| - name: Check with address-sanitizer | |
| if: ${{ matrix.address_sanitizer == 'yes' }} | |
| run: | | |
| make -j check VERBOSE=1 | |
| - name: Clean up | |
| run: | | |
| if [ -x Makefile ]; then make distclean ; fi | |
| - name: Create any artifacts that we need to keep | |
| if: ${{ matrix.keep_artifacts == 'yes' }} | |
| run: | | |
| ./configure ${{ matrix.configure_opts }} CFLAGS='-O2' CXXFLAGS='-O2' | |
| make tools/fiwalk/src/fiwalk | |
| mkdir executables | |
| mv tools/fiwalk/src/.libs/fiwalk executables | |
| - name: Keep artifacts | |
| if: ${{ matrix.keep_artifacts == 'yes' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: executables | |
| path: | | |
| executables/* | |
| retention-days: 15 | |
| - name: Run distcheck | |
| if: ${{ matrix.run_distcheck == 'yes' }} | |
| run: | | |
| ./configure | |
| make distcheck | |
| - uses: ammaraskar/[email protected] | |
| name: GCC Problem Matcher |