From deb42416bbc600e91615168562e16ca9e4a36c7e Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Tue, 27 Apr 2021 20:52:21 -0400 Subject: [PATCH 1/3] Add workspace and github action --- .github/workflows/rust.yml | 24 ++++++++++++++++++++++++ Cargo.toml | 7 +++++++ 2 files changed, 31 insertions(+) create mode 100644 .github/workflows/rust.yml create mode 100644 Cargo.toml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 000000000..f0bdbb990 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,24 @@ +name: Rust + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@nightly + - name: Build + run: cargo build --verbose + - name: Test + run: cargo test --verbose + diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 000000000..271fdf1c9 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,7 @@ +[workspace] + +members = [ + "propolis", + "propolis-cli", + "propolis-server", +] From 99f71c601efa7084a52af262becd3eb567a8739a Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Tue, 27 Apr 2021 20:56:39 -0400 Subject: [PATCH 2/3] Expand actions to include format, docs --- .github/workflows/rust.yml | 20 +++++++++++++++++--- propolis-server/src/main.rs | 15 ++++++++------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f0bdbb990..74e995f26 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,10 +10,24 @@ env: CARGO_TERM_COLOR: always jobs: - build: - + check-style: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@nightly + - name: Report rustfmt version + run: cargo fmt -- --version + - name: Check style + run: cargo fmt -- --check + build-docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@nightly + - name: Test build documentation + run: cargo doc + build-and-test: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - uses: dtolnay/rust-toolchain@nightly diff --git a/propolis-server/src/main.rs b/propolis-server/src/main.rs index 6f0e58342..29f47f505 100644 --- a/propolis-server/src/main.rs +++ b/propolis-server/src/main.rs @@ -118,13 +118,14 @@ async fn instance_ensure( // Create the instance. let lowmem = (properties.memory * 1024 * 1024) as usize; - let instance = build_instance(&properties.id.to_string(), properties.vcpus, lowmem) - .map_err(|err| { - HttpError::for_internal_error(format!( - "Cannot build instance: {}", - err.to_string() - )) - })?; + let instance = + build_instance(&properties.id.to_string(), properties.vcpus, lowmem) + .map_err(|err| { + HttpError::for_internal_error(format!( + "Cannot build instance: {}", + err.to_string() + )) + })?; // Initialize (some) of the instance's hardware. // From 5e0a62b4816430b4844581c1aa07a6e495870dae Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Tue, 27 Apr 2021 20:57:56 -0400 Subject: [PATCH 3/3] Not using nightly for format --- .github/workflows/rust.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 74e995f26..3efe07c96 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -14,7 +14,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: dtolnay/rust-toolchain@nightly - name: Report rustfmt version run: cargo fmt -- --version - name: Check style