Generate and deploy source tarball (Fix #2878) (#3036)

This builds a real tarball, as opposed to the flawed GitHub-generated
one, and also includes the following changes:

Individual builds now have dedicated names like "linux-x86_64". The
structure in the yml is now very similar to how it is in rizin.

Since that means builds are renamed, the filename has also been changed
from the meaningless "ccpp.yml" to "ci.yml", as that would have happened
sooner or later anyway and now will not produce additional intermediate
rename states.

The workflow name inside that file is now also just "CI" since adding
"Cutter" there is redundant.
This commit is contained in:
Florian Märkl 2022-08-24 15:51:00 +02:00 committed by GitHub
parent e6db27135d
commit d6370541e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 77 additions and 11 deletions

View File

@ -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 }}

32
scripts/tarball.sh Executable file
View File

@ -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}"