-
Notifications
You must be signed in to change notification settings - Fork 58
123 lines (109 loc) · 4.27 KB
/
rusk_build.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Compile Rusk Binaries
on:
workflow_dispatch:
inputs:
dusk_blockchain_ref:
description: "Git branch, ref, or SHA to checkout"
required: true
default: "master"
runner:
description: "Choose runner target to build against (JSON array)"
required: true
default: "[\"ubuntu-24.04\", \"macos-15\", \"arm-linux\"]"
features:
description: "Choose features to build (JSON array)"
required: true
default: "[\"default\", \"archive\", \"prover\"]"
jobs:
config:
runs-on: ubuntu-latest
name: Show configuration
outputs:
archs: ${{steps.final.outputs.archs}}
steps:
- name: get archs
run: |
echo "# Parameters" | tee -a $GITHUB_STEP_SUMMARY
echo | tee -a $GITHUB_STEP_SUMMARY
echo "features = $FEATURES" | tee -a $GITHUB_STEP_SUMMARY
echo | tee -a $GITHUB_STEP_SUMMARY
echo "runner = $RUNNER" | tee -a $GITHUB_STEP_SUMMARY
env:
FEATURES: ${{github.event.inputs.features}}
RUNNER: ${{github.event.inputs.runner}}
build_and_publish:
name: Build Rusk binaries for ${{ matrix.os }} (${{ matrix.feature }})
runs-on: ${{ matrix.os }}
needs:
- config
continue-on-error: ${{ !contains(fromJson(github.event.inputs.runner), matrix.os) }}
strategy:
matrix:
feature: ${{ fromJson(github.event.inputs.features) }}
compiler: [cargo]
os: [ubuntu-24.04, macos-15, arm-linux]
include:
- os: ubuntu-24.04
target: linux-x64
- os: macos-15
target: macos-arm64
flags: --target=aarch64-apple-darwin
- os: arm-linux
target: linux-arm64
flags: --target=aarch64-unknown-linux-gnu
fail-fast: false
steps:
- name: Skip Non-matching Configurations
if: |
!contains(fromJson(github.event.inputs.runner), matrix.os) ||
!contains(fromJson(github.event.inputs.features), matrix.feature)
run: |
echo "Skipping build for ${{ matrix.os }} - ${{ matrix.feature }}"
exit 1
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.dusk_blockchain_ref }}
- name: Install Rust toolchain
uses: dsherret/rust-toolchain-file@v1
- name: Add ARM target for Apple silicon
run: rustup target add aarch64-apple-darwin
if: ${{ matrix.os == 'macos-15' }}
- name: Check for Prover Features
id: config
run: |
echo "Checking feature requirements..."
if [[ "${{ matrix.feature }}" == *"prover"* ]]; then
echo "NO_DEFAULT_FEATURES=--no-default-features" >> $GITHUB_ENV
echo "SKIP_WASM=true" >> $GITHUB_ENV
else
echo "NO_DEFAULT_FEATURES=" >> $GITHUB_ENV
echo "SKIP_WASM=false" >> $GITHUB_ENV
fi
- name: Compile keys
shell: bash
run: make keys
- name: Compile WASM Contracts
if: ${{ env.SKIP_WASM != 'true' }}
shell: bash
run: make wasm
- name: Build Rusk binary
shell: bash
working-directory: ./rusk
run: cargo build --release ${{ env.NO_DEFAULT_FEATURES }} --features "${{ matrix.feature }}" ${{ matrix.flags }}
- name: Extract Version
run: |
export SEMVER=$(cargo pkgid --manifest-path ./rusk/Cargo.toml | sed -E 's/.*#([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
echo "SEMVER=$SEMVER" >> $GITHUB_ENV
- name: Package Binaries
run: |
mkdir rusk-${{ env.SEMVER }}-${{ matrix.target }}-${{ matrix.feature }}
mv target/release/rusk rusk-${{ env.SEMVER }}-${{ matrix.target }}-${{ matrix.feature }}
tar -czvf rusk-${{ env.SEMVER }}-${{ matrix.target }}-${{ matrix.feature }}.tar.gz \
rusk-${{ env.SEMVER }}-${{ matrix.target }}-${{ matrix.feature }}
- name: Upload Binaries as Artifacts
uses: actions/upload-artifact@v4
with:
name: rusk-${{ env.SEMVER }}-${{ matrix.target }}-${{ matrix.feature }}
path: ./rusk-${{ env.SEMVER }}-${{ matrix.target }}-${{ matrix.feature }}.tar.gz
retention-days: 5