2019-12-06 10:21:28 +00:00
name : Cutter CI
on :
push :
branches :
- master
2021-03-15 19:08:19 +00:00
tags :
- v*
- upload-test*
2019-12-06 10:21:28 +00:00
pull_request :
branches :
- master
jobs :
build :
runs-on : ${{ matrix.os }}
strategy :
matrix :
2020-12-19 10:43:33 +00:00
os : [ ubuntu-18.04, ubuntu-16.04, macos-latest, windows-2016]
2020-01-20 16:14:05 +00:00
python-version : [ 3.7 .x]
2020-11-25 15:33:30 +00:00
system-deps : [ false ]
cc-override : [ default]
cxx-override : [ default]
include :
2020-12-19 10:43:33 +00:00
- os : windows-2016
package : true
- os : ubuntu-16.04 # ensure that Cutter can be built at least in basic config on Ubuntu 16.04 using sytem libraries
2020-11-25 15:33:30 +00:00
python-version : 3.5 .10
system-deps : true
cc-override : '/usr/bin/gcc-5'
cxx-override : '/usr/bin/g++-5'
2020-12-19 10:43:33 +00:00
- os : ubuntu-16.04 # release package build
system-deps : false
package : true
2019-12-06 10:21:28 +00:00
# Prevent one job from pausing the rest
fail-fast : false
steps :
2020-04-03 12:41:17 +00:00
- uses : actions/checkout@v2
2019-12-06 10:21:28 +00:00
with :
2020-10-28 12:28:04 +00:00
submodules : recursive
2020-04-03 12:41:17 +00:00
persist-credentials : false
2019-12-06 10:21:28 +00:00
- name : apt dependencies
if : contains(matrix.os, 'ubuntu')
2020-04-02 17:55:24 +00:00
run : |
2021-04-05 08:04:17 +00:00
sudo apt-get install libgraphviz-dev mesa-common-dev libxkbcommon-x11-dev libclang-8-dev llvm-8
2020-04-02 17:55:24 +00:00
if [[ "${{ matrix.os }}" = "ubuntu-16.04" ]]
then
2020-12-19 10:43:33 +00:00
sudo apt-get install ninja-build/xenial-backports libxcb1-dev libxkbcommon-dev libxcb-*-dev
2020-11-25 15:33:30 +00:00
if [[ "${{ matrix.system-deps }}" = "true" ]]
then
sudo apt-get install cmake
sudo apt-get install --allow-downgrades \
g++-5=5.4.\* \
gcc-5=5.4.\* \
gcc-5-base=5.4.\* \
libstdc++-5-dev=5.4.\* \
cpp-5=5.4.\* \
libgcc-5-dev=5.4.\* \
libasan2=5.4.\* \
libmpx0=5.4.\*
fi
# make sure cmake that was just installed is at the front of path before
# additional software installed by GitHub
echo /usr/bin >> $GITHUB_PATH
2020-04-02 17:55:24 +00:00
else
sudo apt-get install ninja-build
fi
2020-11-25 15:33:30 +00:00
if [[ "${{ matrix.system-deps }}" = "true" ]]
then
sudo apt-get install qt5-default libqt5svg5-dev qttools5-dev qttools5-dev-tools
fi
- uses : actions/setup-python@v1
with :
python-version : ${{ matrix.python-version }}
2019-12-06 10:21:28 +00:00
- name : homebrew dependencies
if : contains(matrix.os, 'macos')
run : |
cd scripts
2020-12-20 18:14:03 +00:00
rm '/usr/local/bin/2to3' # symlink to some kind of existing python2.7 installation conflicts with brew python3 which gets installed as indirect dependency
2020-07-29 20:16:42 +00:00
brew update --preinstall # temporary workaround for https://github.com/Homebrew/homebrew-bundle/issues/751
2019-12-06 10:21:28 +00:00
brew bundle
2020-11-25 19:25:59 +00:00
brew install coreutils
2019-12-06 10:21:28 +00:00
brew install pkg-config
- name : py dependencies
run : |
2021-01-10 11:07:39 +00:00
# 0.56.1 doesn't work with python 3.5 on Ubuntu 16.04
pip install meson==0.56.0
2021-03-15 19:08:19 +00:00
- name : Prepare package id
shell : bash
run : |
if [[ "${{ startsWith(github.event.ref, 'refs/tags')}}" = "true" ]]
then
PACKAGE_ID="${{ github.event.ref }}"
else
PACKAGE_ID="git-`date "+%Y-%m-%d"`-${{ format('{0}', github.sha) }}"
fi
PACKAGE_ID=${PACKAGE_ID##refs/tags/}
echo PACKAGE_ID=$PACKAGE_ID >> $GITHUB_ENV
2019-12-06 10:21:28 +00:00
- name : cmake ubuntu
if : contains(matrix.os, 'ubuntu')
run : |
2020-11-25 15:33:30 +00:00
if [[ "${{ matrix.system-deps }}" = "false" ]]
then
scripts/fetch_deps.sh
source cutter-deps/env.sh
export PKG_CONFIG_PATH="$CUTTER_DEPS_PYTHON_PREFIX/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
export LD_LIBRARY_PATH="`llvm-config --libdir`:$LD_LIBRARY_PATH"
fi
2020-12-19 10:43:33 +00:00
set -euo pipefail #TODO : move to top once cutter-deps doesn't fail
2020-11-25 15:33:30 +00:00
if [[ "${{ matrix.cc-override }}" != "default" ]]
then
export CC="${{matrix.cc-override}}"
export CXX="${{matrix.cxx-override}}"
fi
2019-12-06 10:21:28 +00:00
source scripts/prepare_breakpad_linux.sh
2020-11-25 15:33:30 +00:00
export PKG_CONFIG_PATH="$CUSTOM_BREAKPAD_PREFIX/lib/pkgconfig:${PKG_CONFIG_PATH:-}" #
2019-12-06 10:21:28 +00:00
mkdir build
cd build
2020-11-25 15:33:30 +00:00
cmake --version
if [[ "${{ matrix.system-deps }}" = "false" ]]
then
cmake \
-G Ninja \
2020-10-28 12:28:04 +00:00
-DCMAKE_BUILD_TYPE=Release \
2020-12-19 10:43:33 +00:00
-DCUTTER_ENABLE_PYTHON=ON \
-DPYTHON_LIBRARY="$CUTTER_DEPS_PYTHON_PREFIX/lib/libpython3.9.so" \
-DPYTHON_INCLUDE_DIR="$CUTTER_DEPS_PYTHON_PREFIX/include/python3.9" \
2020-11-25 15:33:30 +00:00
-DPYTHON_EXECUTABLE="$CUTTER_DEPS_PYTHON_PREFIX/bin/python3" \
2020-12-19 10:43:33 +00:00
-DCUTTER_ENABLE_PYTHON_BINDINGS=ON \
-DCUTTER_ENABLE_GRAPHVIZ=OFF \
2020-11-25 15:33:30 +00:00
-DCUTTER_ENABLE_CRASH_REPORTS=ON \
2020-10-28 12:28:04 +00:00
-DCUTTER_USE_BUNDLED_RIZIN=ON \
2020-12-19 10:43:33 +00:00
-DCUTTER_APPIMAGE_BUILD=ON \
-DCUTTER_ENABLE_PACKAGING=ON \
-DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON \
-DCUTTER_PACKAGE_RZ_GHIDRA=ON \
-DCMAKE_INSTALL_PREFIX=appdir/usr \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \
2020-12-02 17:53:17 +00:00
..
2020-11-25 15:33:30 +00:00
else
cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
2020-10-28 12:28:04 +00:00
-DCUTTER_USE_BUNDLED_RIZIN=ON \
2020-12-02 17:53:17 +00:00
..
2020-11-25 15:33:30 +00:00
fi
ninja
2020-12-19 10:43:33 +00:00
if [[ "${{ matrix.package || false }}" = "true" ]]
then
export CUTTER_VERSION=$(python ../scripts/get_version.py)
export VERSION=$CUTTER_VERSION
ninja install
"../scripts/appimage_embed_python.sh" appdir
APP_PREFIX=`pwd`/appdir/usr
# export LD_LIBRARY_PATH=${APP_PREFIX}/lib:$Shiboken2_ROOT/lib
export PATH=$PATH:${APP_PREFIX}/bin
2021-01-16 10:48:31 +00:00
"../scripts/jsdec.sh" --prefix=`pwd`/appdir/usr
2020-12-19 10:43:33 +00:00
wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/6/linuxdeployqt-6-x86_64.AppImage"
chmod a+x linuxdeployqt*.AppImage
rm -fv "../cutter-deps/qt/plugins/imageformats/libqjp2.so"
# ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -executable=./appdir/usr/bin/python3 -bundle-non-qt-libs -no-strip -exclude-libs=libnss3.so,libnssutil3.so,libqjp2.so -ignore-glob=usr/lib/python3.9/**/* -verbose=2
# exclude librzghidra cutter plugin because cutter and rz plugin is loaded manuallly as they are plugins linuxdeployqt doesn't know this
./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop \
-executable=./appdir/usr/bin/python3 \
-appimage \
-no -strip -exclude-libs=libnss3.so,libnssutil3.so,libqjp2.so \
-ignore-glob=usr/lib/python3.9/**/* \
2021-04-02 12:21:02 +00:00
-ignore-glob=usr/share/rizin/cutter/plugins/native/librz_ghidra_cutter.so \
2020-12-19 10:43:33 +00:00
-verbose=2
find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq
2021-03-15 19:08:19 +00:00
export APPIMAGE_FILE="Cutter-${PACKAGE_ID}-x64.Linux.AppImage"
2020-12-19 10:43:33 +00:00
mv Cutter-*-x86_64.AppImage "$APPIMAGE_FILE"
echo PACKAGE_NAME=$APPIMAGE_FILE >> $GITHUB_ENV
2021-03-15 19:08:19 +00:00
echo UPLOAD_ASSET_TYPE=application/x-executable >> $GITHUB_ENV
2020-12-19 10:43:33 +00:00
fi
2019-12-06 10:21:28 +00:00
- name : cmake macos
shell : bash
if : contains(matrix.os, 'macos')
run : |
2021-04-07 08:30:50 +00:00
export MACOSX_DEPLOYMENT_TARGET=10.14
2019-12-06 10:21:28 +00:00
scripts/fetch_deps.sh
source cutter-deps/env.sh
2021-01-02 17:57:29 +00:00
set -euo pipefail
2019-12-06 10:21:28 +00:00
export PATH=/usr/local/opt/llvm/bin:$PATH
source scripts/prepare_breakpad_macos.sh
mkdir build
cd build
2021-03-15 19:08:19 +00:00
PACKAGE_NAME=Cutter-${PACKAGE_ID}-Darwin
2019-12-06 10:21:28 +00:00
cmake \
-DCMAKE_BUILD_TYPE=Release \
2020-12-19 10:43:33 +00:00
-DPYTHON_LIBRARY="$CUTTER_DEPS_PYTHON_PREFIX/lib/libpython3.9.dylib" \
-DPYTHON_INCLUDE_DIR="$CUTTER_DEPS_PYTHON_PREFIX/include/python3.9" \
2019-12-06 10:21:28 +00:00
-DPYTHON_EXECUTABLE="$CUTTER_DEPS_PYTHON_PREFIX/bin/python3" \
-DCUTTER_ENABLE_PYTHON=ON \
-DCUTTER_ENABLE_PYTHON_BINDINGS=ON \
-DCUTTER_ENABLE_CRASH_REPORTS=ON \
2020-10-28 12:28:04 +00:00
-DCUTTER_USE_BUNDLED_RIZIN=ON \
2020-12-19 10:43:33 +00:00
-DCUTTER_ENABLE_PACKAGING=ON \
2021-01-02 17:57:29 +00:00
-DCUTTER_PACKAGE_DEPENDENCIES=ON \
-DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON \
-DCUTTER_PACKAGE_RZ_GHIDRA=ON \
2021-02-18 14:36:27 +00:00
-DCUTTER_PACKAGE_JSDEC=ON \
2021-03-15 19:08:19 +00:00
-DCPACK_PACKAGE_FILE_NAME="$PACKAGE_NAME" \
2021-01-02 17:57:29 +00:00
-DCMAKE_FRAMEWORK_PATH="$BREAKPAD_FRAMEWORK_DIR" \
2021-01-24 09:11:26 +00:00
-DCPACK_BUNDLE_APPLE_CERT_APP="-" \
2020-12-02 17:53:17 +00:00
.. && \
2019-12-06 10:21:28 +00:00
make -j4;
2021-01-02 17:57:29 +00:00
make package
export CUTTER_VERSION=$(python3 ../scripts/get_version.py)
2021-03-15 19:08:19 +00:00
echo PACKAGE_NAME=${PACKAGE_NAME}.dmg >> $GITHUB_ENV
echo UPLOAD_ASSET_TYPE=application/x-apple-diskimage >> $GITHUB_ENV
2020-08-30 20:23:41 +00:00
- name : windows dependencies
2020-12-19 10:43:33 +00:00
if : contains(matrix.os, 'windows')
2020-08-01 14:07:19 +00:00
shell : bash
run : |
pip install ninja
scripts/fetch_deps.sh
2020-09-06 08:52:13 +00:00
choco install winflexbison3
2020-08-30 20:23:41 +00:00
- name : windows cmake
2020-12-19 10:43:33 +00:00
if : contains(matrix.os, 'windows')
2020-08-30 20:23:41 +00:00
shell : cmd
run : |
2020-09-05 08:25:34 +00:00
set ARCH=x64
2020-08-30 20:23:41 +00:00
set CUTTER_DEPS=%CD%\cutter-deps
set PATH=%CD%\cutter-deps\qt\bin;%PATH%
2020-12-19 10:43:33 +00:00
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
2020-09-05 08:25:34 +00:00
call scripts\prepare_breakpad.bat
2020-08-30 20:23:41 +00:00
cd
2020-08-01 14:07:19 +00:00
mkdir build
cd build
2021-03-15 19:08:19 +00:00
set PACKAGE_NAME=cutter-%PACKAGE_ID%-x64.Windows
2020-08-30 20:23:41 +00:00
cmake ^
-DCMAKE_BUILD_TYPE=Release ^
2020-10-28 12:28:04 +00:00
-DCUTTER_USE_BUNDLED_RIZIN=ON ^
2020-08-30 20:23:41 +00:00
-DCUTTER_ENABLE_PYTHON=ON ^
-DCUTTER_ENABLE_PYTHON_BINDINGS=ON ^
2020-12-19 10:43:33 +00:00
-DCUTTER_ENABLE_PACKAGING=ON ^
2020-08-30 20:23:41 +00:00
-DCUTTER_PACKAGE_DEPENDENCIES=ON ^
2020-12-19 10:43:33 +00:00
-DCUTTER_PACKAGE_RZ_GHIDRA=ON ^
2021-01-16 10:48:31 +00:00
-DCUTTER_PACKAGE_JSDEC=ON ^
2020-08-30 20:23:41 +00:00
-DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON ^
2020-09-05 08:25:34 +00:00
-DCUTTER_ENABLE_CRASH_REPORTS=ON ^
2020-08-30 20:23:41 +00:00
-DCMAKE_PREFIX_PATH="%CUTTER_DEPS%\pyside" ^
-DCPACK_PACKAGE_FILE_NAME=%PACKAGE_NAME% ^
-G Ninja ^
2020-12-02 17:53:17 +00:00
..
2020-08-30 20:23:41 +00:00
cmake --build . --config Release
cmake --build . --config Release --target package
2020-10-07 16:51:25 +00:00
echo PACKAGE_NAME=%PACKAGE_NAME%.zip >> %GITHUB_ENV%
2021-03-15 19:08:19 +00:00
echo UPLOAD_ASSET_TYPE=application/zip >> %GITHUB_ENV%
2020-08-30 20:23:41 +00:00
- uses : actions/upload-artifact@v2
if : env.PACKAGE_NAME != null
with :
name : ${{ env.PACKAGE_NAME }}
path : build/${{ env.PACKAGE_NAME }}
2021-03-15 19:08:19 +00:00
- name : Get release
if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
id : get_release
uses : karliss/get-release@23b8b7144dd5b0c9d6942b2fb78bd9ae71546d03
env :
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
- name : Upload release assets
if : steps.get_release.outputs.upload_url != null && env.PACKAGE_NAME != null
uses : actions/upload-release-asset@v1.0.2
env :
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
with :
upload_url : ${{ steps.get_release.outputs.upload_url }}
asset_path : build/${{ env.PACKAGE_NAME }}
asset_name : ${{ env.PACKAGE_NAME }}
asset_content_type : ${{ env.UPLOAD_ASSET_TYPE }}