mirror of
https://github.com/storytold/deckcraft.git
synced 2026-11-13 01:15:56 -06:00
Merge pull request #2096 from storytold/codex/sonar-font-pin
ci: provide fonts to Sonar coverage tests
This commit is contained in:
@@ -18,4 +18,7 @@ jobs:
|
||||
sonarcloud:
|
||||
# Tracked at @main so org-wide CI improvements propagate without PR churn.
|
||||
uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@main
|
||||
with:
|
||||
# Keep coverage tests on the same reviewed, immutable font set as the main gate.
|
||||
fonts-ref: 37827adc41fd165f9a9234ac40f94dbad353aa69
|
||||
secrets: inherit
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::process::{Command, Output};
|
||||
|
||||
fn cli(args: &[&str]) -> Output {
|
||||
Command::new(env!("CARGO_BIN_EXE_deckcraft-cli")).args(args).output().unwrap()
|
||||
Command::new(crate::deckcraft_cli()).args(args).output().unwrap()
|
||||
}
|
||||
|
||||
fn stdout(o: &Output) -> String {
|
||||
@@ -197,7 +197,7 @@ fn every_subcommand_answers_help_and_does_nothing_else() {
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
for sub in SUBCOMMANDS {
|
||||
for args in [vec![sub, "--help"], vec![sub, "-h", "out.png"], vec!["help", sub]] {
|
||||
let o = Command::new(env!("CARGO_BIN_EXE_deckcraft-cli")).current_dir(&dir).args(&args).output().unwrap();
|
||||
let o = Command::new(crate::deckcraft_cli()).current_dir(&dir).args(&args).output().unwrap();
|
||||
assert!(stdout(&o).starts_with(&format!("usage: deckcraft-cli {sub}")), "{args:?}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ fn closed_stdout() -> Stdio {
|
||||
}
|
||||
|
||||
fn run(dir: &Path, args: &[&str], stdout: Stdio) -> Output {
|
||||
Command::new(env!("CARGO_BIN_EXE_deckcraft-cli")).current_dir(dir).args(args).stdout(stdout).stderr(Stdio::piped()).output().unwrap()
|
||||
Command::new(crate::deckcraft_cli()).current_dir(dir).args(args).stdout(stdout).stderr(Stdio::piped()).output().unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -52,7 +52,7 @@ fn broken_pipe_does_not_skip_later_commands_or_save() {
|
||||
assert!(out.status.success(), "exit {:?}: {}", out.status, String::from_utf8_lossy(&out.stderr));
|
||||
let saved = dir.0.join("out.deckcraft");
|
||||
assert!(saved.is_file(), "requested save was skipped");
|
||||
let info = Command::new(env!("CARGO_BIN_EXE_deckcraft-cli")).arg("info").arg(saved).output().unwrap();
|
||||
let info = Command::new(crate::deckcraft_cli()).arg("info").arg(saved).output().unwrap();
|
||||
assert!(info.status.success(), "{}", String::from_utf8_lossy(&info.stderr));
|
||||
let data: serde_json::Value = serde_json::from_slice(&info.stdout).unwrap();
|
||||
let slides = data["slides"].as_array().unwrap();
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::path::{Path, PathBuf};
|
||||
use std::process::{Command, Output};
|
||||
|
||||
fn cli(args: &[&Path]) -> Output {
|
||||
Command::new(env!("CARGO_BIN_EXE_deckcraft-cli")).args(args).output().unwrap()
|
||||
Command::new(crate::deckcraft_cli()).args(args).output().unwrap()
|
||||
}
|
||||
|
||||
fn temp_dir(name: &str) -> PathBuf {
|
||||
@@ -18,7 +18,7 @@ fn temp_dir(name: &str) -> PathBuf {
|
||||
fn convert_rejects_output_formats_it_cannot_write() {
|
||||
let dir = temp_dir("convert-unsupported");
|
||||
let input = dir.join("in.pptx");
|
||||
let out = Command::new(env!("CARGO_BIN_EXE_deckcraft-cli")).args(["run", "--sample", "--export"]).arg(&input).output().unwrap();
|
||||
let out = Command::new(crate::deckcraft_cli()).args(["run", "--sample", "--export"]).arg(&input).output().unwrap();
|
||||
assert!(out.status.success(), "{}", String::from_utf8_lossy(&out.stderr));
|
||||
|
||||
for name in ["out.odp", "out.bmp", "out.svg", "out.outline", "out"] {
|
||||
@@ -48,7 +48,7 @@ fn run_rejects_unsupported_save_and_export_paths_before_running() {
|
||||
let dir = temp_dir("run-unsupported");
|
||||
for flag in ["--save", "--export"] {
|
||||
let target = dir.join("deck.odp");
|
||||
let out = Command::new(env!("CARGO_BIN_EXE_deckcraft-cli")).args(["run", "--sample", flag]).arg(&target).output().unwrap();
|
||||
let out = Command::new(crate::deckcraft_cli()).args(["run", "--sample", flag]).arg(&target).output().unwrap();
|
||||
assert!(!out.status.success(), "{flag}: run should fail");
|
||||
assert!(String::from_utf8_lossy(&out.stderr).contains("unsupported output format .odp"), "{flag}");
|
||||
assert!(!target.exists(), "{flag}: nothing is written");
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::path::PathBuf;
|
||||
use std::process::{Command, Output};
|
||||
|
||||
fn cli(args: &[&str]) -> Output {
|
||||
Command::new(env!("CARGO_BIN_EXE_deckcraft-cli")).args(args).output().unwrap()
|
||||
Command::new(crate::deckcraft_cli()).args(args).output().unwrap()
|
||||
}
|
||||
|
||||
fn temp_dir(name: &str) -> PathBuf {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use std::ffi::OsString;
|
||||
|
||||
mod cli;
|
||||
#[cfg(unix)]
|
||||
mod closed_stdout;
|
||||
@@ -6,3 +8,7 @@ mod damaged;
|
||||
// Integration tests: unwrapping and panicking on failure is fine here, unlike in shipped code (AGENTS.md).
|
||||
#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
||||
mod mcp_roots;
|
||||
|
||||
fn deckcraft_cli() -> OsString {
|
||||
std::env::var_os("NEXTEST_BIN_EXE_deckcraft_cli").unwrap_or_else(|| env!("CARGO_BIN_EXE_deckcraft-cli").into())
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::process::{Command, Output, Stdio};
|
||||
use serde_json::Value;
|
||||
|
||||
fn bin() -> Command {
|
||||
Command::new(env!("CARGO_BIN_EXE_deckcraft-cli"))
|
||||
Command::new(crate::deckcraft_cli())
|
||||
}
|
||||
|
||||
fn run(args: &[&str]) -> Output {
|
||||
|
||||
@@ -251,10 +251,7 @@ pub fn sidecar_part(name: &str) -> bool {
|
||||
let file = segs.last().copied().unwrap_or("");
|
||||
let stem = file.strip_prefix("chart").unwrap_or("");
|
||||
let num = stem.strip_suffix(".xml.rels").or_else(|| stem.strip_suffix(".xml")).unwrap_or("");
|
||||
if stem != file && !num.is_empty() && num.chars().all(|c| c.is_ascii_digit()) {
|
||||
return false;
|
||||
}
|
||||
true
|
||||
!(stem != file && !num.is_empty() && num.chars().all(|c| c.is_ascii_digit()))
|
||||
}
|
||||
|
||||
pub fn dir_of(part: &str) -> String {
|
||||
|
||||
Reference in New Issue
Block a user