Skip to content

Commit

Permalink
nit: small nitpicks (#1544)
Browse files Browse the repository at this point in the history
* nits

* nit

* nit

* better trace

* fix: new auth command in script

* nit

* nit: delete rustfmt.toml that only has default or redundant values

* fix: formalize MSRV and use it in CI, use latest for binary build
  • Loading branch information
jonaro00 committed Jan 26, 2024
1 parent 50e6a4c commit 9a75f16
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 18 deletions.
18 changes: 11 additions & 7 deletions .circleci/config.yml
Expand Up @@ -9,6 +9,7 @@ orbs:
executors:
docker-rust:
docker:
# Note: Let CI use our MSRV, rather than latest
- image: cimg/rust:1.75.0
resource_class: small
machine-ubuntu:
Expand Down Expand Up @@ -113,8 +114,8 @@ commands:
steps:
- run:
name: Install Rust
command: |
which cargo || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.75.0
# Note: Let CI use our MSRV, rather than latest
command: which cargo || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.75.0
- run: rustup target add wasm32-wasi
install-protoc:
steps:
Expand Down Expand Up @@ -499,7 +500,8 @@ jobs:
- run: sudo apt update && sudo DEBIAN_FRONTEND=noninteractive apt install -y libssl-dev musl-tools clang
- run:
name: Install Rust
command: curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain 1.75.0 --target << parameters.target >>
# Note: Let binary build use latest
command: curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | bash -s -- -y --target << parameters.target >>
- run:
name: Build
command: |
Expand All @@ -520,9 +522,10 @@ jobs:
- run: choco install -y strawberryperl
- run:
name: Install Rust
# Note: Let binary build use latest
command: |
wget -OutFile "C:\rustup-init.exe" https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe
C:\rustup-init.exe -y --default-toolchain 1.75.0 --target x86_64-pc-windows-msvc
C:\rustup-init.exe -y --target x86_64-pc-windows-msvc
shell: powershell.exe
- run:
name: Build
Expand All @@ -545,14 +548,15 @@ jobs:
- macos/install-rosetta
- run:
name: Install Rust
command: curl --proto '=https' https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain 1.75.0 --target x86_64-apple-darwin
# Note: Let binary build use latest
command: curl --proto '=https' https://sh.rustup.rs -sSf | bash -s -- -y --target x86_64-apple-darwin
- run:
name: Build
command: |
cargo build --release --package cargo-shuttle --target x86_64-apple-darwin
- make-artifact:
target: x86_64-apple-darwin
publish-github-release:
publish-github-release-draft:
docker:
- image: cimg/go:1.19.3
steps:
Expand Down Expand Up @@ -921,7 +925,7 @@ workflows:
filters:
branches:
only: production
- publish-github-release:
- publish-github-release-draft:
requires:
- build-binaries-x86_64-gnu
- build-binaries-x86_64-musl
Expand Down
1 change: 0 additions & 1 deletion cargo-shuttle/Cargo.toml
Expand Up @@ -6,7 +6,6 @@ license.workspace = true
repository.workspace = true
description = "A cargo command for the shuttle platform (https://www.shuttle.rs/)"
homepage = "https://www.shuttle.rs"
rust-version = "1.70"

[dependencies]
shuttle-common = { workspace = true, features = ["models"] }
Expand Down
2 changes: 2 additions & 0 deletions cargo-shuttle/src/lib.rs
Expand Up @@ -1981,6 +1981,8 @@ impl Shuttle {
)
})?;

println!("Deleted project");

Ok(CommandOutcome::Ok)
}

Expand Down
2 changes: 2 additions & 0 deletions common/Cargo.toml
Expand Up @@ -5,6 +5,8 @@ edition.workspace = true
license.workspace = true
repository.workspace = true
description = "Common library for the shuttle platform (https://www.shuttle.rs/)"
# Base MSRV for the Shuttle crates. If some other crate has a higher MSRV, set it in that crate.
rust-version = "1.75"

[dependencies]
anyhow = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions common/src/models/resource.rs
Expand Up @@ -141,10 +141,10 @@ fn get_databases_table(
let show_secret_hint = if databases.is_empty() || show_secrets {
""
} else {
"Hint: you can show the secrets of these resources using --show-secrets\n"
"Hint: you can show the secrets of these resources using `cargo shuttle resource list --show-secrets`\n"
};

format!("These databases are linked to {service_name}\n{table}\n{show_secret_hint}",)
format!("These databases are linked to {service_name}\n{table}\n{show_secret_hint}")
}

fn get_secrets_table(secrets: &[&Response], service_name: &str, raw: bool) -> String {
Expand Down
1 change: 1 addition & 0 deletions gateway/src/api/latest.rs
Expand Up @@ -1197,6 +1197,7 @@ impl ApiBuilder {
let posthog_client = self.posthog_client.expect("a task Sender is required");

// Allow about 4 cores per build, but use at most 75% (* 3 / 4) of all cores and at least 1 core
// Assumes each builder (deployer) is assigned 4 cores
let concurrent_builds: usize = (num_cpus::get() * 3 / 4 / 4).max(1);

let running_builds = Arc::new(Mutex::new(TtlCache::new(concurrent_builds)));
Expand Down
7 changes: 3 additions & 4 deletions gateway/src/project.rs
Expand Up @@ -932,10 +932,9 @@ impl ProjectCreating {
// TODO: remove the config from the log message, add that into the span attributes as a
// serialized JSON.
debug!(
r"generated a container configuration:
CreateContainerOpts: {create_container_options:#?}
Config: {config:#?}
"
?create_container_options,
?config,
"generated a container configuration"
);

(create_container_options, config)
Expand Down
2 changes: 0 additions & 2 deletions rustfmt.toml

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/local-admin.sh
Expand Up @@ -9,4 +9,4 @@ export SHUTTLE_API_KEY=$key
export SHUTTLE_API="http://localhost:8001"
export PS1="(shuttle: local admin key) $(echo $PS1 | sed -e "s/(shuttle: .*) //")"

docker compose --file docker-compose.rendered.yml --project-name shuttle-dev exec auth /usr/local/bin/shuttle-auth --state=/var/lib/shuttle-auth init-admin --name admin --key $key
docker compose --file docker-compose.rendered.yml --project-name shuttle-dev exec auth /usr/local/bin/shuttle-auth --db-connection-uri=postgres://postgres:postgres@control-db init-admin --name admin --key $key
2 changes: 1 addition & 1 deletion service/src/builder.rs
Expand Up @@ -138,7 +138,7 @@ pub async fn build_workspace(
.map(|d| format!("{} '{}'", d.name, d.req))
.collect::<Vec<_>>();
shuttle_deps.sort();
info!(name = member.name, deps = ?shuttle_deps, "Compiled workspace member with shuttle dependencies");
info!(name = member.name, deps = ?shuttle_deps, "Compiling workspace member with shuttle dependencies");
}
if next {
ensure_cdylib(member)?;
Expand Down

0 comments on commit 9a75f16

Please sign in to comment.