-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (72 loc) · 2.92 KB
/
Copy pathci.yml
File metadata and controls
84 lines (72 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# A superseded run proves nothing about the tip, and the Linux leg holds a runner
# for ~30 minutes. Newest commit per ref wins.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 75
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
# The LLVM backend's differential suite emits .ll, compiles it, runs it, and
# diffs the output against the interpreter oracle. It SKIPS ITSELF when clang
# is absent, so without this the headline suite passes without testing
# anything. macOS runners ship clang already.
# lld: the differential links ~1,280 tiny binaries per run, and linking is
# ~60% of a case (measured: compile+link 0.08 s, compile alone 0.02 s, link
# alone 0.05 s). Linux's default GNU ld is the slow one.
- name: Install clang + lld (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y clang lld
- name: Report toolchain
run: |
rustc --version
cargo --version
clang --version | head -1
echo "cores: $(getconf _NPROCESSORS_ONLN)"
command -v ld.lld && ld.lld --version || echo "lld: not installed (platform default linker)"
- name: Formatting
run: cargo fmt --all --check
# MAPAL_REQUIRE_CLANG turns the LLVM differential's skip-with-reason into a hard
# failure (`crates/backends/llvm/tests/differential.rs::clang`), so this single
# run proves it compiled rather than skipped. It replaces a second full run of
# the same 1,280-case suite: that cost ~25 min on the two-core Linux runner and
# hit the 60-minute job timeout the first time a run got far enough to reach it.
- name: Test (release)
run: cargo test --workspace --release
env:
MAPAL_REQUIRE_CLANG: 1
# Empty on macOS ⇒ platform default (ld64, already fast).
MAPAL_LD: ${{ runner.os == 'Linux' && 'lld' || '' }}
# The CUDA backend's 161 tests skip themselves without nvcc, which every hosted
# runner lacks. Compiling them is still worth gating on: it catches the
# emitter-wiring breaks that a skipped test never would.
cuda-builds:
name: cuda backend compiles
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo build --release -p mapal-backend-cuda
- run: cargo test --release -p mapal-backend-cuda --no-run