-
Notifications
You must be signed in to change notification settings - Fork 61
99 lines (85 loc) · 2.95 KB
/
binaries-x86-64.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Build binaries (x86-64)
on:
workflow_dispatch:
inputs:
profile:
description: 'Profile (unused right now)'
required: true
default: 'debug'
push:
branches:
- master
- release/*
- p2p-stability
- '**/all-tests'
- '**/integration-tests'
pull_request:
branches:
- master
- release/*
- p2p-stability
env:
rust_stable: 1.71.1
jobs:
build:
name: Build binaries (x86-64)
env:
# `-D warnings` means any warnings emitted will cause build to fail
RUSTFLAGS: "-C opt-level=z -C target-cpu=x86-64 -C debuginfo=1"
runs-on: [yagna-builder, ubuntu-22.04]
steps:
- name: Clean runner data
run: sudo rm -rf ${{ github.workspace }}/*
- name: Checkout
uses: actions/checkout@v1
- name: Extract branch name
id: extract_branch
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
- name: Musl
run: |
sudo apt-get -y install musl musl-tools
musl-gcc -v
- name: Install Rust ${{ env.rust_stable }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.rust_stable }}
components: rustfmt, clippy
target: x86_64-unknown-linux-musl
override: true
- name: Set build target for cache
id: setup_cache_target
run: echo "build_target=${CARGO_BUILD_TARGET:-x86_64-unknown-linux-musl}" >> $GITHUB_OUTPUT
- name: Load local cache
continue-on-error: true
run:
# Uncomment line if you want need to clear cache
# rm -rf "/opt/yagna_cache/${{ steps.extract_branch.outputs.branch }}/binaries_x86/target"
cp -rp "/opt/yagna_cache/${{ steps.extract_branch.outputs.branch }}/binaries_x86/target" target
- name: Build binaries
run: |
cargo build --features static-openssl --target x86_64-unknown-linux-musl -p yagna -p ya-exe-unit -p gftp -p golemsp -p ya-provider
- name: Copy binaries
shell: bash
run: |
mkdir build
if [ "$RUNNER_OS" == "Linux" ]; then
cp target/x86_64-unknown-linux-musl/debug/{yagna,ya-provider,exe-unit,golemsp,gftp} build
strip -x build/*
elif [ "$RUNNER_OS" == "macOS" ]; then
cp target/debug/{yagna,gftp} build
strip -x build/*
elif [ "$RUNNER_OS" == "Windows" ]; then
cp target/debug/{yagna,gftp}.exe build
else
echo "$RUNNER_OS not supported"
exit 1
fi
- name: Upload binaries
uses: actions/upload-artifact@v1
with:
name: Yagna ${{ runner.os }}
path: build
- name: Save local cache
run: |
# copy to /opt/yagna_cache and preserve permissions and timestamps
rsync -a --delete --mkpath target/ "/opt/yagna_cache/${{ steps.extract_branch.outputs.branch }}/binaries_x86/target"