Skip to content

Commit

Permalink
build release for provider
Browse files Browse the repository at this point in the history
  • Loading branch information
prekucki committed Sep 30, 2020
1 parent b1eef0d commit b2c9c2b
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 38 deletions.
64 changes: 64 additions & 0 deletions .ci/pack-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

fail() {
printf "%s\n" "$1" >&2
exit 1
}

not_empty() {
test -z "$1" && fail "expected $2"
}


not_empty "$GITHUB_REF" GITHUB_REF
not_empty "$OS_NAME" OS_NAME


if [ "$OS_NAME" = "ubuntu" ]; then
OS_NAME=linux
target=x86_64-unknown-linux-musl/
exe=""
elif [ "$OS_NAME" == "macos" ]; then
OS_NAME=osx
elif [ "$OS_NAME" == "windows" ]; then
exe=".exe"
else
fail "unknown os name: $OS_NAME"
fi

TAG_NAME="${GITHUB_REF##*/}"

generate_asset() {
local asset_type=$1
local bins="$2"
local lib_bins="$3"
local TARGET_DIR=releases/golem-${asset_type}-${OS_NAME}-${TAG_NAME}
mkdir -p "$TARGET_DIR"
for component in $bins $lib_bins; do
strip -x target/${target}release/${component}${exe}
done
for bin in $bins; do
cp "target/${target}release/${bin}${exe}" "$TARGET_DIR/"
done
if test -n "$lib_bins"; then
mkdir -p "$TARGET_DIR/plugins"
for bin in $lib_bins; do
cp "target/${target}release/${bin}${exe}" "$TARGET_DIR/plugins"
done
fi
if [ "$OS_NAME" = "windows" ]; then
echo "::set-output name=${asset_type}Artifact::golem-${asset_type}-${OS_NAME}-${TAG_NAME}.zip"
echo "::set-output name=${asset_type}Media::application/zip"
(cd "$TARGET_DIR" && 7z a "../golem-${asset_type}-${OS_NAME}-${TAG_NAME}.zip" * )
else
echo "::set-output name=${asset_type}Artifact::golem-${asset_type}-${OS_NAME}-${TAG_NAME}.tar.gz"
echo "::set-output name=${asset_type}Media::application/tar+gzip"
(cd releases && tar czf "golem-${asset_type}-${OS_NAME}-${TAG_NAME}.tar.gz" "golem-${asset_type}-${OS_NAME}-${TAG_NAME}")
fi
}

generate_asset "req" "yagna gftp"
generate_asset "prov" "golem yagna ya-provider" "exe-unit"




64 changes: 30 additions & 34 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
tags:
- v*
- pre-rel-*

jobs:
create-release:
Expand Down Expand Up @@ -38,13 +39,16 @@ jobs:
needs: create-release
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os:
- ubuntu
- windows
- macos

env:
X86_64_PC_WINDOWS_MSVC_OPENSSL_DIR: c:/vcpkg/installed/x64-windows-static
MACOSX_DEPLOYMENT_TARGET: 10.13
OPENSSL_STATIC: 1

