ci: test the no-alloc build and harden the workflow
Run clippy, docs and tests for tines-core with --no-default-features, gating the MemStore-based tests on `alloc` so they compile there. Fail on rustdoc warnings, pass --locked everywhere, and pin the toolchain to 1.99.0. In the workflow, use read-only permissions, cancel superseded runs, add a 20-minute timeout, and pin actions to commit SHAs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,24 +5,34 @@ on:
|
|||||||
branches: [master]
|
branches: [master]
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 20
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||||
|
|
||||||
|
# Keep in sync with rust-toolchain.toml.
|
||||||
- name: Install Rust toolchain
|
- name: Install Rust toolchain
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
|
||||||
with:
|
with:
|
||||||
|
toolchain: 1.99.0
|
||||||
components: rustfmt, clippy
|
components: rustfmt, clippy
|
||||||
targets: thumbv7em-none-eabihf
|
targets: thumbv7em-none-eabihf
|
||||||
|
|
||||||
- name: Cache cargo registry and target
|
- name: Cache cargo registry and target
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
||||||
|
|
||||||
- name: Run CI gate
|
- name: Run CI gate
|
||||||
run: sh scripts/ci.sh
|
run: sh scripts/ci.sh
|
||||||
|
|||||||
+5
-1
@@ -1,2 +1,6 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "stable"
|
# Pinned so new clippy lints or rustfmt rules can't break CI without a code
|
||||||
|
# change. Bump deliberately, together with the version in ci.yml.
|
||||||
|
channel = "1.99.0"
|
||||||
|
components = ["rustfmt", "clippy"]
|
||||||
|
targets = ["thumbv7em-none-eabihf"]
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
rustup target add thumbv7em-none-eabihf
|
target=thumbv7em-none-eabihf
|
||||||
cargo build -p tines-core --no-default-features --target thumbv7em-none-eabihf
|
if ! rustup target list --installed | grep -qx "$target"; then
|
||||||
|
rustup target add "$target"
|
||||||
|
fi
|
||||||
|
cargo build --locked -p tines-core --no-default-features --target "$target"
|
||||||
|
|||||||
+6
-3
@@ -1,7 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
cargo fmt --all -- --check
|
cargo fmt --all -- --check
|
||||||
cargo clippy --workspace --all-targets -- -D warnings
|
cargo clippy --locked --workspace --all-targets -- -D warnings
|
||||||
cargo doc --workspace --no-deps
|
cargo clippy --locked -p tines-core --no-default-features --all-targets -- -D warnings
|
||||||
cargo test --workspace
|
RUSTDOCFLAGS="-D warnings" cargo doc --locked --workspace --no-deps
|
||||||
|
RUSTDOCFLAGS="-D warnings" cargo doc --locked -p tines-core --no-deps --no-default-features
|
||||||
|
cargo test --locked --workspace
|
||||||
|
cargo test --locked -p tines-core --no-default-features
|
||||||
sh scripts/check-no-std.sh
|
sh scripts/check-no-std.sh
|
||||||
|
|||||||
@@ -572,7 +572,7 @@ fn insert_pos(heap: &Vec<(ObservationId, u64), { consts::SEND_QUEUE_CAP }>, age:
|
|||||||
pos
|
pos
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(all(test, feature = "alloc"))]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{MemStore, Observation, Payload, Topic};
|
use crate::{MemStore, Observation, Payload, Topic};
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
//!
|
//!
|
||||||
//! This module defines the [`Store`] trait plus its [`TrimPolicy`] and
|
//! This module defines the [`Store`] trait plus its [`TrimPolicy`] and
|
||||||
//! [`StoreError`] types. Everything here is `#![no_std]`-clean and does **not**
|
//! [`StoreError`] types. Everything here is `#![no_std]`-clean and does **not**
|
||||||
//! require the `alloc` feature — only concrete backends (see
|
//! require the `alloc` feature — only concrete backends (such as `mem_store`,
|
||||||
//! [`mem_store`](crate::mem_store)) need allocation, so the trait, policy, and
|
//! which is compiled only with `alloc`) need allocation, so the trait, policy,
|
||||||
//! error types remain available on `no_std` targets as well.
|
//! and error types remain available on `no_std` targets as well.
|
||||||
|
|
||||||
use crate::observation::{Observation, ObservationId, Tick};
|
use crate::observation::{Observation, ObservationId, Tick};
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Every test here drives a `Node` over `MemStore`, which needs `alloc`.
|
||||||
|
#![cfg(feature = "alloc")]
|
||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
use common::PairTransport;
|
use common::PairTransport;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user