Skip to content
Merged
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
13 changes: 13 additions & 0 deletions .github/check-for-naughty-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
echo "Checking for openssl-sys in dependency tree..."
if cargo tree -i openssl-sys >/dev/null 2>&1; then
echo "openssl-sys is present in the dependency tree. Please evict it."
exit 1
fi

echo "Checking for native-tls in dependency tree..."
if cargo tree -i native-tls >/dev/null 2>&1; then
echo "native-tls is present in the dependency tree. Please evict it."
exit 1
fi

echo "✅ No naughty dependencies found"
34 changes: 34 additions & 0 deletions .github/workflows/pr-base-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: PR Base Branch Check

on:
pull_request:
types: [opened, edited, synchronize]

jobs:
check-base-branch:
name: Check PR Base Branch
runs-on: ubuntu-latest
steps:
- name: Check if PR targets main instead of develop
if: github.event.pull_request.base.ref == 'main' && github.event.pull_request.head.ref != 'develop'
uses: actions/github-script@v7
with:
script: |
const message = `⚠️ **WARNING: This PR targets \`main\` instead of \`develop\`**

This PR is targeting \`main\` which will trigger a production deployment when merged.

If this is a regular feature/fix PR, please change the base branch to \`develop\`.
If this is intentional (e.g., hotfix), you can ignore this warning.

Current base: \`${context.payload.pull_request.base.ref}\`
Recommended base: \`develop\``;

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: message
});

core.warning('PR targets main branch - please verify this is intentional');
4 changes: 2 additions & 2 deletions .github/workflows/test-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ jobs:
if: github.ref_name != 'main'
run: >
cargo test --all-features
env:
RUST_LOG: debug

- run: bash .github/check-for-naughty-dependencies.sh

# integration-test:
# runs-on: ${{ matrix.os }}
# strategy:
Expand Down
101 changes: 90 additions & 11 deletions Cargo.lock

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

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resolver = "2"

[workspace.package]
edition = "2021"
version = "0.3.20"
version = "0.3.21-rc.2"
description = "Tower is the best way to host Python data apps in production"
rust-version = "1.81"
authors = ["Brad Heller <brad@tower.dev>"]
Expand All @@ -15,6 +15,7 @@ repository = "https://github.com/tower/tower-cli"
aes-gcm = "0.10"
anyhow = "1.0.95"
async-compression = { version = "0.4", features = ["tokio", "gzip"] }
async_zip = { version = "0.0.16", features = ["tokio", "tokio-fs", "deflate"] }
base64 = "0.22"
bytes = "1"
chrono = { version = "0.4", features = ["serde"] }
Expand All @@ -26,6 +27,7 @@ crypto = { path = "crates/crypto" }
dirs = "5"
futures = "0.3"
futures-util = "0.3"
futures-lite = "2.6"
glob = "0.3"
http = "1.1"
indicatif = "0.17"
Expand Down Expand Up @@ -53,6 +55,7 @@ tower-cmd = { path = "crates/tower-cmd" }
tower-package = { path = "crates/tower-package" }
tower-runtime = { path = "crates/tower-runtime" }
tower-telemetry = { path = "crates/tower-telemetry" }
tower-uv = { path = "crates/tower-uv" }
tracing = { version = "0.1" }
tracing-appender = "0.2"
tracing-subscriber = { version = "0.3", features = ["json", "env-filter"] }
Expand Down
8 changes: 5 additions & 3 deletions crates/tower-cmd/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use tower_package::{Package, PackageSpec};
use tower_runtime::{local::LocalApp, App, AppLauncher, OutputReceiver};
use tower_telemetry::{Context, debug};

use tokio::sync::mpsc::unbounded_channel;

use crate::{
output,
api,
Expand Down Expand Up @@ -133,7 +135,7 @@ async fn do_run_local(config: Config, path: PathBuf, env: &str, mut params: Hash
std::process::exit(1);
}

let (sender, receiver) = tower_runtime::create_output_stream();
let (sender, receiver) = unbounded_channel();

output::success(&format!("Launching app `{}`", towerfile.app.name));
let output_task = tokio::spawn(monitor_output(receiver));
Expand Down Expand Up @@ -342,9 +344,9 @@ async fn build_package(towerfile: &Towerfile) -> Package {

/// monitor_output is a helper function that will monitor the output of a given output channel and
/// plops it down on stdout.
async fn monitor_output(output: OutputReceiver) {
async fn monitor_output(mut output: OutputReceiver) {
loop {
if let Some(line) = output.lock().await.recv().await {
if let Some(line) = output.recv().await {
let ts = &line.time;
let msg = &line.line;
output::log_line(&ts.to_rfc3339(), msg, output::LogLineType::Local);
Expand Down
5 changes: 5 additions & 0 deletions crates/tower-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ license = { workspace = true }
[dependencies]
chrono = { workspace = true }
tokio = { workspace = true }
tokio-util = { workspace = true }
snafu = { workspace = true }
tower-package = { workspace = true }
tower-telemetry = { workspace = true }
tower-uv = { workspace = true }

[dev-dependencies]
config = { workspace = true }
17 changes: 17 additions & 0 deletions crates/tower-runtime/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ pub enum Error {

#[snafu(display("running Tower apps on this platform is not supported"))]
UnsupportedPlatform,

#[snafu(display("cancelled"))]
Cancelled,
}

impl From<std::io::Error> for Error {
Expand All @@ -74,3 +77,17 @@ impl From<std::env::JoinPathsError> for Error {
Error::UnsupportedPlatform
}
}

impl From<tower_uv::Error> for Error {
fn from(err: tower_uv::Error) -> Self {
match err {
tower_uv::Error::IoError(_) => Error::SpawnFailed,
tower_uv::Error::NotFound(_) => Error::SpawnFailed,
tower_uv::Error::PermissionDenied(_) => Error::SpawnFailed,
tower_uv::Error::Other(_) => Error::SpawnFailed,
tower_uv::Error::MissingPyprojectToml => Error::SpawnFailed,
tower_uv::Error::InvalidUv => Error::SpawnFailed,
tower_uv::Error::UnsupportedPlatform => Error::UnsupportedPlatform,
}
}
}
Loading
Loading