Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions .github/buildomat/jobs/build-and-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ export RUSTFLAGS="-D warnings"
export RUSTDOCFLAGS="-D warnings"
ptime -m cargo +'nightly-2021-11-24' build --locked --all-targets --verbose

#
# Check that building individual packages as when deploying Omicron succeeds
#
banner deploy-check
ptime -m cargo run --bin omicron-package -- check

banner clickhouse
ptime -m ./tools/ci_download_clickhouse

Expand Down
30 changes: 19 additions & 11 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ jobs:
- name: Check style
run: cargo fmt -- --check

check-omicron-deployment:
needs: skip_duplicate_jobs
if: ${{ needs.skip_duplicate_jobs.outputs.should_skip != 'true' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-18.04, macos-11 ]
steps:
# actions/checkout@v2
- uses: actions/checkout@28c7f3d2b5162b5ddd3dfd9a45aa55eaf396478b
- name: Report cargo version
run: cargo --version
- name: Check build of deployed Omicron packages
run: cargo run --bin omicron-package -- check

clippy-lint:
needs: skip_duplicate_jobs
if: ${{ needs.skip_duplicate_jobs.outputs.should_skip != 'true' }}
Expand Down Expand Up @@ -73,19 +89,11 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-18.04, macos-11 ]
# See rust-toolchain for why we're using nightly here.
toolchain: [ nightly-2021-11-24 ]
steps:
# actions/checkout@v2
- uses: actions/checkout@28c7f3d2b5162b5ddd3dfd9a45aa55eaf396478b
- name: Install Toolchain
# actions-rs/toolchain@v1.0.6
uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f
with:
toolchain: ${{ matrix.toolchain }}
override: true
- name: Report cargo version
run: cargo +${{ matrix.toolchain }} --version
run: cargo --version
- name: Configure GitHub cache for CockroachDB binaries
id: cache-cockroachdb
# actions/cache@v2.1.4
Expand All @@ -111,7 +119,7 @@ jobs:
# also gives us a record of which dependencies were used for each CI
# run. Building with `--locked` ensures that the checked-in Cargo.lock
# is up to date.
run: RUSTFLAGS="-D warnings" RUSTDOCFLAGS="-D warnings" cargo +${{ matrix.toolchain }} build --locked --all-targets --verbose
run: RUSTFLAGS="-D warnings" RUSTDOCFLAGS="-D warnings" cargo build --locked --all-targets --verbose
- name: Download ClickHouse
if: steps.cache-clickhouse.outputs.cache-hit != 'true'
run: ./tools/ci_download_clickhouse
Expand All @@ -123,4 +131,4 @@ jobs:
# rebuild here.
# Put "./cockroachdb/bin" and "./clickhouse" on the PATH for the test
# suite.
run: PATH="$PATH:$PWD/cockroachdb/bin:$PWD/clickhouse" RUSTFLAGS="-D warnings" RUSTDOCFLAGS="-D warnings" cargo +${{ matrix.toolchain }} test --workspace --locked --verbose
run: PATH="$PATH:$PWD/cockroachdb/bin:$PWD/clickhouse" RUSTFLAGS="-D warnings" RUSTDOCFLAGS="-D warnings" cargo test --workspace --locked --verbose
4 changes: 2 additions & 2 deletions 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 common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ anyhow = "1.0"
api_identity = { path = "../api_identity" }
backoff = { version = "0.3.0", features = [ "tokio" ] }
chrono = { version = "0.4", features = [ "serde" ] }
dropshot = { git = "https://github.com/oxidecomputer/dropshot", branch = "main" }
dropshot = { git = "https://github.com/oxidecomputer/dropshot", branch = "main", features = [ "usdt-probes" ] }
futures = "0.3.18"
http = "0.2.5"
hyper = "0.14"
Expand Down
2 changes: 1 addition & 1 deletion oximeter/collector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "The oximeter metric collection server"
license = "MPL-2.0"

