Skip to content

Commit 7454a02

Browse files
committed
refactor: run tests in CI with different temporary directory
Signed-off-by: James Rhodes <jarhodes314@gmail.com>
1 parent bea5cb8 commit 7454a02

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.github/workflows/build-workflow.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,13 @@ jobs:
7474
- name: cargo install cargo-llvm-cov
7575
uses: taiki-e/install-action@cargo-llvm-cov
7676

77+
- name: Create dir for temporary files
78+
run: sudo mkdir /mnt/test-tmp && sudo chmod 777 /mnt/test-tmp
79+
7780
- name: cargo llvm-cov
7881
run: cargo llvm-cov nextest --no-fail-fast --locked --all-features --all-targets --codecov --output-path codecov.json
82+
env:
83+
TEMP_DIR_ROOT: /mnt/test-tmp
7984

8085
# https://github.com/rust-lang/cargo/issues/6669
8186
- name: cargo test --doc

crates/tests/tedge_test_utils/src/fs.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ pub struct TempTedgeFile {
2121

2222
impl Default for TempTedgeDir {
2323
fn default() -> Self {
24-
let temp_dir = TempDir::new().unwrap();
24+
let temp_dir = if let Ok(dir) = std::env::var("TEMP_DIR_ROOT") {
25+
TempDir::new_in(dir).unwrap()
26+
} else {
27+
TempDir::new().unwrap()
28+
};
2529
let current_file_path = Utf8Path::from_path(temp_dir.path()).unwrap().to_owned();
2630
TempTedgeDir {
2731
temp_dir: Arc::new(temp_dir),

0 commit comments

Comments
 (0)