From 621ab6078f7a0f980e55565a6e199c08f28e0de2 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Thu, 18 Aug 2022 10:20:31 +0200 Subject: [PATCH] CI: Check MSRV without git feature enabled git2-rs MSRV policy is to only support latest stable rust (see https://github.com/rust-lang/git2-rs#rust-version-requirements), so it does not make sense to run our MSRV tests with git enabled. --- .github/workflows/CICD.yml | 6 ++++-- tests/integration_tests.rs | 3 +++ tests/snapshot_tests.rs | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 97c2348f..39e12d8d 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -39,6 +39,8 @@ jobs: min_version: name: Minimum supported rust version runs-on: ubuntu-20.04 + env: + MSRV_FEATURES: --no-default-features --features minimal-application,bugreport,build-assets steps: - name: Checkout source code uses: actions/checkout@v2 @@ -54,12 +56,12 @@ jobs: uses: actions-rs/cargo@v1 with: command: clippy - args: --locked --all-targets --all-features + args: --locked --all-targets ${{ env.MSRV_FEATURES }} - name: Run tests uses: actions-rs/cargo@v1 with: command: test - args: --locked + args: --locked ${{ env.MSRV_FEATURES }} test_with_new_syntaxes_and_themes: name: Run tests with updated syntaxes and themes diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index c4743bcd..4d8e83f7 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -987,6 +987,7 @@ fn header_full_binary() { } #[test] +#[cfg(feature = "git")] // Expected output assumes git is enabled fn header_default() { bat() .arg("--paging=never") @@ -1011,6 +1012,7 @@ fn header_default() { } #[test] +#[cfg(feature = "git")] // Expected output assumes git is enabled fn header_default_is_default() { bat() .arg("--paging=never") @@ -1373,6 +1375,7 @@ fn plain_mode_does_not_add_nonexisting_newline() { // Regression test for https://github.com/sharkdp/bat/issues/299 #[test] +#[cfg(feature = "git")] // Expected output assumes git is enabled fn grid_for_file_without_newline() { bat() .arg("--paging=never") diff --git a/tests/snapshot_tests.rs b/tests/snapshot_tests.rs index 14c3eee1..a68e74e2 100644 --- a/tests/snapshot_tests.rs +++ b/tests/snapshot_tests.rs @@ -1,13 +1,13 @@ +#[cfg(feature = "git")] mod tester; -use crate::tester::BatTester; - macro_rules! snapshot_tests { ($($test_name: ident: $style: expr,)*) => { $( #[test] + #[cfg(feature = "git")] fn $test_name() { - let bat_tester = BatTester::default(); + let bat_tester = tester::BatTester::default(); bat_tester.test_snapshot(stringify!($test_name), $style); } )*