Skip to content

Commit 8862de1

Browse files
authored
Improve binary build workflow for cross-platform releases (#2315)
- Add proper architecture handling in matrix configuration - Implement caching for Go modules and Rust dependencies - Streamline dependency installation for both Linux and macOS - Improve binary artifact handling and checksums - Add retention policy for build artifacts - Split build steps for better clarity and maintainability This update ensures more reliable and efficient binary builds across all supported platforms.
1 parent e75e504 commit 8862de1

File tree

1 file changed

+41
-16
lines changed

1 file changed

+41
-16
lines changed

.github/workflows/build-binaries.yml

+41-16
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ jobs:
1818
matrix:
1919
include:
2020
- os: ubuntu-latest
21+
arch: amd64
2122
- os: macos-13
23+
arch: amd64
2224
- os: ubuntu-arm64-4-core
25+
arch: arm64
2326
- os: macos-latest
27+
arch: arm64
2428
runs-on: ${{ matrix.os }}
2529

2630
steps:
@@ -29,46 +33,67 @@ jobs:
2933
with:
3034
fetch-depth: 0
3135

36+
- name: Set up Go
37+
uses: actions/setup-go@v5
38+
with:
39+
go-version-file: go.mod
40+
cache: true
41+
42+
- name: Set up Rust
43+
uses: dtolnay/rust-toolchain@stable
44+
45+
- name: Cache Rust dependencies
46+
uses: Swatinem/rust-cache@v2
47+
with:
48+
workspaces: |
49+
vm/rust
50+
core/rust
51+
starknet/compiler/rust
52+
3253
- name: Get latest tag
3354
run: echo "TAG=$(git describe --tags)" >> $GITHUB_ENV
3455

3556
- name: Get artifact name
36-
run: echo "ARTIFACT_NAME=juno-${{ env.TAG }}-${{ runner.os }}-$(uname -m)" >> $GITHUB_ENV
57+
run: |
58+
OS_NAME=$([ "${{ runner.os }}" == "macOS" ] && echo "darwin" || echo "linux")
59+
echo "ARTIFACT_NAME=juno-${{ env.TAG }}-${OS_NAME}-${{ matrix.arch }}" >> $GITHUB_ENV
3760
3861
- name: Install dependencies (Linux)
3962
if: runner.os == 'Linux'
40-
run: sudo apt-get update -qq && sudo apt-get install -y upx-ucl build-essential cargo git golang libjemalloc-dev libjemalloc2 -y
63+
run: |
64+
sudo apt-get update -qq
65+
sudo apt-get install -y upx-ucl libjemalloc-dev libjemalloc2 libbz2-dev
4166
4267
- name: Install dependencies (macOS)
4368
if: runner.os == 'macOS'
44-
run: brew install cargo-c jemalloc
45-
46-
- name: Set up Go
47-
uses: actions/setup-go@v5
48-
with:
49-
go-version-file: go.mod
69+
run: brew install jemalloc
5070

51-
- name: Build Juno
71+
- name: Build binary
72+
run: make juno
73+
74+
- name: Compress binary (Linux)
75+
if: runner.os == 'Linux'
5276
run: |
53-
make juno
54-
if [[ "${{ runner.os }}" != "macOS" ]]; then
55-
upx build/juno
56-
fi
77+
upx build/juno
5778
mv build/juno ${{ env.ARTIFACT_NAME }}
5879
59-
- name: Generate Checksum
60-
id: checksum
80+
- name: Prepare binary (macOS)
81+
if: runner.os == 'macOS'
82+
run: mv build/juno ${{ env.ARTIFACT_NAME }}
83+
84+
- name: Generate checksum
6185
run: |
6286
if [[ "${{ runner.os }}" == "macOS" ]]; then
6387
shasum -a 256 ${{ env.ARTIFACT_NAME }} > ${{ env.ARTIFACT_NAME }}.sha256
6488
else
6589
sha256sum ${{ env.ARTIFACT_NAME }} > ${{ env.ARTIFACT_NAME }}.sha256
6690
fi
6791
68-
- name: Upload Artifact
92+
- name: Upload artifact
6993
uses: actions/upload-artifact@v4
7094
with:
7195
name: ${{ env.ARTIFACT_NAME }}
7296
path: |
7397
${{ env.ARTIFACT_NAME }}
7498
${{ env.ARTIFACT_NAME }}.sha256
99+
retention-days: 30

0 commit comments

Comments
 (0)