Skip to content

Commit

Permalink
Add a gh-action and buildomat jobs to cargo check on no-default-featu…
Browse files Browse the repository at this point in the history
…res and feature-powerset

Includes:
  - fixes around feature-flagging, particularly in oxql, as well as uuid-kinds, sled-storage
  • Loading branch information
zeeshanlakhani committed Jul 9, 2024
1 parent a043275 commit c7d5e59
Show file tree
Hide file tree
Showing 17 changed files with 96 additions and 116 deletions.
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# CI scripts:
# - .github/buildomat/build-and-test.sh
# - .github/buildomat/jobs/clippy.sh
# - .github/buildomat/jobs/check-features.sh
# - .github/workflows/rust.yml
#
[build]
Expand Down
35 changes: 35 additions & 0 deletions .github/buildomat/jobs/check-features.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
#:
#: name = "check-features (helios)"
#: variety = "basic"
#: target = "helios-2.0"
#: rust_toolchain = true
#: output_rules = []

# Run cargo check on illumos with feature-specifics like `no-default-features`.

set -o errexit
set -o pipefail
set -o xtrace

cargo --version
rustc --version

#
# Set up our PATH for use with this workspace.
#
source ./env.sh

banner prerequisites
ptime -m bash ./tools/install_builder_prerequisites.sh -y

banner check
export CARGO_INCREMENTAL=0
ptime -m cargo check --workspace --bins --tests --no-default-features
RUSTDOCFLAGS="--document-private-items -D warnings" ptime -m cargo doc --workspace --no-deps --no-default-features

#
# `cargo-hack` check feature-powerset
#
banner hack
cargo hack check --workspace --feature-powerset --no-dev-deps --exclude-features image-trampoline,image-standard
2 changes: 1 addition & 1 deletion .github/buildomat/jobs/clippy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# (that we want to check) is conditionally-compiled on illumos only.
#
# Note that `cargo clippy` includes `cargo check, so this ends up checking all
# of our code.
# of our (default) code.

set -o errexit
set -o pipefail
Expand Down
34 changes: 33 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: cargo run --bin omicron-package -- -t default check

# Note that `cargo clippy` includes `cargo check, so this ends up checking all
# of our code.
# of our (default) code.
clippy-lint:
runs-on: ubuntu-22.04
env:
Expand Down Expand Up @@ -82,6 +82,38 @@ jobs:
- name: Run Clippy Lints
run: cargo xtask clippy

check-features:
runs-on: ubuntu-22.04
env:
CARGO_INCREMENTAL: 0
steps:
# This repo is unstable and unnecessary: https://github.com/microsoft/linux-package-repositories/issues/34
- name: Disable packages.microsoft.com repo
run: sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.event.pull_request.head.sha }} # see omicron#4461
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
if: ${{ github.ref != 'refs/heads/main' }}
- name: Report cargo version
run: cargo --version
- name: Update PATH
run: source "./env.sh"; echo "PATH=$PATH" >> "$GITHUB_ENV"
- name: Print PATH
run: echo $PATH
- name: Print GITHUB_ENV
run: cat "$GITHUB_ENV"
- name: Install Pre-Requisites
run: ./tools/install_builder_prerequisites.sh -y
- name: Run Cargo Check (No Default Features)
run: cargo check --workspace --bins --tests --no-default-features
- name: Install cargo-binstall
uses: taiki-e/install-action@cargo-binstall
- name: Install cargo-hack
run: cargo binstall cargo-hack --locked
- name: Run Cargo Hack Check (Feature-Powerset, No-Dev-Deps)
run: cargo hack check --workspace --feature-powerset --no-dev-deps --exclude-features image-trampoline,image-standard

# This is just a test build of docs. Publicly available docs are built via
# the separate "rustdocs" repo.
build-docs:
Expand Down
50 changes: 0 additions & 50 deletions Cargo.lock

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

