Skip to content

Use proper git for libium #207

Use proper git for libium

Use proper git for libium #207

Workflow file for this run

name: 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: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Create `out/`
run: mkdir out
# Install Rust on the various platforms
- name: Install Rust for macOS
if: matrix.os == 'macos-latest'
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin, x86_64-apple-darwin
- name: Install Rust for Windows
if: matrix.os == 'windows-latest'
uses: dtolnay/rust-toolchain@stable
- name: Install Rust for Linux
if: matrix.os == 'ubuntu-latest'
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-gnu, x86_64-unknown-linux-musl, aarch64-unknown-linux-musl
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
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 macOS Intel
if: matrix.os == 'macos-latest'
env:
MACOSX_DEPLOYMENT_TARGET: 10.12 # Sierra
run: |
cargo build --target=x86_64-apple-darwin --release
zip -r out/ferium-macos-x64.zip -j target/x86_64-apple-darwin/release/ferium
- name: Build macOS ARM
if: matrix.os == 'macos-latest'
env:
MACOSX_DEPLOYMENT_TARGET: 11.0 # Big Sur
run: |
cargo build --target=aarch64-apple-darwin --release
zip -r out/ferium-macos-arm.zip -j target/aarch64-apple-darwin/release/ferium
- name: Build Windows MSVC
if: matrix.os == 'windows-latest'
run: |
cargo build --target=x86_64-pc-windows-msvc --release
Compress-Archive -Path "target\x86_64-pc-windows-msvc\release\ferium.exe" -DestinationPath "out\ferium-windows-msvc.zip"
- name: Build Linux
if: matrix.os == 'ubuntu-latest'
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: Build ARM Linux
if: matrix.os == 'ubuntu-latest'
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: Build Linux nogui
if: matrix.os == 'ubuntu-latest'
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: Build ARM Linux nogui
if: matrix.os == 'ubuntu-latest'
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: Build Windows GNU
if: matrix.os == 'ubuntu-latest'
run: |
cargo build --target=x86_64-pc-windows-gnu --release
zip -r out/ferium-windows-gnu.zip -j target/x86_64-pc-windows-gnu/release/ferium.exe
- name: Upload build artefacts
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.os }}
path: out/ferium*.zip
if-no-files-found: error