Skip to content

Commit

Permalink
test: fix invalid deserialization (#85)
Browse files Browse the repository at this point in the history
* test: fix invalid deserialization

* feat: install node or python only when needed

* feat: when action is rerun, run testbed with logs in debug

* feat(ci): update actions to node 20

* feat: log stdout & stderr from setup & build cmd as debug

* fix: bump helix revision

* fix: use helix fork for the time being

* fix(ci): install missing setuptools

* fix(ci): revert back to python 3.10

* fix(ci): disable lance
  • Loading branch information
McPatate authored Feb 19, 2024
1 parent 0d03590 commit 386ed53
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 53 deletions.
71 changes: 38 additions & 33 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ jobs:
strategy:
matrix:
repo:
- { name: simple, key: simple, parallel: 8 }
- { name: mmaitre314/picklescan, key: picklescan, parallel: 8 }
- { name: huggingface/huggingface_hub, key: huggingface_hub, parallel: 8 }
- { name: tiangolo/fastapi, key: fastapi, parallel: 8 }
- { name: encode/starlette, key: starlette, parallel: 8 }
- { name: lancedb/lancedb, key: lancedb, parallel: 2 }
- { name: lancedb/lance, key: lance, parallel: 2 }
- { name: tkaitchuck/constrandom, key: constrandom, parallel: 8 }
- { name: jaemk/cached, key: cached, parallel: 4 }
- { name: smol-rs/async-executor, key: async-executor, parallel: 4 }
- { name: gcanti/io-ts, key: io-ts, parallel: 8 }
- { name: colinhacks/zod, key: zod, parallel: 8 }
- { name: helix-editor/helix, key: helix, parallel: 2 }
- { name: simple, key: simple, parallel: 8, node: false, python: false }
- { name: mmaitre314/picklescan, key: picklescan, parallel: 8, node: false, python: true }
- { name: huggingface/huggingface_hub, key: huggingface_hub, parallel: 8, node: false, python: true }
- { name: tiangolo/fastapi, key: fastapi, parallel: 8, node: false, python: true }
- { name: encode/starlette, key: starlette, parallel: 8, node: false, python: true }
- { name: lancedb/lancedb, key: lancedb, parallel: 2, node: false, python: false }
# - { name: lancedb/lance, key: lance, parallel: 2, node: false, python: false }
- { name: tkaitchuck/constrandom, key: constrandom, parallel: 8, node: false, python: false }
- { name: jaemk/cached, key: cached, parallel: 4, node: false, python: false }
- { name: smol-rs/async-executor, key: async-executor, parallel: 4, node: false, python: false }
- { name: gcanti/io-ts, key: io-ts, parallel: 8, node: true, python: false }
- { name: colinhacks/zod, key: zod, parallel: 8, node: true, python: false }
- { name: helix-editor/helix, key: helix, parallel: 2, node: false, python: false }
runs-on: [self-hosted, intel-cpu, 8-cpu, ci]
container:
image: ubuntu:22.04
Expand All @@ -46,21 +46,24 @@ jobs:
toolchain: nightly

- name: Install Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
if: matrix.repo.python
with:
python-version: '3.10'

- name: Install node 18
uses: actions/setup-node@v3
uses: actions/setup-node@v4
if: matrix.repo.node
with:
node-version: 18

- name: Install yarn
if: matrix.repo.node
run: |
npm i -g yarn
- name: Set up cargo cache
uses: actions/cache@v3
uses: actions/cache@v4
continue-on-error: false
with:
path: |
Expand All @@ -80,15 +83,17 @@ jobs:
if: github.event_name == 'push' || github.event_name == 'pull_request'
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
LOG_LEVEL: ${{ github.run_attempt > 1 && 'debug' || 'info' }}

- name: Run testbed
run: 'cargo run --bin testbed -r -- --api-token $API_TOKEN -f ${{ matrix.repo.name }} -p ${{ matrix.repo.parallel }}'
if: github.event_name == 'workflow_dispatch'
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
LOG_LEVEL: ${{ github.run_attempt > 1 && 'debug' || 'info' }}

- name: Upload artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: results-${{ matrix.repo.key }}
path: ./results.json
Expand All @@ -104,67 +109,67 @@ jobs:
apt update
apt install -y jq
- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v4
with:
name: results-simple
path: results-simple

- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v4
with:
name: results-picklescan
path: results-picklescan

- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v4
with:
name: results-huggingface_hub
path: results-huggingface_hub

- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v4
with:
name: results-fastapi
path: results-fastapi

- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v4
with:
name: results-starlette
path: results-starlette

- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v4
with:
name: results-lancedb
path: results-lancedb

- uses: actions/download-artifact@v1
with:
name: results-lance
path: results-lance
# - uses: actions/download-artifact@v4
# with:
# name: results-lance
# path: results-lance

- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v4
with:
name: results-constrandom
path: results-constrandom

- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v4
with:
name: results-cached
path: results-cached

- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v4
with:
name: results-async-executor
path: results-async-executor

- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v4
with:
name: results-io-ts
path: results-io-ts

- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v4
with:
name: results-zod
path: results-zod

- uses: actions/download-artifact@v1
- uses: actions/download-artifact@v4
with:
name: results-helix
path: results-helix
Expand Down
1 change: 0 additions & 1 deletion crates/lsp-client/src/msg.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::{
fmt::{self, Display},
io,
marker::Unpin,
};

use serde::{de::DeserializeOwned, Deserialize, Serialize};
Expand Down
6 changes: 3 additions & 3 deletions crates/testbed/repositories-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ repositories:
type: github
owner: mmaitre314
name: picklescan
revision: 40001cd1caa9e041b1bce1b80f3707056cd8be52
revision: 108b06040de644c7aeb5f22d8b10dd9c5d282386
src_path: src/picklescan
build_command: picklescan-venv/bin/python3
build_args: ["-m", "compileall", "-q", "."]
Expand Down Expand Up @@ -201,9 +201,9 @@ repositories:
holes_file: zod-smol.json
- source:
type: github
owner: helix-editor
owner: McPatate
name: helix
revision: a1272bdb17a63361342a318982e46129d558743c
revision: 01c1ebebd813c9034059a966fae2bbc487b1a69f
exclude_paths:
- .cargo
- .github
Expand Down
6 changes: 3 additions & 3 deletions crates/testbed/repositories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ repositories:
type: github
owner: mmaitre314
name: picklescan
revision: 40001cd1caa9e041b1bce1b80f3707056cd8be52
revision: 108b06040de644c7aeb5f22d8b10dd9c5d282386
src_path: src/picklescan
build_command: picklescan-venv/bin/python3
build_args: ["-m", "compileall", "-q", "."]
Expand Down Expand Up @@ -201,9 +201,9 @@ repositories:
holes_file: zod.json
- source:
type: github
owner: helix-editor
owner: McPatate
name: helix
revision: a1272bdb17a63361342a318982e46129d558743c
revision: 01c1ebebd813c9034059a966fae2bbc487b1a69f
exclude_paths:
- .cargo
- .github
Expand Down
50 changes: 37 additions & 13 deletions crates/testbed/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ use serde_json::{Map, Value};
use tempfile::TempDir;
use tokio::{
fs::{self, read_to_string, File, OpenOptions},
io::{self, AsyncReadExt, AsyncWriteExt},
io::{
self, AsyncBufRead, AsyncBufReadExt, AsyncReadExt, AsyncWriteExt,
BufReader as TokioBufReader,
},
join,
process::Command,
sync::{OnceCell, RwLock, Semaphore},
};
Expand Down Expand Up @@ -198,6 +202,7 @@ struct RepositoriesConfig {
context_window: usize,
fim: FimParams,
model: String,
#[serde(flatten)]
backend: Backend,
repositories: Vec<Repository>,
tls_skip_verify_insecure: bool,
Expand Down Expand Up @@ -400,15 +405,20 @@ async fn run_setup(
command.0,
command.1.join(" ")
);
let status = status_cmd
let mut child = status_cmd
.args(&command.1)
.current_dir(&repo_path)
.stdout(Stdio::null())
.stderr(Stdio::null())
.spawn()?
.wait()
.await?;
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.spawn()?;

if let (Some(stdout), Some(stderr)) = (child.stdout.take(), child.stderr.take()) {
let stdout = TokioBufReader::new(stdout);
let stderr = TokioBufReader::new(stderr);
join!(log_lines(stdout), log_lines(stderr));
}

let status = child.wait().await?;
if !status.success() {
return Err(anyhow!(
"error running: \"{} {}\"",
Expand All @@ -432,17 +442,31 @@ async fn build(
status_cmd.env(name, value);
}
debug!("building repo: {command} {args:?}");
let status = status_cmd

let mut child = status_cmd
.args(args)
.current_dir(repo_path)
.stdout(Stdio::null())
.stderr(Stdio::null())
.spawn()?
.wait()
.await?;
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.spawn()?;

if let (Some(stdout), Some(stderr)) = (child.stdout.take(), child.stderr.take()) {
let stdout = TokioBufReader::new(stdout);
let stderr = TokioBufReader::new(stderr);
join!(log_lines(stdout), log_lines(stderr));
}

let status = child.wait().await?;
Ok(status.success())
}

async fn log_lines<R: AsyncReadExt + AsyncBufRead + Unpin>(stdio: R) {
let mut lines = stdio.lines();
while let Ok(Some(log)) = lines.next_line().await {
debug!("{log}");
}
}

#[allow(clippy::too_many_arguments)]
async fn complete_holes(
hole: Hole,
Expand Down

0 comments on commit 386ed53

Please sign in to comment.