-
Notifications
You must be signed in to change notification settings - Fork 4
113 lines (100 loc) · 4.03 KB
/
rust.yml
File metadata and controls
113 lines (100 loc) · 4.03 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
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
name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
# Make sure CI fails on all warnings, including Clippy lints
RUSTFLAGS: "-Dwarnings"
jobs:
test:
name: cargo test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo test --features default
# Check formatting with rustfmt
formatting:
name: cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Ensure rustfmt is installed and setup problem matcher
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Rustfmt Check
uses: actions-rust-lang/rustfmt@v1
# Check warnings from clippy
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Clippy
run: cargo clippy --all-targets --features default
build:
name: Integration Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install FileCheck
run: sudo add-apt-repository universe && sudo apt-get update && sudo apt-get install llvm-15-tools && sudo ln -s /usr/bin/FileCheck-15 /usr/bin/FileCheck
- name: Build (debug)
run: cargo build --verbose
- name: Build (release)
run: cargo build --release --verbose
- name: Run integration tests
run: chmod +x bin/* && PATH=$PWD/target/release:$PWD/bin:$PATH python3 utils/test-runner.py tests -j 2
speed:
name: Test Speed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Build (release)
run: cargo build --release --verbose
- name: Run integration tests (release, )
run: echo "integration tests (release, )" >> $GITHUB_STEP_SUMMARY; (time cargo run --release --bin opt -- tests/lutlang/hard_examples.txt 2>>/dev/null) 2>> $GITHUB_STEP_SUMMARY
- name: Run integration tests (release, proof gen)
run: echo "integration tests (release, proof gen)" >> $GITHUB_STEP_SUMMARY; (time cargo run --release --bin opt -- tests/lutlang/hard_examples.txt --verbose 2>>/dev/null) 2>> $GITHUB_STEP_SUMMARY
- name: Run comparator (release, proof gen)
run: echo "comparator (release, proof gen)" >> $GITHUB_STEP_SUMMARY; (time cargo run --release --bin opt -- tests/lutlang/gate_compare.txt --verbose 2>>/dev/null) 2>> $GITHUB_STEP_SUMMARY
- name: Run comparator (release,)
run: echo "comparator (release,)" >> $GITHUB_STEP_SUMMARY; (time cargo run --release --bin opt -- tests/lutlang/gate_compare.txt 2>>/dev/null) 2>> $GITHUB_STEP_SUMMARY
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo llvm-cov --features default --workspace --json > coverage.json
- name: Coverage (60% by line)
run: python3 utils/min-coverage.py -p 60.0 coverage.json --whitelist fam.rs opt.rs parse-verilog.rs emit-verilog.rs check.rs logic.rs driver.rs cost.rs >> $GITHUB_STEP_SUMMARY
- name: Coverage (80% by line)
run: python3 utils/min-coverage.py -p 80.0 coverage.json --whitelist fam.rs opt.rs parse-verilog.rs emit-verilog.rs check.rs logic.rs driver.rs cost.rs >> $GITHUB_STEP_SUMMARY
mdformat:
name: Markdown format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Markdown check format
uses: ydah/mdformat-action@main
with:
number: true
pyformat:
name: Python format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Format python code
uses: psf/black@stable
with:
options: "--check --verbose"
src: "./utils"