-
Notifications
You must be signed in to change notification settings - Fork 24
120 lines (112 loc) · 3.81 KB
/
ci.yml
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
LLVM_VERSION: "18" # Must be just the major version
ALL_BACKENDS: "llvm,cranelift"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test:
name: test +${{ matrix.runner }}-${{ matrix.arch }}-${{ matrix.toolchain }} ${{ matrix.profile }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
runner: ["ubuntu-latest", "macos-14"]
arch: ["x64", "arm64"]
toolchain: ["stable", "nightly"]
profile: ["dev", "release"]
exclude:
- runner: "ubuntu-latest"
arch: "arm64"
- runner: "macos-14"
arch: "x64"
steps:
- uses: actions/checkout@v4
- name: Install LLVM (apt)
if: ${{ !contains(matrix.runner, 'macos') }}
run: sudo .github/scripts/install_llvm_ubuntu.sh ${{ env.LLVM_VERSION }}
- name: Install LLVM (brew)
if: ${{ contains(matrix.runner, 'macos') }}
run: |
v=${{ env.LLVM_VERSION }}
brew install "llvm@${v}"
echo "LLVM_SYS_${v}0_PREFIX=$(brew --prefix llvm@${v})" >> $GITHUB_ENV
echo "/opt/homebrew/opt/llvm@${v}/bin" >> $GITHUB_PATH
- name: llvm-config
run: llvm-config --version --bindir --libdir
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: test
run: cargo test --workspace --profile ${{ matrix.profile }} --features ${{ env.ALL_BACKENDS }}
feature-checks:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install LLVM
run: sudo .github/scripts/install_llvm_ubuntu.sh ${{ env.LLVM_VERSION }}
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@cargo-hack
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: cargo hack
run: |
cargo hack check --feature-powerset --depth 2 --workspace \
--skip llvm-prefer-static --skip prefer-static
clippy:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install LLVM
run: sudo .github/scripts/install_llvm_ubuntu.sh ${{ env.LLVM_VERSION }}
- uses: dtolnay/rust-toolchain@clippy
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- run: cargo clippy --workspace --all-targets --features ${{ env.ALL_BACKENDS }}
env:
RUSTFLAGS: -Dwarnings
docs:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install LLVM
run: sudo .github/scripts/install_llvm_ubuntu.sh ${{ env.LLVM_VERSION }}
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- run: cargo doc --workspace --features ${{ env.ALL_BACKENDS }} --no-deps --document-private-items
env:
RUSTDOCFLAGS: --cfg docsrs -D warnings --show-type-layout --generate-link-to-definition --enable-index-page -Zunstable-options
- name: Deploy documentation
uses: peaceiris/actions-gh-pages@v3
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: target/doc
force_orphan: true
fmt:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt --all --check