-
Notifications
You must be signed in to change notification settings - Fork 51
52 lines (51 loc) · 1.58 KB
/
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
name: Task - Build Madara
on:
workflow_dispatch:
workflow_call:
jobs:
build:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.81
- name: Setup build deps
run: |
sudo apt-get update
sudo apt-get install -y clang llvm libudev-dev protobuf-compiler
- uses: rui314/setup-mold@v1
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.8.2"
- uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Build
# also build test contracts for js-tests.
run: |
export GIT_COMMIT_HASH=$GITHUB_SHA
cargo build --release --bin madara
cargo build --release -p m-cairo-test-contracts
- name: Generate binary hash
id: binary_hash
run: |
BINARY_PATH=./target/release/madara
HASH=$(sha256sum $BINARY_PATH | awk '{ print $1 }')
echo "hash=$HASH" >> $GITHUB_OUTPUT
echo "Hash of the binary is: $HASH"
- name: Cache Madara binary
uses: actions/cache@v3
with:
path: target/release/madara
key: ${{ runner.os }}-madara-bin-${{ steps.binary_hash.outputs.hash }}
- name: Cache Cairo build artifacts
uses: actions/cache@v3
with:
path: cairo/target
key: ${{ runner.os }}-madara-${{ hashFiles('Scarb.lock') }}