Skip to content

Commit

Permalink
fix(ci): make env optional
Browse files Browse the repository at this point in the history
  • Loading branch information
McPatate committed Nov 6, 2023
1 parent 2f9e1a5 commit f160a7b
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 78 deletions.
74 changes: 27 additions & 47 deletions Cargo.lock

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

21 changes: 13 additions & 8 deletions crates/llm-ls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,20 @@ name = "llm-ls"
[dependencies]
home = "0.5"
ropey = "1.6"
reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls"] }
reqwest = { version = "0.11", default-features = false, features = [
"json",
"rustls-tls",
] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokenizers = { version = "0.13", default-features = false, features = ["onig"] }
tokio = { version = "1", features = ["fs", "io-std", "io-util", "macros", "rt-multi-thread"] }
tokenizers = { version = "0.14", default-features = false, features = ["onig"] }
tokio = { version = "1", features = [
"fs",
"io-std",
"io-util",
"macros",
"rt-multi-thread",
] }
tower-lsp = "0.20"
tracing = "0.1"
tracing-appender = "0.2"
Expand Down Expand Up @@ -43,8 +52,4 @@ tree-sitter-typescript = "0.20"

[dependencies.uuid]
version = "1.4"
features = [
"v4",
"fast-rng",
"serde",
]
features = ["v4", "fast-rng", "serde"]
9 changes: 4 additions & 5 deletions crates/testbed/repositories-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,12 @@ repositories:
- README.md
- img.png
build_command: cargo
build_args: ["build", "--all-features"]
build_args: ["build", "--all-features", "--manifest-path", "rust/Cargo.toml"]
language: rust
runner: cargo
runner_extra_args: ["--all-features"]
# this is to avoid skewing the average hole completion time
runner_extra_args: ["--all-features", "--manifest-path", "rust/Cargo.toml"]
setup_commands:
- ["cargo", ["build", "--all-features"]]
- ["cargo", ["build", "--all-features", "--manifest-path", "rust/Cargo.toml"]]
holes_file: lance-smol.json
- source:
type: github
Expand Down Expand Up @@ -238,7 +237,7 @@ repositories:
build_command: cargo
build_args: ["build"]
env:
- RUSTFLAGS=$RUSTFLAGS -A dead_code
- RUSTFLAGS=-A dead_code
language: rust
runner: cargo
runner_extra_args: ["--workspace"]
Expand Down
9 changes: 4 additions & 5 deletions crates/testbed/repositories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,12 @@ repositories:
- README.md
- img.png
build_command: cargo
build_args: ["build", "--all-features"]
build_args: ["build", "--all-features", "--manifest-path", "rust/Cargo.toml"]
language: rust
runner: cargo
runner_extra_args: ["--all-features"]
# this is to avoid skewing the average hole completion time
runner_extra_args: ["--all-features", "--manifest-path", "rust/Cargo.toml"]
setup_commands:
- ["cargo", ["build", "--all-features"]]
- ["cargo", ["build", "--all-features", "--manifest-path", "rust/Cargo.toml"]]
holes_file: lance.json
- source:
type: github
Expand Down Expand Up @@ -238,7 +237,7 @@ repositories:
build_command: cargo
build_args: ["build"]
env:
- RUSTFLAGS=$RUSTFLAGS -A dead_code
- RUSTFLAGS=-A dead_code
language: rust
runner: cargo
runner_extra_args: ["--workspace"]
Expand Down
24 changes: 13 additions & 11 deletions crates/testbed/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl RepoSource {
struct Repository {
build_command: String,
build_args: Vec<String>,
env: Vec<String>,
env: Option<Vec<String>>,
holes_file: String,
language: Language,
runner: Runner,
Expand Down Expand Up @@ -314,21 +314,23 @@ async fn setup_repo_dir(
}
}

fn parse_env(env: &Vec<String>) -> anyhow::Result<Vec<(String, String)>> {
let mut env_vars = Vec::with_capacity(env.len());
for var in env {
env_vars.push(
var.split_once('=')
.map(|(n, v)| (n.to_owned(), v.to_owned()))
.ok_or(anyhow!("failed to split env var {var}"))?,
);
fn parse_env(env: &Option<Vec<String>>) -> anyhow::Result<Vec<(String, String)>> {
let mut env_vars = vec![];
if let Some(env) = env {
for var in env {
env_vars.push(
var.split_once('=')
.map(|(n, v)| (n.to_owned(), v.to_owned()))
.ok_or(anyhow!("failed to split env var {var}"))?,
);
}
}
Ok(env_vars)
}

async fn run_setup(
commands: &Vec<(String, Vec<String>)>,
env: &Vec<String>,
env: &Option<Vec<String>>,
repo_path: impl AsRef<Path>,
) -> anyhow::Result<()> {
let parsed_env = parse_env(env)?;
Expand Down Expand Up @@ -360,7 +362,7 @@ async fn run_setup(
async fn build(
command: &str,
args: &Vec<String>,
env: &Vec<String>,
env: &Option<Vec<String>>,
repo_path: impl AsRef<Path>,
) -> anyhow::Result<bool> {
let parsed_env = parse_env(env)?;
Expand Down
4 changes: 2 additions & 2 deletions crates/testbed/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ async fn pytest_runner(
async fn cargo_runner(
override_cmd: &Option<String>,
extra_args: &mut Vec<String>,
env: &Vec<String>,
env: &Option<Vec<String>>,
repo_path: &Path,
) -> anyhow::Result<f32> {
let cmd = if let Some(cmd) = override_cmd {
Expand Down Expand Up @@ -261,7 +261,7 @@ pub async fn run_test(
override_cmd: &Option<String>,
override_args: &Option<Vec<String>>,
extra_args: &mut Vec<String>,
env: &Vec<String>,
env: &Option<Vec<String>>,
repo_path: &Path,
) -> anyhow::Result<f32> {
match runner {
Expand Down

0 comments on commit f160a7b

Please sign in to comment.