Skip to content

Commit ca46b41

Browse files
parallelized builds for amd and arm, turned rust and cross install into
a composite action
1 parent a4ba005 commit ca46b41

File tree

2 files changed

+56
-24
lines changed

2 files changed

+56
-24
lines changed

.github/workflows/containerize-and-push.yaml

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,32 @@ env:
2525
IMAGE_NAME: ${{ github.repository }}/zenoh-mqtt-streamer
2626

2727
jobs:
28-
build-binary:
28+
setup:
29+
runs-on: ubuntu-latest
30+
outputs:
31+
tags: ${{ steps.meta.outputs.tags }}
32+
labels: ${{ steps.meta.outputs.labels }}
33+
steps:
34+
- name: Extract metadata and create tag
35+
id: meta
36+
uses: docker/metadata-action@v5
37+
with:
38+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
39+
tags: |
40+
type=ref,event=branch
41+
type=ref,event=tag
42+
type=ref,event=pr
43+
44+
build-arm64:
45+
needs: setup
2946
runs-on: ubuntu-latest
3047
permissions:
3148
contents: read
3249
packages: write
33-
3450
steps:
3551
- name: Checkout repository
3652
uses: actions/checkout@v4
37-
- name: Set up QEMU
38-
uses: docker/setup-qemu-action@v3
53+
3954
- name: Set up Docker buildx
4055
uses: docker/setup-buildx-action@v3
4156

@@ -46,26 +61,8 @@ jobs:
4661
username: ${{ github.actor }}
4762
password: ${{ secrets.GITHUB_TOKEN }}
4863

49-
- name: Extract metadata and create tag
50-
id: meta
51-
uses: docker/metadata-action@v5
52-
with:
53-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
54-
tags: |
55-
type=ref,event=branch
56-
type=ref,event=tag
57-
type=ref,event=pr
58-
59-
- name: Install Rust
60-
uses: actions-rs/toolchain@v1
61-
with:
62-
toolchain: stable
63-
profile: minimal
64-
override: true
65-
66-
- name: Install Cross
67-
run: |
68-
cargo install cross --git https://github.com/cross-rs/cross
64+
- name: Install Rust and Cross
65+
uses: ./.github/actions/setup-rust-cross
6966

7067
- name: Cross Build for arm64
7168
working-directory: example-streamer-implementations
@@ -82,6 +79,26 @@ jobs:
8279
tags: ${{ steps.meta.outputs.tags }}
8380
labels: ${{ steps.meta.outputs.labels }}
8481

82+
build-amd64:
83+
needs: setup
84+
runs-on: ubuntu-latest
85+
steps:
86+
- name: Checkout repository
87+
uses: actions/checkout@v4
88+
89+
- name: Set up Docker buildx
90+
uses: docker/setup-buildx-action@v3
91+
92+
- name: Login to the Container registry
93+
uses: docker/login-action@v3
94+
with:
95+
registry: ${{ env.REGISTRY }}
96+
username: ${{ github.actor }}
97+
password: ${{ secrets.GITHUB_TOKEN }}
98+
99+
- name: Install Rust and Cross
100+
uses: ./.github/actions/setup-rust-cross
101+
85102
- name: Cross Build for amd64
86103
working-directory: example-streamer-implementations
87104
run: |
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "Setup Rust and Cross"
2+
description: "Installs Rust and the Cross crate"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Install Rust
7+
uses: actions-rs/toolchain@v1
8+
with:
9+
toolchain: stable
10+
profile: minimal
11+
override: true
12+
13+
- name: Install Cross
14+
shell: bash
15+
run: cargo install cross --git https://github.com/cross-rs/cross

0 commit comments

Comments
 (0)