Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RSDK-6152] Downgrade build image requirement #88

Merged
merged 17 commits into from
Jan 10, 2024
77 changes: 30 additions & 47 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ on:
jobs:
prepare:
if: github.repository_owner == 'viamrobotics'
runs-on: [buildjet-8vcpu-ubuntu-2204-arm]
container:
image: ghcr.io/viamrobotics/canon:arm64
runs-on: buildjet-2vcpu-ubuntu-2204-arm
outputs:
version: ${{ steps.which_version.outputs.version }}
sha: ${{ steps.commit.outputs.commit_long_sha }}
Expand Down Expand Up @@ -118,24 +116,45 @@ jobs:
name: builds
path: builds

# build_linux builds all but aarch64.
build_linux:
if: github.repository_owner == 'viamrobotics'
needs: [prepare]
runs-on: [self-hosted, x64]
runs-on: ${{ matrix.runs-on }}
container:
image: ghcr.io/cross-rs/${{ matrix.image }}
image: ${{ matrix.image }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-unknown-linux-gnu
platform: linux_aarch64
image: ubuntu:20.04
runs-on: buildjet-8vcpu-ubuntu-2204-arm
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice; smart to put the runs-on in the matrix variables! 🧑‍🔧 .

- target: x86_64-unknown-linux-gnu
platform: linux_x86_64
image: x86_64-unknown-linux-gnu:main-centos
image: ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main-centos
runs-on: buildjet-4vcpu-ubuntu-2204
- target: arm-unknown-linux-gnueabihf
platform: linux_armv6l
image: arm-unknown-linux-gnueabihf:main
image: ghcr.io/cross-rs/arm-unknown-linux-gnueabihf:main
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- name: Setup dependencies
if: ${{ startsWith(matrix.image, 'ubuntu') }}
shell: bash
run: | # (njooma) These are the deps that cross uses. I haven't tried pruning/optimizing
apt-get update && apt-get upgrade -y
apt-get install -y autoconf \
automake \
binutils \
ca-certificates \
curl \
file \
gcc \
git \
libtool \
m4 \
make
- name: Checkout Code
uses: actions/checkout@v3
with:
Expand All @@ -152,7 +171,7 @@ jobs:
shell: bash
run: |
source "$HOME/.cargo/env"
cargo build --release --target=${{ matrix.target }}
cargo build --release --locked --target=${{ matrix.target }}
- name: Copy
run: |
cp target/${{ matrix.target }}/release/libviam_rust_utils.so builds/libviam_rust_utils-${{ matrix.platform }}.so
Expand All @@ -163,46 +182,10 @@ jobs:
name: builds
path: builds

build_aarch64_linux:
if: github.repository_owner == 'viamrobotics'
needs: [prepare]
runs-on: [buildjet-8vcpu-ubuntu-2204-arm]
strategy:
fail-fast: false
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
ref: ${{ needs.prepare.outputs.sha }}
# Variables for rust toolchain setup copied from the micro-rdk release
# process.
- name: Setup rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.70.0
override: true
target: aarch64-unknown-linux-gnu
default: true
- name: Setup build directory
run: mkdir builds
- name: Build
run: |
cargo build --release --locked --target aarch64-unknown-linux-gnu
cp target/aarch64-unknown-linux-gnu/release/libviam_rust_utils.so builds/libviam_rust_utils-linux_aarch64.so
cp target/aarch64-unknown-linux-gnu/release/libviam_rust_utils.a builds/libviam_rust_utils-linux_aarch64.a
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: builds
path: builds

release:
needs: [prepare, build_macos, build_linux, build_aarch64_linux]
needs: [prepare, build_macos, build_linux]
if: github.repository_owner == 'viamrobotics'
runs-on: [self-hosted, x64]
container:
image: ghcr.io/viamrobotics/canon:amd64
runs-on: buildjet-2vcpu-ubuntu-2204

steps:
- uses: actions/download-artifact@v3
Expand Down
Loading