38 changes: 1 addition & 37 deletions nexus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ num-integer.workspace = true
once_cell.workspace = true
openssl.workspace = true
oximeter-client.workspace = true
oximeter-db.workspace = true
oximeter-db = { workspace = true, default-features = false, features = [ "oxql" ] }
oxnet.workspace = true
parse-display.workspace = true
paste.workspace = true
Expand Down Expand Up @@ -108,42 +108,6 @@ update-common.workspace = true
omicron-workspace-hack.workspace = true
omicron-uuid-kinds.workspace = true

[dev-dependencies]
async-bb8-diesel.workspace = true
camino-tempfile.workspace = true
criterion.workspace = true
diesel.workspace = true
dns-server.workspace = true
expectorate.workspace = true
hyper-rustls.workspace = true
gateway-messages.workspace = true
gateway-test-utils.workspace = true
hubtools.workspace = true
nexus-db-queries = { workspace = true, features = ["testing"] }
nexus-test-utils-macros.workspace = true
nexus-test-utils.workspace = true
omicron-sled-agent.workspace = true
omicron-test-utils.workspace = true
openapi-lint.workspace = true
openapiv3.workspace = true
oxide-client.workspace = true
oximeter-collector.workspace = true
pem.workspace = true
petgraph.workspace = true
pretty_assertions.workspace = true
rcgen.workspace = true
regex.workspace = true
similar-asserts.workspace = true
sp-sim.workspace = true
rustls.workspace = true
subprocess.workspace = true
term.workspace = true
trust-dns-resolver.workspace = true
tufaceous.workspace = true
tufaceous-lib.workspace = true
httptest.workspace = true
strum.workspace = true

[[bench]]
name = "setup_benchmark"
harness = false
Expand Down
20 changes: 5 additions & 15 deletions oximeter/db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ clap.workspace = true
dropshot.workspace = true
futures.workspace = true
highway.workspace = true
num.workspace = true
omicron-common.workspace = true
omicron-workspace-hack.workspace = true
oximeter.workspace = true
Expand All @@ -45,10 +46,6 @@ optional = true
workspace = true
optional = true

[dependencies.num]
workspace = true
optional = true

[dependencies.peg]
workspace = true
optional = true
Expand Down Expand Up @@ -85,16 +82,6 @@ optional = true
workspace = true
features = [ "rt-multi-thread", "macros" ]

[dev-dependencies]
expectorate.workspace = true
indexmap.workspace = true
itertools.workspace = true
omicron-test-utils.workspace = true
slog-dtrace.workspace = true
sqlparser.workspace = true
strum.workspace = true
tempfile.workspace = true

[features]
default = [ "oxql", "sql" ]
sql = [
Expand All @@ -105,9 +92,11 @@ sql = [
"dep:sqlparser",
"dep:tabled"
]
oxdb = [
"dep:tabled"
]
oxql = [
"dep:crossterm",
"dep:num",
"dep:peg",
"dep:reedline",
"dep:tabled",
Expand All @@ -116,3 +105,4 @@ oxql = [
[[bin]]
name = "oxdb"
doc = false
required-features = ["oxdb"]
2 changes: 2 additions & 0 deletions oximeter/db/src/bin/oxdb/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ enum Subcommand {
},

/// Enter the Oximeter Query Language shell for interactive querying.
#[cfg(feature = "oxql")]
Oxql {
#[clap(flatten)]
opts: oximeter_db::shells::oxql::ShellOptions,
Expand Down Expand Up @@ -350,6 +351,7 @@ async fn main() -> anyhow::Result<()> {
oximeter_db::shells::sql::shell(args.address, args.port, log, opts)
.await?
}
#[cfg(feature = "oxql")]
Subcommand::Oxql { opts } => {
oximeter_db::shells::oxql::shell(args.address, args.port, log, opts)
.await?
Expand Down
1 change: 1 addition & 0 deletions oximeter/db/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// Copyright 2024 Oxide Computer Company

pub(crate) mod dbwrite;
#[cfg(any(feature = "oxql", test))]
pub(crate) mod oxql;
pub(crate) mod query_summary;
#[cfg(any(feature = "sql", test))]
Expand Down
Loading

0 comments on commit c7d5e59

Please sign in to comment.