Merge pull request #2303 from cgwalters/gh-actions
ci: Add a Github Action for Rust for tests/inst
This commit is contained in:
commit
236a5ca9bf
|
|
@ -0,0 +1,27 @@
|
||||||
|
---
|
||||||
|
name: Rust
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
ACTIONS_LINTS_TOOLCHAIN: 1.50.0
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
linting:
|
||||||
|
name: "Lints, pinned toolchain"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: ${{ env['ACTIONS_LINTS_TOOLCHAIN'] }}
|
||||||
|
default: true
|
||||||
|
components: rustfmt, clippy
|
||||||
|
- name: cargo fmt (check)
|
||||||
|
run: cd tests/inst && cargo fmt -- --check -l
|
||||||
|
|
@ -108,21 +108,22 @@ impl RebootMark {
|
||||||
strategy: &InterruptStrategy,
|
strategy: &InterruptStrategy,
|
||||||
) -> &mut BTreeMap<UpdateResult, u32> {
|
) -> &mut BTreeMap<UpdateResult, u32> {
|
||||||
match strategy {
|
match strategy {
|
||||||
InterruptStrategy::Polite(t) => self
|
InterruptStrategy::Polite(t) => {
|
||||||
.polite
|
self.polite.entry(t.clone()).or_insert_with(BTreeMap::new)
|
||||||
.entry(t.clone())
|
}
|
||||||
.or_insert_with(BTreeMap::new),
|
InterruptStrategy::Force(t) => {
|
||||||
InterruptStrategy::Force(t) => self
|
self.force.entry(t.clone()).or_insert_with(BTreeMap::new)
|
||||||
.force
|
}
|
||||||
.entry(t.clone())
|
|
||||||
.or_insert_with(BTreeMap::new),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InterruptStrategy {
|
impl InterruptStrategy {
|
||||||
pub(crate) fn is_noop(&self) -> bool {
|
pub(crate) fn is_noop(&self) -> bool {
|
||||||
matches!(self, InterruptStrategy::Polite(PoliteInterruptStrategy::None))
|
matches!(
|
||||||
|
self,
|
||||||
|
InterruptStrategy::Polite(PoliteInterruptStrategy::None)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -598,9 +599,7 @@ fn transactionality() -> Result<()> {
|
||||||
upgrade_and_finalize().context("Firstrun upgrade failed")?;
|
upgrade_and_finalize().context("Firstrun upgrade failed")?;
|
||||||
let end = time::Instant::now();
|
let end = time::Instant::now();
|
||||||
let cycle_time = end.duration_since(start);
|
let cycle_time = end.duration_since(start);
|
||||||
let tdata = TransactionalTestInfo {
|
let tdata = TransactionalTestInfo { cycle_time };
|
||||||
cycle_time,
|
|
||||||
};
|
|
||||||
let mut f = std::io::BufWriter::new(std::fs::File::create(&TDATAPATH)?);
|
let mut f = std::io::BufWriter::new(std::fs::File::create(&TDATAPATH)?);
|
||||||
serde_json::to_writer(&mut f, &tdata)?;
|
serde_json::to_writer(&mut f, &tdata)?;
|
||||||
f.flush()?;
|
f.flush()?;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue