Skip to content

Commit

Permalink
ci(release): use mold for building
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgomesdev committed Dec 24, 2023
1 parent f1215b4 commit 616af93
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
include:
- build: amd64
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
arch: x86_64
- build: armhf
os: ubuntu-latest
rust: stable
target: armv7-unknown-linux-gnueabihf
arch: arm

env:
CARGO_TERM_COLOR: always
Expand All @@ -36,12 +36,15 @@ jobs:
- name: 🦀 - Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
toolchain: stable
target: ${{ matrix.target }}
override: true

- name: 🌱 - Install dependencies
run: cargo install cross --git https://github.com/cross-rs/cross
env:
MOLD_VERSION: 2.4.0
MOLD_ARCH: ${{ matrix.arch }}

- name: 🔨 - Build
run: >
Expand Down
3 changes: 3 additions & 0 deletions server/Cross.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[build]
dockerfile = "docker/cross-compile/Dockerfile"

[build.env]
passthrough = ["MOLD_VERSION", "MOLD_ARCH"]
5 changes: 5 additions & 0 deletions server/docker/cross-compile/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ ARG CROSS_BASE_IMAGE
FROM $CROSS_BASE_IMAGE

ARG CROSS_DEB_ARCH
ARG MOLD_ARCH
ARG MOLD_VERSION

RUN dpkg --add-architecture $CROSS_DEB_ARCH
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

RUN curl -L --retry 10 --silent --show-error "https://github.com/rui314/mold/releases/download/v$MOLD_VERSION/mold-$MOLD_VERSION-$MOLD_ARCH-linux.tar.gz" | \
sudo tar -C /usr/local --strip-components=1 --no-overwrite-dir -xzf -
4 changes: 3 additions & 1 deletion server/src/ps_move/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ impl PsMoveController {
}
}

#[allow(dead_code)]
fn build_set_led_pwm_request(frequency: u64) -> [u8; 7] {
if !(MIN_LED_PWM_FREQUENCY..=MAX_LED_PWM_FREQUENCY).contains(&frequency) {
panic!("Frequency must be between {MIN_LED_PWM_FREQUENCY} and {MAX_LED_PWM_FREQUENCY}!")
Expand All @@ -305,12 +304,15 @@ fn build_set_led_and_rumble_request(hsv: Hsv, rumble: f32) -> [u8; 8] {

[
MoveRequestType::SetLED as u8,
// Must be zero
0,
rgb[0],
rgb[1],
rgb[2],
// Unknown should be zero
0,
f32_to_u8(rumble),
// Must be zero
0,
]
}
Expand Down

0 comments on commit 616af93

Please sign in to comment.