Make debug builds use nightly and parallel frontend compilation #164
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: 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 }} | |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Create `out/` | |
run: mkdir out | |
# Install Rust on the various platforms | |
- name: Install Rust for macOS | |
if: matrix.os == 'macos-latest' | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: aarch64-apple-darwin | |
- name: Install Rust for Windows | |
if: matrix.os == 'windows-latest' | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Install Windows GNU toolchain | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: x86_64-pc-windows-gnu | |
- name: Install Linux musl toolchain | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions-rs/toolchain@v1 | |
with: | |
default: true | |
toolchain: stable | |
target: x86_64-unknown-linux-musl | |
- name: Install Linux musl toolchain for ARM64 | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: aarch64-unknown-linux-musl | |
- name: Install Linux dependencies | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install gcc-mingw-w64-x86-64 musl musl-tools gcc-aarch64-linux-gnu | |
curl https://apt.llvm.org/llvm.sh | sudo bash -s 16 | |
- name: Install Rust cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Lint code | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
- name: Run tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
# Linux CIs don't have GUIs | |
args: --no-default-features | |
- name: Build macOS Intel | |
if: matrix.os == 'macos-latest' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --target=x86_64-apple-darwin --release | |
- name: Build macOS ARM | |
if: matrix.os == 'macos-latest' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --target=aarch64-apple-darwin --release | |
- name: Zip macOS outputs | |
if: matrix.os == 'macos-latest' | |
run: | | |
zip -r out/ferium-macos-x64.zip -j target/x86_64-apple-darwin/release/ferium | |
zip -r out/ferium-macos-arm.zip -j target/aarch64-apple-darwin/release/ferium | |
- name: Build Windows MSVC | |
if: matrix.os == 'windows-latest' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --target=x86_64-pc-windows-msvc --release | |
- name: Zip Windows output | |
if: matrix.os == 'windows-latest' | |
run: 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' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --target=x86_64-unknown-linux-musl --release | |
- name: Build ARM Linux | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: rustc | |
args: --target=aarch64-unknown-linux-musl --release -- -Clink-self-contained=yes -Clinker=rust-lld | |
env: | |
CC_aarch64_unknown_linux_musl: clang-16 | |
- name: Zip Linux outputs | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
zip -r out/ferium-linux.zip -j target/x86_64-unknown-linux-musl/release/ferium | |
zip -r out/ferium-linux-arm64.zip -j target/aarch64-unknown-linux-musl/release/ferium | |
- name: Build Linux nogui | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --target=x86_64-unknown-linux-musl --release --no-default-features | |
- name: Build ARM Linux nogui | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: rustc | |
args: --target=aarch64-unknown-linux-musl --release --no-default-features -- -Clink-self-contained=yes -Clinker=rust-lld | |
env: | |
CC_aarch64_unknown_linux_musl: clang-16 | |
- name: Zip Linux nogui outputs | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
zip -r out/ferium-linux-nogui.zip -j target/x86_64-unknown-linux-musl/release/ferium | |
zip -r out/ferium-linux-arm64-nogui.zip -j target/aarch64-unknown-linux-musl/release/ferium | |
- name: Build Windows GNU | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --target=x86_64-pc-windows-gnu --release | |
- name: Zip Windows GNU output | |
if: matrix.os == 'ubuntu-latest' | |
run: 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@v3 | |
with: | |
name: binaries | |
path: out/ferium*.zip | |
if-no-files-found: error |