Skip to content

Commit

Permalink
Build Linux bins; Pack binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
nieznanysprawiciel committed Nov 10, 2023
1 parent 5cd5543 commit ccb26a5
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 6 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" == "linux-aarch64" ]; then
OS_NAME=linux_aarch64
target=aarch64-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 non_exe="$3"
local TARGET_DIR=releases/golem-${asset_type}-${OS_NAME}-${TAG_NAME}
mkdir -p "$TARGET_DIR"
for component in $bins $non_exe; 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 "$non_exe"; then
for bin in $non_exe; do
cp "target/${target}release/${bin}" "$TARGET_DIR/"
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}")
du -h "releases/golem-${asset_type}-${OS_NAME}-${TAG_NAME}.tar.gz"
fi
}

generate_asset "runtime" "ya-runtime-ai"
generate_asset "framework" "dummy" "ya-dummy-ai.json"
25 changes: 22 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ env:
jobs:
test:
name: CI

runs-on: windows-latest
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: true
matrix:
os:
- ubuntu
- windows

steps:
- uses: actions/checkout@v4
Expand All @@ -39,10 +44,24 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
run: cargo build --workspace --release

- name: Move descriptor
run: mv conf/ya-dummy-ai.json target/release/conf/ya-dummy-ai.json

- name: Pack
id: pack
shell: bash
env:
OS_NAME: ${{ matrix.os }}
GITHUB_REF: ${{ github.ref }}
run: |
bash .ci/pack-build.sh
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: target/release/*.exe
files: |
releases/golem-runtime-${{ matrix.os }}-${{ github.ref }}.*
releases/golem-framework-${{ matrix.os }}-${{ github.ref }}.*
prerelease: ${{ startsWith(github.ref, 'refs/tags/pre-rel-v') }}
5 changes: 2 additions & 3 deletions conf/ya-runtime-ai.json → conf/ya-dummy-ai.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"version": "0.1.0",
"supervisor-path": "[..]\\ya-runtime-ai\\target\\debug\\ya-runtime-ai.exe",
"extra-args": ["--runtime", "dummy"],
"description": "dummy ai runtime",
"properties": {
}
"description": "Dummy ai runtime for testing purposes",
"properties": {}
}
]

0 comments on commit ccb26a5

Please sign in to comment.