-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (77 loc) · 2.34 KB
/
rust-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
name: Rust CI
on:
push:
branches:
- main
pull_request:
branches:
- "*"
jobs:
test:
strategy:
fail-fast: false
matrix:
rust:
- stable
- beta
- nightly
- 1.70.0
os:
- ubuntu-latest
- windows-latest
- macos-latest
clang:
- 14.0
runs-on: ${{ matrix.os }}
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: recursive
# LLVM and Clang installation
# https://github.com/KyleMayes/clang-sys/blob/a0bcae1a9d7ab6ed8de010b0f5e2b2020c20d204/.github/workflows/ci.yml#L23-L35
# The clang and clang-sys crates' CI has example of installing LLVM and Clang
# along with how to update the environment variables (see Build & Test) so
# that bindgen can find libclang and depedencies
- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/llvm-${{ matrix.clang }}
key: ${{ matrix.os }}-llvm-${{ matrix.clang }}
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2
with:
version: ${{ matrix.clang }}
directory: ${{ runner.temp }}/llvm-${{ matrix.clang }}
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
# Rust
- name: Install ${{ matrix.rust }} toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
- name: Build
run: cargo build --all
env:
LIBCLANG_PATH: ${{ runner.temp }}/llvm-${{ matrix.clang }}/lib
LLVM_CONFIG_PATH: ${{ runner.temp }}/llvm-${{ matrix.clang }}/bin/llvm-config
- name: Test
run: cargo test --all
env:
LIBCLANG_PATH: ${{ runner.temp }}/llvm-${{ matrix.clang }}/lib
LLVM_CONFIG_PATH: ${{ runner.temp }}/llvm-${{ matrix.clang }}/bin/llvm-config
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt clippy
- name: Check format
run: cargo fmt --all --check
- name: Lint
run: cargo clippy