Linux Build #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linux Build | |
on: | |
push: | |
# Do not run on tag pushes | |
branches: '**' | |
# Only run when; | |
paths: | |
# any Rust code has changed, | |
- "**.rs" | |
# this workflow has changed, | |
- ".github/workflows/build.yml" | |
# dependencies have changed, | |
- "Cargo.lock" | |
# or a rebuild is manually called. | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create `out/` | |
run: mkdir out | |
# Install Rust for Linux | |
- name: Install Rust for Linux | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: x86_64-unknown-linux-musl, aarch64-unknown-linux-musl | |
- name: Install Linux dependencies | |
run: | | |
sudo apt update | |
sudo apt install gcc-mingw-w64-x86-64 musl musl-tools gcc-aarch64-linux-gnu libwayland-dev | |
curl https://apt.llvm.org/llvm.sh | sudo bash -s 17 | |
- name: Install Rust cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Lint code | |
run: cargo clippy | |
- name: Run tests | |
run: cargo test --no-default-features | |
- name: Build Linux | |
run: | | |
cargo build --target=x86_64-unknown-linux-musl --release | |
zip -r out/ferium-linux.zip -j target/x86_64-unknown-linux-musl/release/ferium | |
- name: Upload Linux build artefact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ferium-linux | |
path: out/ferium-linux.zip | |
if-no-files-found: error | |
- name: Build ARM Linux | |
run: | | |
cargo rustc --target=aarch64-unknown-linux-musl --release -- -Clink-self-contained=yes -Clinker=rust-lld | |
zip -r out/ferium-linux-arm64.zip -j target/aarch64-unknown-linux-musl/release/ferium | |
env: | |
CC_aarch64_unknown_linux_musl: clang-17 | |
- name: Upload ARM Linux build artefact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ferium-linux-arm64 | |
path: out/ferium-linux-arm64.zip | |
if-no-files-found: error | |
- name: Build Linux nogui | |
run: | | |
cargo build --target=x86_64-unknown-linux-musl --release --no-default-features | |
zip -r out/ferium-linux-nogui.zip -j target/x86_64-unknown-linux-musl/release/ferium | |
- name: Upload Linux nogui build artefact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ferium-linux-nogui | |
path: out/ferium-linux-nogui.zip | |
if-no-files-found: error | |
- name: Build ARM Linux nogui | |
run: | | |
cargo rustc --target=aarch64-unknown-linux-musl --release --no-default-features -- -Clink-self-contained=yes -Clinker=rust-lld | |
zip -r out/ferium-linux-arm64-nogui.zip -j target/aarch64-unknown-linux-musl/release/ferium | |
env: | |
CC_aarch64_unknown_linux_musl: clang-17 | |
- name: Upload ARM Linux nogui build artefact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ferium-linux-arm64-nogui | |
path: out/ferium-linux-arm64-nogui.zip | |
if-no-files-found: error |