Skip to content

Commit 0079ace

Browse files
authored
Build release binaries faster (#5)
1 parent 2d175f4 commit 0079ace

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed

.github/workflows/release.yml

+21-25
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,19 @@ on:
44
workflow_dispatch:
55

66
jobs:
7-
build_native:
8-
runs-on: ${{ matrix.os }}
7+
build_macos:
8+
if: github.repository_owner == 'viamrobotics'
9+
runs-on: [self-hosted, ARM64, macOS]
910
strategy:
1011
fail-fast: false
1112
matrix:
1213
include:
13-
- os: macos-latest
14-
arch: arm64
15-
target: aarch64-apple-darwin
14+
- target: aarch64-apple-darwin
1615
platform: macosx_arm64
17-
- os: macos-latest
18-
arch: x86_64
19-
target: x86_64-apple-darwin
16+
- target: x86_64-apple-darwin
2017
platform: macosx_x86_64
2118
steps:
22-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v3
2320
- name: Setup rust toolchain
2421
uses: actions-rs/toolchain@v1
2522
with:
@@ -40,43 +37,42 @@ jobs:
4037
name: builds
4138
path: builds
4239

43-
build_in_container:
44-
runs-on: ${{ matrix.arch }}
40+
build_linux:
41+
if: github.repository_owner == 'viamrobotics'
42+
runs-on: [self-hosted, x64]
4543
container:
46-
image: ${{ matrix.image }}
47-
options: ${{ matrix.opts }}
44+
image: ghcr.io/viamrobotics/canon:amd64-cache
45+
options: -v /var/run/docker.sock:/var/run/docker.sock -v ${{ github.workspace }}:/project -w /project
4846
strategy:
4947
fail-fast: false
5048
matrix:
5149
include:
52-
- arch: [arm64, qemu-host]
53-
target: aarch64-unknown-linux-gnu
50+
- target: aarch64-unknown-linux-gnu
5451
platform: linux_aarch64
55-
ext: so
56-
image: 'ghcr.io/viamrobotics/canon:arm64-cache'
57-
opts: '--platform linux/arm64'
58-
- arch: [x64, qemu-host]
59-
target: x86_64-unknown-linux-gnu
52+
cross: true
53+
- target: x86_64-unknown-linux-gnu
6054
platform: linux_x86_64
61-
ext: so
62-
image: 'ghcr.io/viamrobotics/canon:amd64-cache'
63-
opts: '--platform linux/amd64'
55+
cross: false
6456
steps:
65-
- uses: actions/checkout@v2
57+
- uses: actions/checkout@v3
6658
- name: Setup rust toolchain
6759
uses: actions-rs/toolchain@v1
6860
with:
6961
toolchain: stable
7062
target: ${{ matrix.target }}
63+
override: true
7164
- name: Setup build directory
7265
run: mkdir builds
7366
- name: Build
7467
uses: actions-rs/cargo@v1
7568
with:
7669
command: build
7770
args: --release --target=${{ matrix.target }}
71+
use-cross: ${{ matrix.cross }}
72+
env:
73+
CROSS_CONTAINER_IN_CONTAINER: ${{ matrix.cross }}
7874
- name: Copy
79-
run: cp target/${{ matrix.target }}/release/libviam_rust_utils.${{ matrix.ext }} builds/libviam_rust_utils-${{ matrix.platform }}.${{ matrix.ext }}
75+
run: cp target/${{ matrix.target }}/release/libviam_rust_utils.so builds/libviam_rust_utils-${{ matrix.platform }}.so
8076
- name: Upload artifacts
8177
uses: actions/upload-artifact@v3
8278
with:

0 commit comments

Comments
 (0)