Skip to content

Commit a06bcfa

Browse files
added cross-compilation for arm
1 parent a0b20e8 commit a06bcfa

File tree

2 files changed

+41
-6
lines changed

2 files changed

+41
-6
lines changed

.github/workflows/upload_artifacts_workflow.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- main
7-
7+
- idanh/cross_compile_for_arm
88
jobs:
99
artifacts-push:
1010
runs-on: ubuntu-24.04
@@ -17,23 +17,43 @@ jobs:
1717
run: |
1818
echo "SHORT_HASH=${COMMIT_SHA:0:7}" >> $GITHUB_ENV
1919
20-
- run: cargo build -r
20+
- name: Install cross
21+
run: cargo install cross
22+
23+
- name: Build all binaries (native and ARM)
24+
run: |
25+
cargo build --release
26+
RUSTFLAGS="-C target-cpu=neoverse-v2 -C opt-level=3 -C codegen-units=1 -C target-feature=+sve" cross build --release --target=aarch64-unknown-linux-gnu
2127
2228
- name: Authenticate with GCS
2329
uses: "google-github-actions/auth@v2"
2430
with:
2531
credentials_json: ${{ secrets.SA_GPS_ARTIFACTS_BUCKET_WRITER_ACCESS_KEY }}
2632

27-
- name: Upload cairo_program_runner binary to GCP
28-
id: upload_cairo_program_runner
33+
- name: Upload cairo_program_runner x86_64 binary to GCP
34+
id: upload_cairo_program_runner_x86
2935
uses: "google-github-actions/upload-cloud-storage@v2"
3036
with:
3137
path: "target/release/cairo_program_runner"
3238
destination: "cairo_program_runner_artifacts/${{ env.SHORT_HASH }}/release"
3339

34-
- name: Upload stwo_vm_runner binary to GCP
35-
id: upload_stwo_vm_runner
40+
- name: Upload stwo_vm_runner x86_64 binary to GCP
41+
id: upload_stwo_vm_runner_x86
3642
uses: "google-github-actions/upload-cloud-storage@v2"
3743
with:
3844
path: "target/release/stwo_vm_runner"
3945
destination: "stwo_vm_runner_artifacts/${{ env.SHORT_HASH }}/release"
46+
47+
- name: Upload cairo_program_runner ARM binary to GCP
48+
id: upload_cairo_program_runner_arm
49+
uses: "google-github-actions/upload-cloud-storage@v2"
50+
with:
51+
path: "target/aarch64-unknown-linux-gnu/release/cairo_program_runner"
52+
destination: "cairo_program_runner_artifacts/${{ env.SHORT_HASH }}/aarch64-release"
53+
54+
- name: Upload stwo_vm_runner ARM binary to GCP
55+
id: upload_stwo_vm_runner_arm
56+
uses: "google-github-actions/upload-cloud-storage@v2"
57+
with:
58+
path: "target/aarch64-unknown-linux-gnu/release/stwo_vm_runner"
59+
destination: "stwo_vm_runner_artifacts/${{ env.SHORT_HASH }}/aarch64-release"

Cross.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Cross compilation configuration for cross-rs
2+
# See: https://github.com/cross-rs/cross
3+
4+
# Note: Cross is used for cross compilation of rust projects to diffrent architechtures.
5+
# This file doesn't currently have any special configurations.
6+
# To cross compile for arm do: cargo install cross &&
7+
# cross build --release --target aarch64-unknown-linux-gnu
8+
9+
10+
[target.aarch64-unknown-linux-gnu]
11+
# Uncomment and set if you need to pass environment variables to the build
12+
# env = { "FOO" = "bar" }
13+
# Uncomment to use QEMU for running built binaries
14+
# runner = "qemu-aarch64"
15+
# You can add more options here if you need to link to system libraries or mount volumes

0 commit comments

Comments
 (0)