-
Notifications
You must be signed in to change notification settings - Fork 658
199 lines (185 loc) · 5.05 KB
/
Copy pathci.yml
File metadata and controls
199 lines (185 loc) · 5.05 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
on:
schedule:
- cron: '0 0 * * 1'
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
name: Continuous integration
jobs:
check:
name: Check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
rust: [stable]
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: check
check-metal:
name: Check (metal)
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
args: --workspace --features metal
test:
name: Test Suite
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
rust: [stable]
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
env:
TESTS_HF_TOKEN: ${{ secrets.HF_TOKEN }}
with:
command: test
args: -p mistralrs-core -p mistralrs-quant -p mistralrs-vision
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace --tests --examples -- -D warnings
docs:
name: Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: doc
args: --workspace
typos:
name: Typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Typos check with custom config file
uses: crate-ci/typos@master
with:
config: .typos.toml
unicode-safety:
name: Unicode Safety
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Reject bidirectional control characters (Trojan Source)
run: |
python3 - <<'PY'
import subprocess
import sys
from pathlib import Path
# Bidi and directional controls that can visually reorder source.
forbidden = {
0x202A, # LRE
0x202B, # RLE
0x202D, # LRO
0x202E, # RLO
0x202C, # PDF
0x2066, # LRI
0x2067, # RLI
0x2068, # FSI
0x2069, # PDI
0x200E, # LRM
0x200F, # RLM
}
files = subprocess.check_output(["git", "ls-files"], text=True).splitlines()
findings = []
for file in files:
path = Path(file)
try:
text = path.read_text(encoding="utf-8")
except (UnicodeDecodeError, OSError):
continue
for lineno, line in enumerate(text.splitlines(), 1):
for ch in line:
codepoint = ord(ch)
if codepoint in forbidden:
findings.append((file, lineno, codepoint))
if findings:
for file, lineno, codepoint in findings:
print(f"{file}:{lineno}: forbidden Unicode U+{codepoint:04X}")
sys.exit(1)
print("No forbidden bidirectional Unicode control characters found.")
PY
msrv:
name: MSRV Check (1.90)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.90.0
override: true
- uses: actions-rs/cargo@v1
with:
command: check
args: --workspace
# run `mlc` (`cargo install mlc`)
# markdown-link-check:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: gaurav-nelson/github-action-markdown-link-check@v1