forked from sampsyo/bril
-
Notifications
You must be signed in to change notification settings - Fork 1
122 lines (106 loc) · 3.5 KB
/
rust.yaml
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
121
122
on:
push:
branches:
- main
paths:
- '.github/workflows/rust.yaml'
- 'brilirs/**/*.rs'
- 'brilirs/**/*.toml'
- 'brilift/**/*.rs'
- 'brilift/**/*.toml'
- 'bril-rs/**/*.rs'
- 'bril-rs/**/*.toml'
- 'bril-rs/**/*.lalrpop'
pull_request:
branches:
- main
paths:
- '.github/workflows/rust.yaml'
- 'brilirs/**/*.rs'
- 'brilirs/**/*.toml'
- 'brilift/**/*.rs'
- 'brilift/**/*.toml'
- 'bril-rs/**/*.rs'
- 'bril-rs/**/*.toml'
- 'bril-rs/**/*.lalrpop'
name: Workflow checks for rust code
env:
LLVM_VERSION: 18.0
jobs:
test:
runs-on: macos-latest
strategy:
matrix:
test-code:
- "cd bril-rs && make test TURNTARGS=-v"
- "cd brilirs && make test TURNTARGS=-v"
- "cd brilirs && make benchmark TURNTARGS=-v"
- "cd brilift && cargo build --release && make rt.o && make test TURNTARGS=-v"
- "cd brilift && cargo build --release && make rt.o && make benchmark TURNTARGS=-v"
# Code requiring additional dependencies are separated out
include:
- test-code: "cd bril-rs && make features"
needs_cargo_hack: true
- test-code: "cd bril-rs/brillvm && make build"
needs_llvm: true
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2.0.2
if: matrix.needs_llvm
with:
version: ${{ env.LLVM_VERSION }}
- name: Install cargo-hack for feature-flag checking
run: cargo install cargo-hack
if: matrix.needs_cargo_hack
- uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: pip
cache-dependency-path: bril-txt/pyproject.toml
- name: Install Flit
run: pip install flit
- name: Install Python tools
run: cd bril-txt ; flit install --symlink
- name: Install Turnt
# run: pip install turnt # Use instead if pip turnt version >= 1.7
uses: actions/checkout@v4
with:
repository: cucapra/turnt
path: './turnt'
- name: Install Turnt part 2
run: flit install --symlink
working-directory: ./turnt
- name: Problem matcher
run: echo '::add-matcher::.github/tap-matcher.json'
- name: Run test
run: ${{ matrix.test-code }}
rust-ci:
runs-on: macos-latest
env:
RUSTDOCFLAGS: -D warnings
RUSTFLAGS: -D warnings
strategy:
matrix:
path: ["brilirs/Cargo.toml", "bril-rs/Cargo.toml", "bril-rs/bril2json/Cargo.toml", "bril-rs/brild/Cargo.toml", "brilift/Cargo.toml", "bril-rs/rs2bril/Cargo.toml", "bril-rs/brillvm/Cargo.toml"]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2.0.2
if: matrix.path == 'bril-rs/brillvm/Cargo.toml'
with:
version: ${{ env.LLVM_VERSION }}
- name: cargo check
run: cargo check --manifest-path ${{ matrix.path }} --all-targets
- name: cargo fmt
run: cargo fmt --manifest-path ${{ matrix.path }} --all -- --check
- name: cargo clippy
run: cargo clippy --manifest-path ${{ matrix.path }} --all-targets
- name: cargo doc
run: cargo doc --manifest-path ${{ matrix.path }} --all