Skip to content

Commit 6f7f4ec

Browse files
David Gomesdavidgomesdev
authored andcommitted
ci: add armv7l cross build
1 parent 3889447 commit 6f7f4ec

3 files changed

Lines changed: 59 additions & 29 deletions

File tree

.github/workflows/release.yml

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,58 @@ on:
77
jobs:
88
build-server:
99
runs-on: ubuntu-latest
10-
10+
11+
strategy:
12+
matrix:
13+
build: [amd64, arm-v7]
14+
include:
15+
- build: amd64
16+
os: ubuntu-latest
17+
rust: stable
18+
target: x86_64-unknown-linux-gnu
19+
platform: linux
20+
- build: arm-v7
21+
os: ubuntu-latest
22+
rust: stable
23+
target: armv7-unknown-linux-gnueabihf
24+
platform: pi
25+
1126
env:
1227
CARGO_TERM_COLOR: always
13-
28+
1429
defaults:
1530
run:
1631
shell: bash
1732
working-directory: ./server
1833

1934
steps:
20-
- uses: rui314/setup-mold@v1
21-
2235
- uses: actions/checkout@v3
23-
36+
37+
- name: 🦀 - Install Rust
38+
uses: actions-rs/toolchain@v1
39+
with:
40+
toolchain: ${{ matrix.rust }}
41+
target: ${{ matrix.target }}
42+
override: true
43+
2444
- name: 🌱 - Install dependencies
25-
run: sudo apt-get update; sudo apt-get install -y libudev-dev libsystemd-dev libusb-1.0-0-dev
45+
run: cargo install cross --git https://github.com/cross-rs/cross
2646

2747
- name: 🔨 - Build
28-
run: cargo build --release
29-
48+
run: >
49+
cross build --release --target ${{ matrix.target }} && \
50+
mv target/**/release/rusty_controller server-${{ matrix.build }}
51+
3052
- name: 📦 - Copy artifact
31-
uses: actions/upload-artifact@v3
53+
uses: actions/upload-artifact@v4
3254
with:
33-
name: rusty_controller
34-
path: server/target/release/rusty_controller
55+
name: server-${{ matrix.build }}
56+
path: server/server-${{ matrix.build }}
57+
if-no-files-found: error
3558

3659
build-app:
3760
runs-on: ubuntu-latest
38-
61+
3962
defaults:
4063
run:
4164
shell: bash
@@ -50,38 +73,36 @@ jobs:
5073

5174
- name: 🌱 - Get dependencies
5275
run: flutter pub get
53-
54-
- name: 🔨 - Build Apk
76+
77+
- name: 🔨 - Build APK
5578
run: flutter build apk
56-
57-
- run: mv build/app/outputs/flutter-apk/app-release.apk ../RustyController.apk
79+
80+
- run: mv build/app/outputs/flutter-apk/app-release.apk ../app.apk
5881

5982
- name: 📦 - Copy artifact
60-
uses: actions/upload-artifact@v3
83+
uses: actions/upload-artifact@v4
6184
with:
62-
name: RustyController.apk
63-
path: RustyController.apk
64-
85+
name: app.apk
86+
path: app.apk
6587

6688
upload:
6789
needs: [build-server, build-app]
6890
runs-on: ubuntu-latest
6991

7092
steps:
71-
- name: 📦 - Copy server artifact
72-
uses: actions/download-artifact@v3
73-
with:
74-
name: rusty_controller
75-
76-
- name: 📦 - Copy app artifact
77-
uses: actions/download-artifact@v3
93+
- name: 📦 - Copy server artifacts
94+
uses: actions/download-artifact@v4
7895
with:
79-
name: RustyController.apk
96+
path: .
97+
merge-multiple: true
98+
99+
- name: 🧐 - Display structure of downloaded artifacts
100+
run: ls -R
80101

81102
- name: 🌠 - Release
82103
uses: ncipollo/release-action@v1.12.0
83104
with:
84-
artifacts: "rusty_controller,RustyController.apk"
105+
artifacts: "server-*,app.apk"
85106
token: ${{ secrets.GITHUB_TOKEN }}
86107
allowUpdates: true
87108
removeArtifacts: true

server/Cross.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[build]
2+
dockerfile = "docker/cross-compile/Dockerfile"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ARG CROSS_BASE_IMAGE
2+
FROM $CROSS_BASE_IMAGE
3+
4+
ARG CROSS_DEB_ARCH
5+
6+
RUN dpkg --add-architecture $CROSS_DEB_ARCH
7+
RUN apt-get update && apt-get -y install libudev-dev:$CROSS_DEB_ARCH libsystemd-dev:$CROSS_DEB_ARCH libusb-1.0-0-dev:$CROSS_DEB_ARCH libusb-0.1-4:$CROSS_DEB_ARCH

0 commit comments

Comments
 (0)