Skip to content

Commit 8323dd6

Browse files
authored
Run windows on ci (#150)
**Stack**: - #152 - #151 - #150 ⬅ - #149 ⚠️ *Part of a stack created by [spr](https://github.com/ejoffe/spr). Do not merge manually using the UI - doing so may have unexpected results.*
1 parent 34843ec commit 8323dd6

File tree

5 files changed

+77
-12
lines changed

5 files changed

+77
-12
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ on:
99
jobs:
1010
tests:
1111
name: Tests
12-
runs-on: ubuntu-latest
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ ubuntu-latest, windows-latest ]
1316
steps:
1417
- uses: actions/checkout@v4
1518
- uses: dtolnay/rust-toolchain@stable
1619
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3
17-
- uses: hrishikesh-kadam/setup-lcov@v1
20+
- uses: hrishikesh-kadam/setup-lcov@6c1aa0cc9e1c02f9f58f01ac599f1064ccc83470 # v1.1.0
1821
- uses: software-mansion/setup-scarb@v1
19-
- uses: foundry-rs/setup-snfoundry@v3
22+
- uses: foundry-rs/setup-snfoundry@v4
2023
- run: cargo test --release
2124

2225
rustfmt:

Cargo.lock

Lines changed: 54 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ indoc = "2.0.5"
3030
regex = "1.11.1"
3131
rayon = "1.10.0"
3232
walkdir = "2.5.0"
33+
which = "7.0.2"

crates/cairo-coverage/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ walkdir.workspace = true
1414
[dev-dependencies]
1515
cairo-coverage-test-utils = { path = "../cairo-coverage-test-utils" }
1616
assert_fs.workspace = true
17-
snapbox.workspace = true
17+
snapbox.workspace = true
18+
which.workspace = true

crates/cairo-coverage/tests/helpers/test_project.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use camino::Utf8PathBuf;
55
use snapbox::cmd::{cargo_bin, Command as SnapboxCommand};
66
use std::fs;
77
use std::path::PathBuf;
8+
use which::which;
89

910
pub struct TestProject {
1011
dir: TempDir,
@@ -92,7 +93,9 @@ impl TestProject {
9293
}
9394

9495
fn run_genhtml(self) -> Self {
95-
SnapboxCommand::new("genhtml")
96+
// on windows, we need to use the full path to genhtml or otherwise this will fail
97+
let path = which("genhtml").unwrap();
98+
SnapboxCommand::new(path)
9699
.arg(self.output_lcov_path())
97100
.arg("--output-directory")
98101
.arg(self.dir.path())
@@ -114,6 +117,16 @@ impl TestProjectOutput {
114117
"{dir}",
115118
&self.0.dir.canonicalize().unwrap().display().to_string(),
116119
);
120+
121+
let expected = if cfg!(target_os = "windows") {
122+
expected
123+
.replace("\r\n", "\n") // Normalize line endings
124+
.replace('/', r"\") // Convert Unix-style paths to Windows
125+
.replace(r"\\?\", "") // Remove extended path prefix
126+
} else {
127+
expected
128+
};
129+
117130
assert_eq!(content, expected);
118131
}
119132

0 commit comments

Comments
 (0)