[dependencies]
dropshot = { git = "https://github.com/oxidecomputer/dropshot", branch = "main" }
dropshot = { git = "https://github.com/oxidecomputer/dropshot", branch = "main", features = [ "usdt-probes" ] }
nexus-client = { path = "../../nexus-client" }
omicron-common = { path = "../../common" }
oximeter = { path = "../oximeter" }
Expand Down
2 changes: 1 addition & 1 deletion oximeter/instruments/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "MPL-2.0"

[dependencies]
chrono = { version = "0.4", features = [ "serde" ] }
dropshot = { git = "https://github.com/oxidecomputer/dropshot", branch = "main" }
dropshot = { git = "https://github.com/oxidecomputer/dropshot", branch = "main", features = [ "usdt-probes" ] }
futures = "0.3.18"
oximeter = { path = "../oximeter" }
http = { version = "0.2.5", optional = true }
Expand Down
28 changes: 25 additions & 3 deletions package/src/bin/omicron-package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ enum SubCommand {
)]
release: bool,
},
/// Checks the packages specified in a manifest, without building.
Check,
/// Installs the packages to a target machine.
Install {
/// The directory from which artifacts will be pulled.
Expand Down Expand Up @@ -98,11 +100,15 @@ struct Args {
subcommand: SubCommand,
}

fn build_rust_package(package: &str, release: bool) -> Result<()> {
fn run_cargo_on_package(
subcmd: &str,
package: &str,
release: bool,
) -> Result<()> {
let mut cmd = Command::new("cargo");
// We rely on the rust-toolchain.toml file for toolchain information,
// rather than specifying one within the packaging tool.
cmd.arg("build").arg("-p").arg(package);
cmd.arg(subcmd).arg("-p").arg(package);
if release {
cmd.arg("--release");
}
Expand Down Expand Up @@ -173,7 +179,14 @@ impl PackageInfo {
// Builds the requested package.
fn build(&self, package_name: &str, release: bool) -> Result<()> {
match &self.build {
Build::Rust => build_rust_package(package_name, release),
Build::Rust => run_cargo_on_package("build", package_name, release),
}
}

// Checks the requested package.
fn check(&self, package_name: &str) -> Result<()> {
match &self.build {
Build::Rust => run_cargo_on_package("check", package_name, false),
}
}
}
Expand All @@ -193,6 +206,14 @@ fn parse<P: AsRef<Path>>(path: P) -> Result<Config, ParseError> {
Ok(cfg)
}

async fn do_check(config: &Config) -> Result<()> {
for (package_name, package) in &config.packages {
println!("Checking {}", package_name);
package.check(&package_name)?;
}
Ok(())
}

async fn do_package(
config: &Config,
output_directory: &Path,
Expand Down Expand Up @@ -446,6 +467,7 @@ async fn main() -> Result<()> {
SubCommand::Package { artifact_dir, release } => {
do_package(&config, &artifact_dir, *release).await?;
}
SubCommand::Check => do_check(&config).await?,
SubCommand::Install { artifact_dir, install_dir } => {
do_install(&config, &artifact_dir, &install_dir)?;
}
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#

[toolchain]
# NOTE: This toolchain is also specified within .github/workflows/rust.yml
# NOTE: This toolchain is also specified within .github/buildomat/jobs/build-and-test.sh.
# If you update it here, update that file too.
channel = "nightly-2021-11-24"
profile = "default"
2 changes: 1 addition & 1 deletion sled-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bincode = "1.3.3"
bytes = "1.1"
cfg-if = "1.0"
chrono = { version = "0.4", features = [ "serde" ] }
dropshot = { git = "https://github.com/oxidecomputer/dropshot", branch = "main" }
dropshot = { git = "https://github.com/oxidecomputer/dropshot", branch = "main", features = [ "usdt-probes" ] }
futures = "0.3.18"
ipnetwork = "0.18"
nexus-client = { path = "../nexus-client" }
Expand Down