-
Notifications
You must be signed in to change notification settings - Fork 184
99 lines (84 loc) · 2.51 KB
/
build-binaries.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
name: Build Binaries
on:
push:
tags:
- 'v*'
workflow_dispatch:
pull_request:
branches:
- main
paths:
- .github/workflows/build-binaries.yml
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: amd64
- os: macos-13
arch: amd64
- os: ubuntu-arm64-4-core
arch: arm64
- os: macos-latest
arch: arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: |
vm/rust
core/rust
starknet/compiler/rust
- name: Get latest tag
run: echo "TAG=$(git describe --tags)" >> $GITHUB_ENV
- name: Get artifact name
run: |
OS_NAME=$([ "${{ runner.os }}" == "macOS" ] && echo "darwin" || echo "linux")
echo "ARTIFACT_NAME=juno-${{ env.TAG }}-${OS_NAME}-${{ matrix.arch }}" >> $GITHUB_ENV
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update -qq
sudo apt-get install -y upx-ucl build-essential libjemalloc-dev libjemalloc2 libbz2-dev
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install jemalloc
- name: Build binary
run: make juno
- name: Compress binary (Linux)
if: runner.os == 'Linux'
run: |
upx build/juno
mv build/juno ${{ env.ARTIFACT_NAME }}
- name: Prepare binary (macOS)
if: runner.os == 'macOS'
run: mv build/juno ${{ env.ARTIFACT_NAME }}
- name: Generate checksum
run: |
if [[ "${{ runner.os }}" == "macOS" ]]; then
shasum -a 256 ${{ env.ARTIFACT_NAME }} > ${{ env.ARTIFACT_NAME }}.sha256
else
sha256sum ${{ env.ARTIFACT_NAME }} > ${{ env.ARTIFACT_NAME }}.sha256
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: |
${{ env.ARTIFACT_NAME }}
${{ env.ARTIFACT_NAME }}.sha256
retention-days: 5