mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-09 13:26:48 +00:00
Fail the CI if workspace lints are not enabled
This commit is contained in:
parent
725a46fe72
commit
f720c05706
23
Makefile
23
Makefile
@ -45,6 +45,8 @@ VHOST ?= off
|
|||||||
|
|
||||||
# ========================= End of Makefile options. ==========================
|
# ========================= End of Makefile options. ==========================
|
||||||
|
|
||||||
|
SHELL := /bin/bash
|
||||||
|
|
||||||
CARGO_OSDK := ~/.cargo/bin/cargo-osdk
|
CARGO_OSDK := ~/.cargo/bin/cargo-osdk
|
||||||
|
|
||||||
CARGO_OSDK_ARGS := --target-arch=$(ARCH) --kcmd-args="ostd.log_level=$(LOG_LEVEL)"
|
CARGO_OSDK_ARGS := --target-arch=$(ARCH) --kcmd-args="ostd.log_level=$(LOG_LEVEL)"
|
||||||
@ -293,8 +295,11 @@ format:
|
|||||||
.PHONY: check
|
.PHONY: check
|
||||||
# FIXME: Make `make check` arch-aware.
|
# FIXME: Make `make check` arch-aware.
|
||||||
check: initramfs $(CARGO_OSDK)
|
check: initramfs $(CARGO_OSDK)
|
||||||
@./tools/format_all.sh --check # Check Rust format issues
|
@# Check formatting issues of the Rust code
|
||||||
@# Check if STD_CRATES and NOSTD_CRATES combined is the same as all workspace members
|
@./tools/format_all.sh --check
|
||||||
|
@
|
||||||
|
@# Check if the combination of STD_CRATES and NON_OSDK_CRATES is the
|
||||||
|
@# same as all workspace members
|
||||||
@sed -n '/^\[workspace\]/,/^\[.*\]/{/members = \[/,/\]/p}' Cargo.toml | \
|
@sed -n '/^\[workspace\]/,/^\[.*\]/{/members = \[/,/\]/p}' Cargo.toml | \
|
||||||
grep -v "members = \[" | tr -d '", \]' | \
|
grep -v "members = \[" | tr -d '", \]' | \
|
||||||
sort > /tmp/all_crates
|
sort > /tmp/all_crates
|
||||||
@ -303,6 +308,16 @@ check: initramfs $(CARGO_OSDK)
|
|||||||
(echo "Error: The combination of STD_CRATES and NOSTD_CRATES" \
|
(echo "Error: The combination of STD_CRATES and NOSTD_CRATES" \
|
||||||
"is not the same as all workspace members" && exit 1)
|
"is not the same as all workspace members" && exit 1)
|
||||||
@rm /tmp/all_crates /tmp/combined_crates
|
@rm /tmp/all_crates /tmp/combined_crates
|
||||||
|
@
|
||||||
|
@# Check if all workspace members enable workspace lints
|
||||||
|
@for dir in $(NON_OSDK_CRATES) $(OSDK_CRATES); do \
|
||||||
|
if [[ "$$(tail -2 $$dir/Cargo.toml)" != "[lints]"$$'\n'"workspace = true" ]]; then \
|
||||||
|
echo "Error: Workspace lints in $$dir are not enabled"; \
|
||||||
|
exit 1; \
|
||||||
|
fi \
|
||||||
|
done
|
||||||
|
@
|
||||||
|
@# Check compilation of the Rust code
|
||||||
@for dir in $(NON_OSDK_CRATES); do \
|
@for dir in $(NON_OSDK_CRATES); do \
|
||||||
echo "Checking $$dir"; \
|
echo "Checking $$dir"; \
|
||||||
(cd $$dir && cargo clippy -- -D warnings) || exit 1; \
|
(cd $$dir && cargo clippy -- -D warnings) || exit 1; \
|
||||||
@ -311,7 +326,11 @@ check: initramfs $(CARGO_OSDK)
|
|||||||
echo "Checking $$dir"; \
|
echo "Checking $$dir"; \
|
||||||
(cd $$dir && cargo osdk clippy -- -- -D warnings) || exit 1; \
|
(cd $$dir && cargo osdk clippy -- -- -D warnings) || exit 1; \
|
||||||
done
|
done
|
||||||
|
@
|
||||||
|
@# Check formatting issues of the C code (regression tests)
|
||||||
@$(MAKE) --no-print-directory -C test check
|
@$(MAKE) --no-print-directory -C test check
|
||||||
|
@
|
||||||
|
@# Check typos
|
||||||
@typos
|
@typos
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
@ -3,8 +3,13 @@ name = "systree"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bitflags = "2.5"
|
bitflags = "2.5"
|
||||||
ostd = { path = "../../../ostd" }
|
ostd = { path = "../../../ostd" }
|
||||||
component = { path = "../../libs/comp-sys/component" }
|
component = { path = "../../libs/comp-sys/component" }
|
||||||
spin = "0.9"
|
spin = "0.9"
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user