Skip to content

Commit

Permalink
Adjust CI to use cross-build script
Browse files Browse the repository at this point in the history
  • Loading branch information
joaofl committed Aug 16, 2024
1 parent 4c235e6 commit c47ca06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,8 @@ jobs:
- name: Install extra packages
run: |
sudo apt-get update && sudo apt-get install -y libatk1.0-dev libcairo2-dev libpango1.0-dev libgdk-pixbuf2.0-dev libgtk-3-dev python3-pip tftp
cargo install cargo-zigbuild
sudo pip3 install ziglang
cargo install cross --git https://github.com/cross-rs/cross
- name: Build for Linux x86_64 Headless
- name: Build all targets
continue-on-error: false
run: cargo zigbuild --release --no-default-features

- name: Build for Linux x86_64
continue-on-error: false
run: cargo zigbuild --release
run: ./cross-build-all.sh
15 changes: 7 additions & 8 deletions cross-build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ armv7-unknown-linux-gnueabihf \
arm-unknown-linux-gnueabihf \
)

# cargo install cargo-zigbuild
pip3 install ziglang
rm -rf assets
mkdir assets 2>/dev/null || true
rm -rf target/assets
mkdir -p target/assets 2>/dev/null || true

# Cross-compile for each target platform
for target in "${TARGETS[@]}"; do
Expand All @@ -25,16 +23,17 @@ for target in "${TARGETS[@]}"; do

# rustup target add $target

echo; echo "########################################################################################"; echo
echo "Cross-compiling gui version for $target..."
# cargo zigbuild --release --target "$target" --jobs $(nproc) --bin quick-serve
cross build --release --target "$target" --jobs $(nproc) --bin quick-serve
cp -vf target/${target}/release/quick-serve${ext} assets/quick-serve-gui-${target}${ext} || true
cp -vf target/${target}/release/quick-serve${ext} target/assets/quick-serve-gui-${target}${ext} || true

echo; echo "########################################################################################"; echo
echo "Cross-compiling the headless version for $target..."
# cargo zigbuild --release --target "$target" --no-default-features --jobs $(nproc)
cross build --release --target "$target" --no-default-features --jobs $(nproc) --bin quick-serve
cp -vf target/${target}/release/quick-serve${ext} assets/quick-serve-${target}${ext} || true
cp -vf target/${target}/release/quick-serve${ext} target/assets/quick-serve-${target}${ext} || true
done

# echo "Cleaning up..."
# cargo clean
exit 0

0 comments on commit c47ca06

Please sign in to comment.