From 9dd1679e5a150a71df6307984178be711b204502 Mon Sep 17 00:00:00 2001 From: Ajeet D'Souza <98ajeet@gmail.com> Date: Tue, 27 Oct 2020 01:25:02 +0530 Subject: [PATCH] Run CI on Windows --- .github/workflows/cargo-audit.yml | 5 ++++- .github/workflows/cargo-clippy.yml | 5 ++++- .github/workflows/cargo-test.yml | 15 ++++++++++++++- .github/workflows/cargo-udeps.yml | 5 ++++- Cargo.toml | 2 +- src/shell.rs | 1 + src/store/mod.rs | 12 ++++++++++-- 7 files changed, 38 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cargo-audit.yml b/.github/workflows/cargo-audit.yml index 02d35de..dcd8383 100644 --- a/.github/workflows/cargo-audit.yml +++ b/.github/workflows/cargo-audit.yml @@ -11,7 +11,10 @@ on: jobs: audit: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v2 - uses: actions-rs/audit-check@v1 diff --git a/.github/workflows/cargo-clippy.yml b/.github/workflows/cargo-clippy.yml index b0ee9bb..bd271ff 100644 --- a/.github/workflows/cargo-clippy.yml +++ b/.github/workflows/cargo-clippy.yml @@ -6,7 +6,10 @@ on: jobs: clippy: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 diff --git a/.github/workflows/cargo-test.yml b/.github/workflows/cargo-test.yml index 61d6996..e1798be 100644 --- a/.github/workflows/cargo-test.yml +++ b/.github/workflows/cargo-test.yml @@ -5,7 +5,7 @@ on: pull_request: jobs: - test: + test-linux: runs-on: ubuntu-18.04 steps: - run: sudo apt update @@ -26,3 +26,16 @@ jobs: with: command: test args: --all-features --no-fail-fast + test-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + args: --all-features --no-fail-fast diff --git a/.github/workflows/cargo-udeps.yml b/.github/workflows/cargo-udeps.yml index 0366207..9888bc9 100644 --- a/.github/workflows/cargo-udeps.yml +++ b/.github/workflows/cargo-udeps.yml @@ -6,7 +6,10 @@ on: jobs: udeps: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 diff --git a/Cargo.toml b/Cargo.toml index a6b6f84..0b3090e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ tempfile = "3.1.0" [target.'cfg(windows)'.dependencies] rand = "0.7.3" -[dev-dependencies] +[target.'cfg(unix)'.dev-dependencies] assert_cmd = "1.0.1" [profile.release] diff --git a/src/shell.rs b/src/shell.rs index 63868a7..481081e 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -41,6 +41,7 @@ pub enum Hook { Pwd, } +#[cfg(unix)] #[cfg(test)] mod tests { use super::*; diff --git a/src/store/mod.rs b/src/store/mod.rs index afadd9b..3878d2e 100644 --- a/src/store/mod.rs +++ b/src/store/mod.rs @@ -246,7 +246,11 @@ mod tests { #[test] fn test_add() { - let path = "/foo/bar"; + let path = if cfg!(windows) { + r"C:\foo\bar" + } else { + "/foo/bar" + }; let now = 946684800; let data_dir = tempfile::tempdir().unwrap(); @@ -267,7 +271,11 @@ mod tests { #[test] fn test_remove() { - let path = "/foo/bar"; + let path = if cfg!(windows) { + r"C:\foo\bar" + } else { + "/foo/bar" + }; let now = 946684800; let data_dir = tempfile::tempdir().unwrap();