From bd76b712adde6a6606b4fd34a139b8416571944d Mon Sep 17 00:00:00 2001 From: Revertron Date: Sat, 17 Apr 2021 19:06:40 +0200 Subject: [PATCH] Changed build system and Github Actions script for build generation. From now on builds will be UPXed. And there will be naked binaries for every (linux nogui) build. --- .github/workflows/rust_create_release.yml | 23 ++++++++++++----------- contrib/deb/generate.sh | 20 ++++++++++++++------ 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.github/workflows/rust_create_release.yml b/.github/workflows/rust_create_release.yml index e372aa1..89f5ecd 100644 --- a/.github/workflows/rust_create_release.yml +++ b/.github/workflows/rust_create_release.yml @@ -42,7 +42,7 @@ jobs: ## A new version * Various fixes and stability improvements. draft: true - prerelease: true + prerelease: false build-and-upload: name: Create and upload builds @@ -58,16 +58,16 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 - - name: install libgtk-dev libwebkit2gtk-4.0 - run: | - sudo apt update && sudo apt install libwebkit2gtk-4.0-dev - cargo install cross + - name: install dependencies if: contains(matrix.os, 'ubuntu') + run: | + sudo apt update && sudo apt install libwebkit2gtk-4.0-dev upx + cargo install cross - name: Build release binaries run: | cargo build --release cargo build --release --no-default-features --target-dir nogui - - name: Build Windows release binaries with Edge + - name: Build Windows release binaries with Edge web-engine if: contains(matrix.os, 'windows') run: cargo build --release --features "edge" --target-dir edge - name: Build and package deb packages @@ -80,12 +80,13 @@ jobs: PKGARCH=armhf contrib/deb/generate.sh PKGARCH=arm64 contrib/deb/generate.sh - - name: Upload debs + - name: Upload bins & debs if: contains(matrix.os, 'ubuntu') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | tag_name="${{ needs.get_version.outputs.project_version }}" + hub release edit $(find ./bin -type f -name "alfis-*" -printf "-a %p ") -m "" "$tag_name" hub release edit $(find . -type f -name "*.deb" -printf "-a %p ") -m "" "$tag_name" - name: win_arch @@ -137,8 +138,8 @@ jobs: files: ${{ env.BIN_PATH_EDGE }} alfis.toml README.md LICENSE adblock.txt dest: ${{ env.ZIP_NAME_EDGE }} - - name: Upload binary - id: upload-binary + - name: Upload zip + id: upload-zip uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -148,8 +149,8 @@ jobs: asset_name: ${{ env.ZIP_NAME }} asset_content_type: application/zip - - name: Upload no GUI binary - id: upload-nogui-binary + - name: Upload NoGUI zip + id: upload-nogui-zip uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/contrib/deb/generate.sh b/contrib/deb/generate.sh index ef5d458..ddae175 100755 --- a/contrib/deb/generate.sh +++ b/contrib/deb/generate.sh @@ -21,18 +21,26 @@ PKGREPLACES=alfis # PKGREPLACES=alfis-develop #fi +mkdir -p bin + +TARGET="" # Building nogui versions only -if [ $PKGARCH = "amd64" ]; then cargo build --release --no-default-features --target x86_64-unknown-linux-musl && cp target/x86_64-unknown-linux-musl/release/alfis ./alfis -elif [ $PKGARCH = "i686" ]; then cross build --release --no-default-features --target i686-unknown-linux-musl && cp target/i686-unknown-linux-musl/release/alfis ./alfis -elif [ $PKGARCH = "mipsel" ]; then cross build --release --no-default-features --target mipsel-unknown-linux-musl && cp target/mipsel-unknown-linux-musl/release/alfis ./alfis -elif [ $PKGARCH = "mips" ]; then cross build --release --no-default-features --target mips-unknown-linux-musl && cp target/mips-unknown-linux-musl/release/alfis ./alfis -elif [ $PKGARCH = "armhf" ]; then cross build --release --no-default-features --target armv7-unknown-linux-musleabihf && cp target/armv7-unknown-linux-musleabihf/release/alfis ./alfis -elif [ $PKGARCH = "arm64" ]; then cross build --release --no-default-features --target aarch64-unknown-linux-musl && cp target/aarch64-unknown-linux-musl/release/alfis ./alfis +if [ $PKGARCH = "amd64" ]; then TARGET='x86_64-unknown-linux-musl' +elif [ $PKGARCH = "i686" ]; then TARGET='i686-unknown-linux-musl' +elif [ $PKGARCH = "mipsel" ]; then TARGET='mipsel-unknown-linux-musl' +elif [ $PKGARCH = "mips" ]; then TARGET='mips-unknown-linux-musl' +elif [ $PKGARCH = "armhf" ]; then TARGET='armv7-unknown-linux-musleabihf' +elif [ $PKGARCH = "arm64" ]; then TARGET='aarch64-unknown-linux-musl' else echo "Specify PKGARCH=amd64,i686,mips,mipsel,armhf,arm64" exit 1 fi +cross build --release --no-default-features --target $TARGET +upx target/$TARGET/release/alfis +cp target/$TARGET/release/alfis ./alfis +cp target/$TARGET/release/alfis ./bin/alfis-linux-$PKGARCH-v$PKGVERSION-nogui + echo "Building $PKGFILE" mkdir -p /tmp/$PKGNAME/