cutter/.github/workflows/ci.yml

309 lines
12 KiB
YAML
Raw Normal View History

name: CI
2019-12-06 10:21:28 +00:00
on:
push:
branches:
2021-12-21 12:39:25 +00:00
- dev
- stable
tags:
- v*
- upload-test*
2019-12-06 10:21:28 +00:00
pull_request:
branches:
2021-12-21 12:39:25 +00:00
- dev
- stable
2019-12-06 10:21:28 +00:00
jobs:
build:
name: ${{ matrix.name }}
2019-12-06 10:21:28 +00:00
runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [
linux-x86_64,
linux-x86_64-system-deps,
2023-02-07 13:28:57 +00:00
linux-x86_64-qt6-system-deps,
macos-x86_64,
windows-x86_64,
tarball
]
include:
- name: windows-x86_64
os: windows-2019
package: true
system-deps: false
python-version: 3.7.x
- name: linux-x86_64-system-deps # ensure that Cutter can be built at least in basic config on Ubuntu 18.04 using sytem libraries
os: ubuntu-18.04
python-version: 3.6.x
system-deps: true
cc-override: '/usr/bin/gcc-7'
cxx-override: '/usr/bin/g++-7'
2023-02-07 13:28:57 +00:00
- name: linux-x86_64-qt6-system-deps # ensure that Cutter can be built at least in basic config on Ubuntu 22.04 using sytem libraries
os: ubuntu-22.04
python-version: 3.10.x
system-deps: true
cc-override: '/usr/bin/gcc-12'
cxx-override: '/usr/bin/g++-12'
- name: linux-x86_64
os: ubuntu-18.04
python-version: 3.7.x
system-deps: false
package: true
cc-override: default
cxx-override: default
- name: macos-x86_64
os: macos-latest
python-version: 3.7.x
system-deps: false
package: true
cc-override: default
cxx-override: default
- name: tarball
python-version: 3.7.x
os: ubuntu-20.04
system-deps: false
tarball: true
2019-12-06 10:21:28 +00:00
# Prevent one job from pausing the rest
fail-fast: false
steps:
2022-11-02 11:13:57 +00:00
- uses: actions/checkout@v3
2019-12-06 10:21:28 +00:00
with:
2020-10-28 12:28:04 +00:00
submodules: recursive
persist-credentials: false
2019-12-06 10:21:28 +00:00
- name: apt dependencies
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get update
2023-02-07 13:28:57 +00:00
sudo apt-get install libgraphviz-dev mesa-common-dev libxkbcommon-x11-dev ninja-build
if [[ "${{ matrix.os }}" = "ubuntu-18.04" || "${{ matrix.os }}" = "ubuntu-20.04" ]]
then
# install additional packages needed for appimage
2023-02-07 13:28:57 +00:00
sudo apt-get install libxcb1-dev libxkbcommon-dev libxcb-*-dev libegl1 libclang-8-dev llvm-8
fi
2023-02-07 13:28:57 +00:00
if [[ "${{ matrix.os }}" = "ubuntu-18.04" && "${{ matrix.system-deps }}" = "true" ]]
then
sudo apt-get install qt5-default libqt5svg5-dev qttools5-dev qttools5-dev-tools
fi
2023-02-07 13:28:57 +00:00
if [[ "${{ matrix.os }}" = "ubuntu-22.04" ]]
then
sudo apt-get install libclang-12-dev llvm-12 qt6-base-dev qt6-tools-dev \
qt6-tools-dev-tools libqt6svg6-dev libqt6core5compat6-dev libqt6svgwidgets6 qt6-l10n-tools
fi
2022-11-02 11:13:57 +00:00
- uses: actions/setup-python@v4
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
rm /usr/local/bin/2to3* # symlink to some kind of existing python2.7 installation conflicts with brew python3 which gets installed as indirect dependency
2019-12-06 10:21:28 +00:00
brew bundle
- name: py dependencies
run: |
2022-02-09 14:04:04 +00:00
python3 -m pip install -U pip==21.3.1
pip install meson==0.61.5 # https://github.com/rizinorg/cutter/runs/7170222817?check_suite_focus=true
- 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: |
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
set -euo pipefail #TODO: move to top once cutter-deps doesn't fail
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
mkdir build
cd build
cmake --version
if [[ "${{ matrix.system-deps }}" = "false" ]]
then
cmake \
-G Ninja \
2020-10-28 12:28:04 +00:00
-DCMAKE_BUILD_TYPE=Release \
-DCUTTER_ENABLE_PYTHON=ON \
-DPYTHON_LIBRARY="$CUTTER_DEPS_PYTHON_PREFIX/lib/libpython3.9.so" \
-DPYTHON_INCLUDE_DIR="$CUTTER_DEPS_PYTHON_PREFIX/include/python3.9" \
-DPYTHON_EXECUTABLE="$CUTTER_DEPS_PYTHON_PREFIX/bin/python3" \
-DCUTTER_ENABLE_PYTHON_BINDINGS=ON \
-DCUTTER_ENABLE_GRAPHVIZ=OFF \
2020-10-28 12:28:04 +00:00
-DCUTTER_USE_BUNDLED_RIZIN=ON \
-DCUTTER_APPIMAGE_BUILD=ON \
-DCUTTER_ENABLE_PACKAGING=ON \
-DCUTTER_ENABLE_SIGDB=ON \
-DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON \
-DCUTTER_PACKAGE_RZ_GHIDRA=ON \
-DCUTTER_PACKAGE_JSDEC=ON \
-DCUTTER_PACKAGE_RZ_LIBSWIFT=ON \
-DCUTTER_PACKAGE_RZ_LIBYARA=ON \
-DCMAKE_INSTALL_PREFIX=appdir/usr \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \
..
2023-02-07 13:28:57 +00:00
elif [[ "${{ matrix.os }}" = "ubuntu-22.04" ]]
then
cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCUTTER_QT6=ON \
-DCUTTER_USE_BUNDLED_RIZIN=ON \
..
else
cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
2020-10-28 12:28:04 +00:00
-DCUTTER_USE_BUNDLED_RIZIN=ON \
..
fi
ninja
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="$LD_LIBRARY_PATH:$APP_PREFIX/lib/rizin/plugins"
export PATH=$PATH:${APP_PREFIX}/bin
wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-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 \
-appimage \
-no-strip -exclude-libs=libnss3.so,libnssutil3.so,libqjp2.so \
-ignore-glob=usr/lib/python3.9/**/* \
-verbose=2
find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq
export APPIMAGE_FILE="Cutter-${PACKAGE_ID}-Linux-x86_64.AppImage"
mv Cutter-*-x86_64.AppImage "$APPIMAGE_FILE"
echo PACKAGE_NAME=$APPIMAGE_FILE >> $GITHUB_ENV
echo PACKAGE_PATH=build/$APPIMAGE_FILE >> $GITHUB_ENV
echo UPLOAD_ASSET_TYPE=application/x-executable >> $GITHUB_ENV
fi
2019-12-06 10:21:28 +00:00
- name: cmake macos
shell: bash
if: contains(matrix.os, 'macos')
run: |
export MACOSX_DEPLOYMENT_TARGET=10.14
2019-12-06 10:21:28 +00:00
scripts/fetch_deps.sh
source cutter-deps/env.sh
set -euo pipefail
2019-12-06 10:21:28 +00:00
export PATH=/usr/local/opt/llvm/bin:$PATH
mkdir build
cd build
PACKAGE_NAME=Cutter-${PACKAGE_ID}-macOS-x86_64
2019-12-06 10:21:28 +00:00
cmake \
-DCMAKE_BUILD_TYPE=Release \
-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 \
2020-10-28 12:28:04 +00:00
-DCUTTER_USE_BUNDLED_RIZIN=ON \
-DCUTTER_ENABLE_PACKAGING=ON \
-DCUTTER_ENABLE_SIGDB=ON \
-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 \
-DCUTTER_PACKAGE_RZ_LIBSWIFT=ON \
-DCUTTER_PACKAGE_RZ_LIBYARA=ON \
-DCPACK_PACKAGE_FILE_NAME="$PACKAGE_NAME" \
-DCPACK_BUNDLE_APPLE_CERT_APP="-" \
.. && \
2019-12-06 10:21:28 +00:00
make -j4;
make package
export CUTTER_VERSION=$(python3 ../scripts/get_version.py)
echo PACKAGE_NAME=${PACKAGE_NAME}.dmg >> $GITHUB_ENV
echo PACKAGE_PATH=build/${PACKAGE_NAME}.dmg >> $GITHUB_ENV
echo UPLOAD_ASSET_TYPE=application/x-apple-diskimage >> $GITHUB_ENV
- name: windows dependencies
if: contains(matrix.os, 'windows')
shell: bash
run: |
pip install ninja
scripts/fetch_deps.sh
choco install winflexbison3
- name: windows cmake
if: contains(matrix.os, 'windows')
shell: cmd
run: |
set ARCH=x64
set CUTTER_DEPS=%CD%\cutter-deps
set PATH=%CD%\cutter-deps\qt\bin;%PATH%
2022-03-30 08:57:10 +00:00
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
cd
mkdir build
cd build
set PACKAGE_NAME=Cutter-%PACKAGE_ID%-Windows-x86_64
cmake ^
-DCMAKE_BUILD_TYPE=Release ^
2020-10-28 12:28:04 +00:00
-DCUTTER_USE_BUNDLED_RIZIN=ON ^
-DCUTTER_ENABLE_PYTHON=ON ^
-DCUTTER_ENABLE_PYTHON_BINDINGS=ON ^
-DCUTTER_ENABLE_PACKAGING=ON ^
-DCUTTER_ENABLE_SIGDB=ON ^
-DCUTTER_PACKAGE_DEPENDENCIES=ON ^
-DCUTTER_PACKAGE_RZ_GHIDRA=ON ^
-DCUTTER_PACKAGE_RZ_LIBSWIFT=ON ^
-DCUTTER_PACKAGE_RZ_LIBYARA=ON ^
-DCUTTER_PACKAGE_JSDEC=ON ^
-DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON ^
-DCMAKE_PREFIX_PATH="%CUTTER_DEPS%\pyside" ^
-DCPACK_PACKAGE_FILE_NAME=%PACKAGE_NAME% ^
-G Ninja ^
..
cmake --build . --config Release
cmake --build . --config Release --target package
echo PACKAGE_NAME=%PACKAGE_NAME%.zip >> %GITHUB_ENV%
echo PACKAGE_PATH=build/%PACKAGE_NAME%.zip >> %GITHUB_ENV%
echo UPLOAD_ASSET_TYPE=application/zip >> %GITHUB_ENV%
- name: Create tarball
if: matrix.tarball
shell: bash
run: |
scripts/tarball.sh "Cutter-${PACKAGE_ID}"
echo PACKAGE_NAME=Cutter-${PACKAGE_ID}-src.tar.gz >> $GITHUB_ENV
echo PACKAGE_PATH=Cutter-${PACKAGE_ID}-src.tar.gz >> $GITHUB_ENV
echo UPLOAD_ASSET_TYPE=application/gzip >> $GITHUB_ENV
2022-11-02 11:13:57 +00:00
- uses: actions/upload-artifact@v3
if: env.PACKAGE_NAME != null
with:
name: ${{ env.PACKAGE_NAME }}
path: ${{ env.PACKAGE_PATH }}
- name: Get release
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
id: get_release
uses: rizinorg/gha-get-release@c8074dd5d13ddd0a194d8c9205a1466973c7dc0d
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: ${{ env.PACKAGE_PATH }}
asset_name: ${{ env.PACKAGE_NAME }}
asset_content_type: ${{ env.UPLOAD_ASSET_TYPE }}