Skip to content

Commit

Permalink
Add CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-nitrokey committed Jan 6, 2025
1 parent dcff900 commit ee3c8c4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: ci

on: [pull_request, push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: install Rust toolchain
run: rustup show active-toolchain || rustup toolchain install
- name: check
run: |
cargo check --workspace --all-features --all-targets
- name: test
run: |
cargo test --all-features --workspace
- name: lint
run: |
cargo fmt --check --all
cargo clippy --workspace --all-features --all-targets -- -Dwarnings
RUSTDOCFLAGS='-Dwarnings' cargo doc --workspace --all-features
13 changes: 6 additions & 7 deletions src/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,10 @@ impl<'alloc, 'pipe, 'interrupt, Bus: UsbBus> Pipe<'alloc, 'pipe, 'interrupt, Bus
// `solo ls` crashes here as it uses command 0x86
Err(_) => {
info!("Received invalid command.");
self.start_sending_error_on_channel(channel, AuthenticatorError::InvalidCommand);
self.start_sending_error_on_channel(
channel,
AuthenticatorError::InvalidCommand,
);
return;
}
};
Expand Down Expand Up @@ -526,11 +529,7 @@ impl<'alloc, 'pipe, 'interrupt, Bus: UsbBus> Pipe<'alloc, 'pipe, 'interrupt, Bus
}

_ => {
if request.command == Command::Cbor {
self.needs_keepalive = true;
} else {
self.needs_keepalive = false;
}
self.needs_keepalive = request.command == Command::Cbor;
if self.interchange.state() == interchange::State::Responded {
info!("dumping stale response");
self.interchange.take_response();
Expand Down Expand Up @@ -625,7 +624,7 @@ impl<'alloc, 'pipe, 'interrupt, Bus: UsbBus> Pipe<'alloc, 'pipe, 'interrupt, Bus
message.len()
);
let response = Response::from_request_and_size(request, message.len());
self.buffer[..message.len()].copy_from_slice(&message);
self.buffer[..message.len()].copy_from_slice(message);
self.start_sending(response);
}
}
Expand Down

0 comments on commit ee3c8c4

Please sign in to comment.