mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
154 lines
5.8 KiB
YAML
154 lines
5.8 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.
|
|
# When a Check macOS run was dispatched for the pull request's head commit,
|
|
# the macOS compile is skipped: that suite runs the same clippy and more.
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened, ready_for_review]
|
|
paths:
|
|
- "Cargo.toml"
|
|
- "Cargo.lock"
|
|
- "build.rs"
|
|
- "crates/**"
|
|
- "src/**"
|
|
- "native/**"
|
|
- "resources/**"
|
|
- "assets/**"
|
|
- "nix/**"
|
|
- "scripts/check-nix-git-pins.py"
|
|
- "scripts/test-check-nix-git-pins.py"
|
|
- ".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
|
|
- name: Check Nix Git pins
|
|
run: |
|
|
python3 scripts/test-check-nix-git-pins.py
|
|
python3 scripts/check-nix-git-pins.py
|
|
- 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 runners are scarce (5 at once across the org). A Check macOS
|
|
# dispatch usually comes with the push, so this waits a minute for it.
|
|
macos-covered:
|
|
name: macOS covered by Check macOS
|
|
if: ${{ github.event_name == 'pull_request' && !github.event.pull_request.draft }}
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 5
|
|
permissions:
|
|
actions: read
|
|
outputs:
|
|
covered: ${{ steps.find.outputs.covered }}
|
|
steps:
|
|
- id: find
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
SHA: ${{ github.event.pull_request.head.sha }}
|
|
run: |
|
|
sleep 60
|
|
runs=$(gh api "repos/$GITHUB_REPOSITORY/actions/workflows/check-macos.yml/runs?head_sha=$SHA&event=workflow_dispatch" \
|
|
--jq '[.workflow_runs[] | select(.conclusion != "cancelled")] | length') || runs=0
|
|
if [ "$runs" -gt 0 ]; then covered=true; else covered=false; fi
|
|
echo "covered=$covered" >> "$GITHUB_OUTPUT"
|
|
echo "Check macOS runs for $SHA: $runs" >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
macos:
|
|
name: macOS
|
|
needs: macos-covered
|
|
if: ${{ !cancelled() && !github.event.pull_request.draft && needs.macos-covered.outputs.covered != 'true' }}
|
|
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
|
|
# hex.com, the console entry point beside the GUI hex.exe.
|
|
- run: cargo clippy --locked -p hex-console --all-targets -- -D warnings
|
|
- run: cargo test --locked -p hex-console
|