steps:
Expand Down Expand Up @@ -87,6 +91,9 @@ jobs:
run: |
cargo build --release --features static-openssl
cargo build --bin gftp -p gftp --release
cargo build --bin golem -p golem --release
cargo build --bin ya-provider -p ya-provider --release
cargo build --bin exe-unit -p ya-exe-unit --release --features openssl/vendored
- name: Build windows
if: matrix.os == 'windows'
run: |
Expand All @@ -95,56 +102,45 @@ jobs:
cargo build --release
cargo build --bin gftp -p gftp --release
cargo build --bin golem -p golem --release
cargo build --bin ya-provider -p ya-provider --release
cargo build --bin exe-unit -p ya-exe-unit --release
- name: Build linux
if: matrix.os == 'ubuntu'
run: |
cargo build --release --features openssl/vendored --target x86_64-unknown-linux-musl
cargo build --bin gftp -p gftp --release --target x86_64-unknown-linux-musl
cargo build --bin golem -p golem --release --target x86_64-unknown-linux-musl
cargo build --bin ya-provider -p ya-provider --release --target x86_64-unknown-linux-musl
cargo build --bin exe-unit -p ya-exe-unit --release --features openssl/vendored --target x86_64-unknown-linux-musl
- name: Pack
id: pack
shell: bash
env:
OS_NAME: ${{ matrix.os }}
GITHUB_REF: ${{ github.ref }}
run: |
TAG_NAME="${GITHUB_REF##*/}"
target=
if [ "$OS_NAME" = "ubuntu" ]; then
OS_NAME=linux
target=x86_64-unknown-linux-musl/
elif [ "$OS_NAME" == "macos" ]; then
OS_NAME=osx
fi
TARGET_DIR=releases/golem-${OS_NAME}-${TAG_NAME}
mkdir -p "$TARGET_DIR"
if [ "$OS_NAME" = "windows" ]; then
cp target/release/yagna.exe target/release/gftp.exe "$TARGET_DIR/"
strip "$TARGET_DIR/yagna.exe"
strip "$TARGET_DIR/gftp.exe"
else
cp target/${target}release/yagna target/${target}release/gftp "$TARGET_DIR/"
strip "$TARGET_DIR/yagna"
strip "$TARGET_DIR/gftp"
fi
ls -al "$TARGET_DIR"
if [ "$OS_NAME" = "windows" ]; then
echo "::set-output name=artifact::golem-${OS_NAME}-${TAG_NAME}.zip"
echo "::set-output name=media::application/zip"
(cd "$TARGET_DIR" && 7z a "../golem-${OS_NAME}-${TAG_NAME}.zip" * )
else
echo "::set-output name=artifact::golem-${OS_NAME}-${TAG_NAME}.tar.gz"
echo "::set-output name=media::application/tar+gzip"
(cd releases && tar czvf "golem-${OS_NAME}-${TAG_NAME}.tar.gz" "golem-${OS_NAME}-${TAG_NAME}")
fi
- name: Upload Release Asset
id: upload-release-asset
bash .ci/pack-build.sh
- name: Upload Release Asset [Requestor]
id: upload-release-asset-req
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release_upload_url.outputs.result }}
asset_path: ./releases/${{ steps.pack.outputs.reqArtifact }}
asset_name: ${{ steps.pack.outputs.reqArtifact }}
asset_content_type: ${{ steps.pack.outputs.reqMedia }}
- name: Upload Release Asset [Provider]
id: upload-release-asset-prov
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release_upload_url.outputs.result }}
asset_path: ./releases/${{ steps.pack.outputs.artifact }}
asset_name: ${{ steps.pack.outputs.artifact }}
asset_content_type: ${{ steps.pack.outputs.media }}
asset_path: ./releases/${{ steps.pack.outputs.provArtifact }}
asset_name: ${{ steps.pack.outputs.provArtifact }}
asset_content_type: ${{ steps.pack.outputs.provMedia }}


1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
repos:
- repo: https://github.com/doublify/pre-commit-rust
rev: master
hooks:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ market-forwarding = ['ya-market-forwarding']
market-decentralized = ['ya-market-decentralized', 'gftp/bin']
dummy-driver = ['ya-dummy-driver']
gnt-driver = ['ya-gnt-driver']
tos-accepted = []
tos = []

[[bin]]
name = "yagna"
Expand Down
10 changes: 7 additions & 3 deletions core/serv/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ struct CliArgs {

/// Accept the disclaimer and privacy warning found at
/// {n}https://handbook.golem.network/see-also/terms
#[cfg_attr(not(feature = "tos-accepted"), structopt(long, set = clap::ArgSettings::Global))]
#[cfg_attr(feature = "tos-accepted", structopt(skip = true))]
#[structopt(long)]
#[cfg_attr(not(feature = "tos"), structopt(hidden = true))]
accept_terms: bool,

/// Enter interactive mode
Expand Down Expand Up @@ -128,7 +128,11 @@ impl TryFrom<&CliArgs> for CliCtx {
data_dir,
gsb_url: Some(args.gsb_url.clone()),
json_output: args.json,
accept_terms: args.accept_terms,
accept_terms: if cfg!(feature = "tos") {
args.accept_terms
} else {
true
},
interactive: args.interactive,
})
}
Expand Down

0 comments on commit b2c9c2b

Please sign in to comment.