Skip to content

Small tweaks to Rust code after a review pass #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ea0c1d4
lib: derive some helpful traits for AppConfig
cpu Nov 6, 2023
0508ded
ci-bench-runner: add sqlx recommended build script
cpu Nov 6, 2023
518487b
lib: tidy up get_cachegrind_diff url extract
cpu Nov 6, 2023
f846545
lib: simplify result bindings in get_cachegrind_diff
cpu Nov 6, 2023
48854ea
lib: consistently include header name in trace! logs
cpu Nov 6, 2023
a481c5c
lib: derive helpful traits for CommitIdentifier
cpu Nov 6, 2023
6bd6d2c
db: derive Debug for QueuedEvent
cpu Nov 6, 2023
2b06f7a
db: derive Debug for BenchResult
cpu Nov 6, 2023
f167417
db: derive Debug for ComparisonResult
cpu Nov 6, 2023
0761d69
db: use Self for variant in TryFrom<i64> for ScenarioKind
cpu Nov 6, 2023
184a5a8
event_queue: inline active_job_id in EventQueue::new
cpu Nov 6, 2023
1739041
event_queue: start_and_supervise_queue_processing move and return Self
cpu Nov 6, 2023
e42a493
Cargo: use reqwest with rustls + webpki
cpu Nov 6, 2023
4440827
flake: add valgrind as a dev-dependency
cpu Nov 6, 2023
9c7bae3
event_queue: log active_job_id in start_and_supervise_queue_processing
cpu Nov 6, 2023
5899707
event_queue: use Self in AllowedEvent::from_event_string.
cpu Nov 6, 2023
6f0a513
event_queue: simplify AllowedEvent::from_event_string return
cpu Nov 6, 2023
6ce45ca
event_queue: hand-impl Debug for JobContext
cpu Nov 6, 2023
cc615a7
event_queue: derive Debug for JobView
cpu Nov 6, 2023
e2ae2db
github: derive helpful traits for api mod types
cpu Nov 6, 2023
d601818
github: derive Debug for CachedOctocrab
cpu Nov 6, 2023
12d68f2
github: avoid potential timing side channel in MAC verify
cpu Nov 6, 2023
95b5252
runner: in-line single use write_log helper
cpu Nov 6, 2023
d4a3ccb
github/job: use id to detect our own comment, not login
cpu Nov 6, 2023
de1d540
bench_pr: derive Debug for PrBranches, BenchPrError, BenchPrLogs
cpu Nov 6, 2023
61b61dd
ci: add basic GitHub actions + dependabot setup
cpu Nov 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
time: "07:00"
open-pull-requests-limit: 10
- package-ecosystem: "github-actions"
directory: ".github/workflows"
schedule:
interval: "daily"
time: "07:00"
open-pull-requests-limit: 10
69 changes: 69 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Rust

on:
push:
pull_request:

jobs:
format:
name: Format
runs-on: ubuntu-latest
defaults:
run:
working-directory: ci-bench-runner
steps:
- uses: actions/checkout@v4
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
defaults:
run:
working-directory: ci-bench-runner
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo clippy --locked -- --deny warnings

docs:
name: Check for documentation errors
runs-on: ubuntu-latest
defaults:
run:
working-directory: ci-bench-runner
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: cargo doc
run: cargo doc --locked --no-deps --document-private-items
env:
RUSTDOCFLAGS: -Dwarnings

stable:
name: Stable Rust
runs-on: ubuntu-latest
defaults:
run:
working-directory: ci-bench-runner
steps:
- uses: actions/checkout@v4
- name: Install stable rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install valgrind
run: sudo apt-get install -y valgrind
- name: Build
run: cargo build --locked --verbose
- name: Run tests
run: cargo test --locked --verbose
97 changes: 0 additions & 97 deletions ci-bench-runner/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ci-bench-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ uuid = { version = "1.4.1", features = ["v4", "serde"] }

[dev-dependencies]
ctor = "0.2.5"
reqwest = "0.11.22"
reqwest = { version = "0.11.22", default-features = false, features = ["rustls-tls-webpki-roots"] }
wiremock = "0.5.19"
7 changes: 7 additions & 0 deletions ci-bench-runner/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fn main() {
// In some cases if new migrations are added without accompanying Rust src changes
// `cargo build` isn't smart enough to detect the need for recompilation to pick up
// the new embedded migrations. This build script is the recommended workaround.
// See <https://docs.rs/sqlx/latest/sqlx/macro.migrate.html#triggering-recompilation-on-migration-changes>
println!("cargo:rerun-if-changed=migrations");
}
6 changes: 4 additions & 2 deletions ci-bench-runner/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use tokio::sync::Mutex;
use uuid::Uuid;

/// An enqueued GitHub event
#[derive(Debug)]
pub struct QueuedEvent {
/// An internal id for this event (i.e. not GitHub's)
pub id: Uuid,
Expand Down Expand Up @@ -63,7 +64,7 @@ pub struct BenchJob {
}

/// A result for a specific benchmark scenario
#[derive(sqlx::FromRow)]
#[derive(Debug, sqlx::FromRow)]
pub struct BenchResult {
/// The scenario's name
pub scenario_name: String,
Expand All @@ -75,6 +76,7 @@ pub struct BenchResult {
}

/// The results of a comparison between two branches of rustls
#[derive(Debug)]
pub struct ComparisonResult {
/// The diffs, per scenario
pub diffs: Vec<ScenarioDiff>,
Expand Down Expand Up @@ -123,7 +125,7 @@ impl TryFrom<i64> for ScenarioKind {

fn try_from(value: i64) -> Result<Self, Self::Error> {
match value {
0 => Ok(ScenarioKind::Icount),
0 => Ok(Self::Icount),
kind => bail!("invalid scenario kind: {kind}"),
}
}
Expand Down
Loading