Skip to content

Commit

Permalink
chore(ci): cross-compilation of Rust Binary (#3)
Browse files Browse the repository at this point in the history
* chore: tentative of arm cross-compilation

* chore: master -> main

* chore: rustup option

* chore: install gcc for arm linux

* chore: linker erro

* chore: linker cargo flag

* chore: use cross instead of cargo

* chore: release build

* chore: install libpq in cross docker env
  • Loading branch information
thibautRe authored May 27, 2024
1 parent 259d059 commit c8fe6ae
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
pull_request:
branches: [main]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Setup Rust Toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --profile minimal --no-modify-path -y
# the target comes from running `rustup target list` on the Olimex board
rustup target add armv7-unknown-linux-gnueabihf
cargo install cross --git https://github.com/cross-rs/cross
sudo apt-get install -y gcc-arm-linux-gnueabihf
- name: Build
run: cross build --release --target=armv7-unknown-linux-gnueabihf
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/release/eye
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ shrinkwraprs = "0.2"
thiserror = "1.0"
time = "0.2"
walkdir = "2"

[workspace.metadata.cross.target.armv7-unknown-linux-gnueabihf]
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt-get update && apt-get --assume-yes install libpq-dev:$CROSS_DEB_ARCH"
]

0 comments on commit c8fe6ae

Please sign in to comment.