hex/.github/workflows/compile.yml

117 lines
4.1 KiB
YAML

name: Compile
# What a pull request runs, besides hex-agent-policy: a fast compile of the app
# on Linux, macOS, and Windows x64 (cargo clippy, warnings as errors). Pull
# requests merge without waiting for it, and a breakage on dev goes to the CI
# failure pipeline. The full suites (check-linux.yml, check-macos.yml,
# check-windows.yml) run in Release's check and stable channels, and by hand.
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "Cargo.toml"
- "Cargo.lock"
- "build.rs"
- "crates/**"
- "src/**"
- "native/**"
- "resources/**"
- "assets/**"
- ".github/workflows/compile.yml"
workflow_dispatch:
permissions:
contents: read
# A new push to a pull request cancels its stale run.
concurrency:
group: compile-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
linux:
name: Linux
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-24.04
timeout-minutes: 45
env:
CARGO_PROFILE_DEV_DEBUG: "0"
BLA_VENDOR: OpenBLAS
OPENSSL_NO_VENDOR: "1"
CC: clang
CXX: clang++
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
with:
toolchain: stable
components: rustfmt, clippy
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2
with:
cache-on-failure: true
- name: Install native libraries
run: |
sudo apt-get update
sudo apt-get install -y clang cmake pkg-config python3 libasound2-dev \
libssl-dev libgtk-3-dev libxkbcommon-x11-dev libx11-xcb-dev \
libfontconfig1-dev libfreetype-dev libxcursor-dev libxi-dev \
libxrandr-dev libopenblas-dev libvulkan-dev glslc libshaderc-dev
- run: cargo fmt --all --check
- run: cargo clippy --locked --bin hex -- -D warnings
macos:
name: macOS
if: ${{ !github.event.pull_request.draft }}
runs-on: macos-26
timeout-minutes: 45
env:
CARGO_PROFILE_DEV_DEBUG: "0"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
with:
toolchain: stable
components: clippy
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2
with:
cache-on-failure: true
- name: Install the Metal toolchain
run: xcrun --sdk macosx metal --version || xcodebuild -downloadComponent MetalToolchain
- run: cargo clippy --locked --bin hex -- -D warnings
windows:
name: Windows x64
if: ${{ !github.event.pull_request.draft }}
runs-on: windows-latest
timeout-minutes: 60
env:
TRANSCRIBE_CMAKE_ARGS: -DGGML_NATIVE=OFF
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable
with:
toolchain: stable
components: clippy
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2
with:
cache-on-failure: true
- name: Install the Vulkan SDK
uses: humbletim/install-vulkan-sdk@30ba978f977e81b72d091fc8888feb1fb26f9aff # v1.2
with:
version: 1.4.309.0
cache: true
- name: Install SPIRV-Headers for the Vulkan backend
shell: pwsh
run: |
vcpkg install spirv-headers:x64-windows
if ($LASTEXITCODE -ne 0) { throw "vcpkg install spirv-headers failed" }
$prefix = "$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows" -replace '\\','/'
$combined = if ($env:CMAKE_PREFIX_PATH) { "$prefix;$env:CMAKE_PREFIX_PATH" } else { $prefix }
Add-Content $env:GITHUB_ENV "CMAKE_PREFIX_PATH=$combined"
- run: cargo clippy --locked --bin hex -- -D warnings