Skip to content

Commit

Permalink
ci: improve build matrix and fix clippy warnings
Browse files Browse the repository at this point in the history
- Add explicit OS and architecture labels to build matrix
- Add fail-fast: false to continue testing on all platforms
- Add #[must_use] attributes and panic documentation
- Make main function const
- Improve function documentation
  • Loading branch information
jamesbrink committed Feb 9, 2025
1 parent 5316b37 commit 745202b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# Automatically sets up your devbox environment whenever you cd into this
# directory via our direnv integration:

eval "$(devbox generate direnv --print-envrc)"

# check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/
# for more details
13 changes: 11 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,18 @@ env:
jobs:
test:
strategy:
fail-fast: false # Continue with other builds even if one fails
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
name: Test (${{ matrix.os }})
include:
- os: ubuntu-latest
name: Linux (x86_64)
- os: windows-latest
name: Windows (x86_64)
- os: macos-14
name: macOS (Apple Silicon)
- os: macos-latest
name: macOS (Intel x86_64)
name: Test ${{ matrix.name }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fn main() {
const fn main() {
// TODO: Implement CLI entry point
}
16 changes: 16 additions & 0 deletions src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub struct MockProvider {
}

impl MockProvider {
#[must_use]
pub fn new() -> Self {
Self {
calls: Arc::new(Mutex::new(Vec::new())),
Expand All @@ -26,10 +27,25 @@ impl MockProvider {
}
}

/// Set the response that will be returned by this mock provider
///
/// # Panics
///
/// Will panic if the mutex is poisoned
pub fn set_response(&self, info: RateLimitInfo) {
*self.default_response.lock().unwrap() = Some(info);
}

/// Get a list of all API calls made to this mock provider
///
/// # Panics
///
/// Will panic if the mutex is poisoned
///
/// # Returns
///
/// Returns a vector of strings representing the API calls made
#[must_use]
pub fn get_calls(&self) -> Vec<String> {
self.calls.lock().unwrap().clone()
}
Expand Down

0 comments on commit 745202b

Please sign in to comment.