Skip to content

Commit 5bbe575

Browse files
authored
Merge pull request #724 from opentensor/sam-custom-lints
custom linting framework + freeze struct enforcement lint
2 parents 164e64b + 6333edd commit 5bbe575

File tree

16 files changed

+488
-61
lines changed

16 files changed

+488
-61
lines changed

.github/workflows/check-rust.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,54 @@ jobs:
113113
- name: cargo clippy --workspace --all-targets -- -D warnings
114114
run: cargo clippy --workspace --all-targets -- -D warnings
115115

116+
cargo-check-lints:
117+
name: check custom lints
118+
runs-on: SubtensorCI
119+
strategy:
120+
matrix:
121+
rust-branch:
122+
- stable
123+
rust-target:
124+
- x86_64-unknown-linux-gnu
125+
# - x86_64-apple-darwin
126+
os:
127+
- ubuntu-latest
128+
# - macos-latest
129+
env:
130+
RELEASE_NAME: development
131+
RUSTV: ${{ matrix.rust-branch }}
132+
RUSTFLAGS: -D warnings
133+
RUST_BACKTRACE: full
134+
RUST_BIN_DIR: target/${{ matrix.rust-target }}
135+
SKIP_WASM_BUILD: 1
136+
TARGET: ${{ matrix.rust-target }}
137+
steps:
138+
- name: Check-out repository under $GITHUB_WORKSPACE
139+
uses: actions/checkout@v4
140+
141+
- name: Install dependencies
142+
run: |
143+
sudo apt-get update &&
144+
sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler
145+
146+
- name: Install Rust ${{ matrix.rust-branch }}
147+
uses: actions-rs/[email protected]
148+
with:
149+
toolchain: ${{ matrix.rust-branch }}
150+
components: rustfmt, clippy
151+
profile: minimal
152+
153+
- name: Utilize Shared Rust Cache
154+
uses: Swatinem/[email protected]
155+
with:
156+
key: ${{ matrix.os }}-${{ env.RUST_BIN_DIR }}
157+
158+
- name: check lints
159+
run: |
160+
set -o pipefail # Ensure the pipeline fails if any command in the pipeline fails
161+
cargo check 2>&1 | sed -r "s/\x1B\[[0-9;]*[mK]//g" | tee /dev/tty | grep -q "^warning:" && \
162+
(echo "Build emitted the following warnings:" >&2 && exit 1) || echo "No warnings found."
163+
116164
cargo-clippy-all-features:
117165
name: cargo clippy --all-features
118166
runs-on: SubtensorCI

0 commit comments

Comments
 (0)