diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ci.yml similarity index 85% rename from .github/workflows/ccpp.yml rename to .github/workflows/ci.yml index ff9bde5f..edd72529 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Cutter CI +name: CI on: push: @@ -16,25 +16,48 @@ on: jobs: build: + name: ${{ matrix.name }} runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04, ubuntu-18.04, macos-latest, windows-2019] - python-version: [3.7.x] - system-deps: [false] - cc-override: [default] - cxx-override: [default] + name: [ + linux-x86_64, + linux-x86_64-system-deps, + macos-x86_64, + windows-x86_64, + tarball + ] include: - - os: windows-2019 + - name: windows-x86_64 + os: windows-2019 package: true - - os: ubuntu-18.04 # ensure that Cutter can be built at least in basic config on Ubuntu 18.04 using sytem libraries + 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' - - os: ubuntu-18.04 # release package build + - 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 # Prevent one job from pausing the rest fail-fast: false steps: @@ -159,6 +182,7 @@ jobs: 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 - name: cmake macos @@ -199,6 +223,7 @@ jobs: 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') @@ -241,12 +266,21 @@ jobs: 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 - uses: actions/upload-artifact@v2 if: env.PACKAGE_NAME != null with: name: ${{ env.PACKAGE_NAME }} - path: build/${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_PATH }} - name: Get release if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') id: get_release @@ -260,6 +294,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.get_release.outputs.upload_url }} - asset_path: build/${{ env.PACKAGE_NAME }} + asset_path: ${{ env.PACKAGE_PATH }} asset_name: ${{ env.PACKAGE_NAME }} asset_content_type: ${{ env.UPLOAD_ASSET_TYPE }} diff --git a/scripts/tarball.sh b/scripts/tarball.sh new file mode 100755 index 00000000..3876b449 --- /dev/null +++ b/scripts/tarball.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +NAME=${1:-Cutter} + +set -xe +cd $(dirname "${BASH_SOURCE[0]}")/.. + +shopt -s extglob +shopt -s dotglob +mkdir "${NAME}" +cp -r !(${NAME}) "${NAME}" + +pushd "${NAME}" +git clean -dxff . +git submodule update --init --recursive + +pushd rizin +git clean -dxff . +# Possible option: pre-download all subproject, however this makes the tarball huge. +# As opposed to meson dist used for rizin tarballs, this will not just download the ones +# used in a default build, but all of them, including multiple capstone variants. +# meson subprojects download +popd + +pushd src/translations +git clean -dxff . +popd + +find . -name ".git*" | xargs rm -rfv +popd + +tar -czvf "${NAME}-src.tar.gz" "${NAME}"