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: on:
push: push:
@ -16,25 +16,48 @@ on:
jobs: jobs:
build: build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-20.04, ubuntu-18.04, macos-latest, windows-2019] name: [
python-version: [3.7.x] linux-x86_64,
system-deps: [false] linux-x86_64-system-deps,
cc-override: [default] macos-x86_64,
cxx-override: [default] windows-x86_64,
tarball
]
include: include:
- os: windows-2019 - name: windows-x86_64
os: windows-2019
package: true 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 python-version: 3.6.x
system-deps: true system-deps: true
cc-override: '/usr/bin/gcc-7' cc-override: '/usr/bin/gcc-7'
cxx-override: '/usr/bin/g++-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 system-deps: false
package: true 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 # Prevent one job from pausing the rest
fail-fast: false fail-fast: false
steps: steps:
@ -159,6 +182,7 @@ jobs:
export APPIMAGE_FILE="Cutter-${PACKAGE_ID}-Linux-x86_64.AppImage" export APPIMAGE_FILE="Cutter-${PACKAGE_ID}-Linux-x86_64.AppImage"
mv Cutter-*-x86_64.AppImage "$APPIMAGE_FILE" mv Cutter-*-x86_64.AppImage "$APPIMAGE_FILE"
echo PACKAGE_NAME=$APPIMAGE_FILE >> $GITHUB_ENV echo PACKAGE_NAME=$APPIMAGE_FILE >> $GITHUB_ENV
echo PACKAGE_PATH=build/$APPIMAGE_FILE >> $GITHUB_ENV
echo UPLOAD_ASSET_TYPE=application/x-executable >> $GITHUB_ENV echo UPLOAD_ASSET_TYPE=application/x-executable >> $GITHUB_ENV
fi fi
- name: cmake macos - name: cmake macos
@ -199,6 +223,7 @@ jobs:
make package make package
export CUTTER_VERSION=$(python3 ../scripts/get_version.py) export CUTTER_VERSION=$(python3 ../scripts/get_version.py)
echo PACKAGE_NAME=${PACKAGE_NAME}.dmg >> $GITHUB_ENV 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 echo UPLOAD_ASSET_TYPE=application/x-apple-diskimage >> $GITHUB_ENV
- name: windows dependencies - name: windows dependencies
if: contains(matrix.os, 'windows') if: contains(matrix.os, 'windows')
@ -241,12 +266,21 @@ jobs:
cmake --build . --config Release cmake --build . --config Release
cmake --build . --config Release --target package cmake --build . --config Release --target package
echo PACKAGE_NAME=%PACKAGE_NAME%.zip >> %GITHUB_ENV% 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% 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 - uses: actions/upload-artifact@v2
if: env.PACKAGE_NAME != null if: env.PACKAGE_NAME != null
with: with:
name: ${{ env.PACKAGE_NAME }} name: ${{ env.PACKAGE_NAME }}
path: build/${{ env.PACKAGE_NAME }} path: ${{ env.PACKAGE_PATH }}
- name: Get release - name: Get release
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
id: get_release id: get_release
@ -260,6 +294,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{ steps.get_release.outputs.upload_url }} 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_name: ${{ env.PACKAGE_NAME }}
asset_content_type: ${{ env.UPLOAD_ASSET_TYPE }} 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}"