name: CI on: push: branches: - master pull_request: # schedule: # - cron: '0 0 * * 1' jobs: # build-offline: # name: linux-offline # runs-on: ubuntu-20.04 # steps: # - name: Checkout # uses: actions/checkout@v3 # - name: Building r2 without network access # run: | # ./preconfigure # echo UNPLUG # sudo rm -f /etc/resolv.conf || true # ping av.com || true # ./configure --with-rpath --prefix=/usr # make -j ; sudo make install build-oldlibs: name: linux-acr-oldlibsbug runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v3 - name: Setting up bad libnames run: | mkdir -p /tmp/fakelibs /tmp/fakeincs for a in anal asm cons crypto flag lang parse reg search syscall util ; do touch /tmp/fakelibs/libr_$a.a ; touch /tmp/fakelibs/libr_$a.so ; done touch /tmp/fakeincs/r_util.h chmod 000 /tmp/fakelibs/* export CFLAGS=-I/tmp/fakeincs/ export LDFLAGS=-L/tmp/fakelibs/ sys/install.sh build-nocs: name: linux-nocs runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v3 - name: Linting run: sys/lint.sh - name: Building without capstone but with ssl env: CFLAGS: -O0 run: | cp -f dist/plugins-cfg/plugins.nocs.cfg plugins.cfg ./configure --without-capstone --with-rpath --with-ssl && make -j sudo make install - name: Running c/m with self-hosted libmagic run: time r2 -a gb -e search.verbose=false -qc/m test/bins/mach0/ls-m1 > /tmp/m.1 2>&1 || true cat /tmp/m.1 - name: Uninstall test run: | sudo make uninstall - name: Building with libmagic env: CFLAGS: -O0 run: | sudo apt update sudo apt install -y libmagic-dev git clean -xdf ; rm -rf shlr/capstone cp -f dist/plugins-cfg/plugins.nocs.cfg plugins.cfg ./configure --with-sysmagic --without-capstone --with-rpath && make -j sudo make install - name: Running c/m with system libmagic run: time r2 -a gb -e search.verbose=false -qc/m test/bins/mach0/ls-m1 > /tmp/m.2 2>&1 || true cat /tmp/m.2 - name: Compare magic times and results run: | echo ===== m.1 cat /tmp/m.1 echo ===== m.2 cat /tmp/m.2 build-acr-gperf: name: linux-acr-gperf runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v3 - name: Install dependencies run: | python -m pip install --upgrade pip pip install meson ninja r2pipe wget sudo apt update --assume-yes sudo apt install gperf - name: Installing with symlinks run: | export CFLAGS="-O0 -Werror -Wno-unused-result -Wno-stringop-truncation" sys/install.sh - name: Running tests run: r2r -o /tmp/r2r.json test/db/cmd - uses: actions/upload-artifact@v3 with: name: r2r.json path: /tmp/r2r.json # TODO: Add job to build with capstone-next, for now v5 is stable build-syscapstone: name: linux-sys-capstone runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v3 - name: Installing capstone v5 run: | git clone --branch v5 --single-branch --depth=1 https://github.com/capstone-engine/capstone cd capstone && ( git log | head ) && sh make.sh && sudo make install - name: Installing r2 with sys-capstone run: | export CFLAGS="-O0 -Werror -Wno-unused-result -Wno-stringop-truncation" sys/install.sh - name: Checking if capstone was cloned run: if [ -d shlr/capstone ]; then echo "Capstone wasnt supposed to be cloned"; return 1; fi build-resymlink: name: linux-acr-resymlink runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v3 - name: Installing with symlinks run: | export CFLAGS="-O0 -Werror -Wno-unused-result -Wno-stringop-truncation" sys/install.sh - name: Uninstalling run: sudo make uninstall - name: Reinstalling without symlinks run: sudo make install linux-test: runs-on: ubuntu-20.04 # if: contains(github.ref, 'ci-') steps: - name: Checkout uses: actions/checkout@v3 - name: Building Radare2 run: | pip install r2pipe wheel export CFLAGS="-O2 -Wno-unused-result" sys/install.sh - name: Running tests run: | export LD_LIBRARY_PATH=/usr/local/lib make tests - uses: actions/upload-artifact@v3 with: name: results.json path: test/results.json linux-static-meson: if: contains(github.ref, 'master') || contains(github.ref, 'ci-') continue-on-error: true runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v3 - name: Installing the musl runtime run: | sudo apt update --assume-yes sudo apt install musl-tools sudo apt-get --assume-yes install python3-wheel python3-setuptools cabextract gperf sudo pip3 install meson ninja - name: Static r2 build with meson run: | CFLAGS="-static" LDFLAGS="-static" meson --prefix=${HOME}/.local --buildtype release --default-library static build ninja -C build && ninja -C build install - name: meson gpl-less build run: | meson -Dnogpl=true build-nogpl ninja -C build-nogpl macos-test: runs-on: macos-11 if: contains(github.ref, 'master') || contains(github.ref, 'ci-') steps: - name: Checkout uses: actions/checkout@v3 - name: Install dependencies run: | python -m pip install --upgrade pip pip install r2pipe brew install pkg-config - name: Building Radare2 run: export CFLAGS="-O2"; sys/install.sh - name: Running tests run: pip3 install r2pipe; make tests build-rpath-linux: if: contains(github.ref, 'master') || contains(github.ref, 'ci-') name: linux-rpath continue-on-error: true runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v3 - name: build and run run: | # test and build rpath installation export CFLAGS=-O0 ./configure --prefix=/tmp --with-rpath make -j make install ldd /tmp/bin/r2 /tmp/bin/r2 -v /tmp/bin/rabin2 -l /tmp/bin/r2 build-rpath-macos: if: contains(github.ref, 'master') || contains(github.ref, 'ci-') name: macos-rpath continue-on-error: true runs-on: macos-11 steps: - name: Checkout uses: actions/checkout@v3 - name: build and run run: | # test and build rpath installation export CFLAGS=-O0 ./configure --prefix=/tmp --with-rpath make -j make install /tmp/bin/r2 -v /tmp/bin/rabin2 -l /tmp/bin/r2 build-spaces: if: contains(github.ref, 'master') || contains(github.ref, 'ci-') name: linux-meson-spaces runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v3 #- name: XXX this is not possible with make Install from a directory with spaces # run: | # git config pull.rebase false # git clone --depth 1 https://github.com/radareorg/radare2 "spa ces" ; cd "spa ces" ; ./sys/install.sh > /dev/null ; cd .. # r2 -v # - name: Install to a directory with spaces using ACR/MAKE # run: | # git config --global pull.rebase false # git clone --depth 1 https://github.com/radareorg/radare2 # cd radare2 # ./configure --prefix=/usr/local; make uninstall # ./configure --prefix=/usr; make uninstall # ./sys/install.sh "/usr/spa ces" > /dev/null # LD_LIBRARY_PATH="/usr/spa ces/lib" PATH="/usr/spa ces/bin:$PATH" r2 -v # cd .. - name: Build on a directory with spaces (meson only) run: | export PATH=${HOME}/.local/bin:${HOME}/Library/Python/3.9/bin:${PATH} sudo apt-get --assume-yes install python3-wheel gperf python3-setuptools cabextract gperf sudo pip3 install meson ninja git config --global pull.rebase false git clone --depth 1 . "spa ces" cd "spa ces" export CFLAGS="-O0 -Werror -Wno-unused-result -Wno-stringop-truncation" meson --prefix="/tmp/r 2" build ninja -C build ninja -C build install cd .. find "/tmp/r 2" LD_LIBRARY_PATH="/tmp/r 2/lib/x86_64-linux-gnu/" "/tmp/r 2/bin/r2" -v linux-tinyasan-fuzz: runs-on: ubuntu-20.04 continue-on-error: true steps: - name: Checkout uses: actions/checkout@v3 - name: Building Radare2 run: | pip install r2pipe sudo sh -c 'echo 0 > /proc/sys/kernel/randomize_va_space' export SANITIZE=address sys/sanitize.sh - name: Installing tools for the testsuite run: sudo apt-get --assume-yes install python3-wheel python3-setuptools cabextract gperf - name: Running tests run: | export ASAN_OPTIONS="detect_leaks=0 detect_stack_use_after_return=1" export R2R_TIMEOUT=3600 export R2R_SKIP_ARCHOS=1 export LD_LIBRARY_PATH=/usr/local/lib export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.5 r2r -t 3600 test/db/cmd - name: Run fuzz tests run: | export ASAN_OPTIONS="detect_leaks=0 detect_stack_use_after_return=1" export R2R_SKIP_ARCHOS=1 export R2R_TIMEOUT=3600 export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.5 make -C test fuzz-tests linux-asan-fuzz: runs-on: ubuntu-20.04 continue-on-error: true if: contains(github.ref, 'master') || contains(github.ref, 'ci-') steps: - name: Checkout uses: actions/checkout@v3 - name: Building Radare2 run: | pip install r2pipe sudo sh -c 'echo 0 > /proc/sys/kernel/randomize_va_space' sys/sanitize.sh - name: Installing tools for the testsuite run: sudo apt-get --assume-yes install python3-wheel python3-setuptools cabextract gperf - name: Running tests run: | export ASAN_OPTIONS="detect_leaks=0 detect_stack_use_after_return=1" export R2R_SKIP_ARCHOS=1 export R2R_TIMEOUT=3600 export LD_LIBRARY_PATH=/usr/local/lib export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.5 make tests - name: Run fuzz tests run: | export ASAN_OPTIONS="detect_leaks=0 detect_stack_use_after_return=1" export R2R_TIMEOUT=3600 export R2R_SKIP_ARCHOS=1 export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.5 make -C test fuzz-tests w64-make: runs-on: windows-2019 steps: - name: Win configure Pagefile uses: al-cheb/configure-pagefile-action@v1.3 with: minimum-size: 16GB maximum-size: 16GB disk-root: "C:" - name: Checkout uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: python-version: '3.10' - name: Preparing nmake uses: ilammy/msvc-dev-cmd@v1 with: arch: x64 - name: Install dependencies run: | python -m pip install --upgrade pip pip install git+https://github.com/frida/meson.git@f7f25b19a8d71cebf8e2934733eb041eb6862eee pip install ninja r2pipe wget - name: Build with meson + ninja shell: cmd run: | call preconfigure call configure release call make - name: Test executable # continue-on-error: true shell: cmd run: | cd prefix\bin radare2 -v - name: Test executable again # continue-on-error: true shell: cmd run: | cd prefix\bin radare2 -qc "?e Hello" - w32-mingw: if: contains(github.ref, 'master') || contains(github.ref, 'ci-') name: w32-mingw runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v3 - name: Compiling run: | export PATH=${HOME}/.local/bin:${HOME}/Library/Python/3.9/bin:${PATH} sudo apt-get --assume-yes install python3-wheel gperf python3-setuptools cabextract gperf gcc-mingw-w64 sys/mingw32.sh - uses: actions/upload-artifact@v3 with: name: w32-mingw path: radare2*.zip w64-mingw: name: w64-mingw runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v3 - name: Compiling run: | export PATH=${HOME}/.local/bin:${HOME}/Library/Python/3.9/bin:${PATH} sudo apt-get --assume-yes install python3-wheel gperf python3-setuptools cabextract gperf gcc-mingw-w64 sys/mingw64.sh - uses: actions/upload-artifact@v3 with: name: w64-mingw path: radare2*.zip