Skip to content

Commit 7a316ea

Browse files
authored
[agent] Cross compile bazelci-agent to linux aarch64 (#1528)
Update Github Action to cross compile `bazelci-agent` to `aarch64` linux on `x86_64` linux. Example Github Action run: https://github.com/coeuvre/continuous-integration/actions/runs/3931810914/jobs/6723557885 Example release: https://github.com/coeuvre/continuous-integration/releases/tag/agent-0.1.5 Example BazelCI run: https://buildkite.com/bazel-testing/bazel-bazel/builds/8491 Working towards fixing #1513.
1 parent e697733 commit 7a316ea

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

.github/workflows/release-agent.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,34 @@ jobs:
5959
RUST_BACKTRACE: 1
6060
strategy:
6161
matrix:
62-
build: [linux, macos-intel, macos-m1, win-msvc]
62+
build: [linux, linux-aarch64, macos-intel, macos-m1, win-msvc]
6363
include:
6464
- build: linux
65-
os: ubuntu-18.04
65+
os: ubuntu-latest
6666
rust: nightly
6767
target: x86_64-unknown-linux-musl
68+
- build: linux-aarch64
69+
os: ubuntu-latest
70+
rust: nightly
71+
target: aarch64-unknown-linux-musl # cross compile to aarch64 on x86_64
6872
- build: macos-intel
6973
os: macos-latest
7074
rust: nightly
7175
target: x86_64-apple-darwin
7276
- build: macos-m1
7377
os: macos-latest
7478
rust: nightly
75-
target: aarch64-apple-darwin # cross compile to M1 on Intel CPU
79+
target: aarch64-apple-darwin # cross compile to aarch64 on x86_64
7680
- build: win-msvc
7781
os: windows-latest
7882
rust: nightly
7983
target: x86_64-pc-windows-msvc
8084

8185
steps:
86+
- name: Install deps (linux-aarch64)
87+
if: matrix.build == 'linux-aarch64'
88+
run: sudo apt-get install g++-aarch64-linux-gnu
89+
8290
- name: Checkout repository
8391
uses: actions/checkout@v2
8492
with:
@@ -93,7 +101,7 @@ jobs:
93101
target: ${{ matrix.target }}
94102

95103
- name: Test release binary
96-
if: matrix.build != 'macos-m1' # Can't run M1 binary on Intel CPU
104+
if: matrix.build != 'macos-m1' && matrix.build != 'linux-aarch64' # Can't run aarch64 binary on x86_64
97105
working-directory: agent
98106
run: cargo test --verbose --release --target ${{ matrix.target }}
99107

@@ -106,6 +114,11 @@ jobs:
106114
working-directory: agent
107115
run: strip "target/${{ matrix.target }}/release/bazelci-agent"
108116

117+
- name: Strip release binary (linux-aarch64)
118+
if: matrix.build == 'linux-aarch64'
119+
working-directory: agent
120+
run: aarch64-linux-gnu-strip "target/${{ matrix.target }}/release/bazelci-agent"
121+
109122
- name: Build release asset
110123
shell: bash
111124
run: |

agent/.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[target.aarch64-unknown-linux-musl]
2+
linker = "aarch64-linux-gnu-gcc"

0 commit comments

Comments
 (0)