From 7b0b97789cb8adb9380f238ed9f217f60b12b46e Mon Sep 17 00:00:00 2001 From: shannmu Date: Tue, 10 Sep 2024 13:45:25 +0800 Subject: [PATCH] ci: Install `zsh`, `fish` and `elvish` on ubuntu-lastest for the `test` and `test_gitoxide` jobs --- .github/workflows/main.yml | 8 ++++++++ tests/testsuite/shell_completions.rs | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 893c87124e4..478b164d89b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -173,6 +173,13 @@ jobs: - run: rustup target add ${{ matrix.other }} - run: rustup component add rustc-dev llvm-tools-preview rust-docs if: startsWith(matrix.rust, 'nightly') + # Install fish, zsh, and elvish only on Ubuntu systems + - name: Install fish, zsh, and elvish on Ubuntu + run: sudo apt update -y && sudo apt install fish zsh elvish -y + if: matrix.os == 'ubuntu-latest' + - name: Install fish, elvish on macOS + run: brew install fish elvish + if: matrix.os == 'macos-14' || matrix.os == 'macos-13' - run: sudo apt update -y && sudo apt install lldb gcc-multilib libsecret-1-0 libsecret-1-dev -y if: matrix.os == 'ubuntu-latest' - run: rustup component add rustfmt || echo "rustfmt not available" @@ -227,6 +234,7 @@ jobs: - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add i686-unknown-linux-gnu - run: sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y + - run: sudo apt update -y && sudo apt install fish zsh elvish -y - run: rustup component add rustfmt || echo "rustfmt not available" - run: cargo test -p cargo env: diff --git a/tests/testsuite/shell_completions.rs b/tests/testsuite/shell_completions.rs index a6802213a25..6973038f065 100644 --- a/tests/testsuite/shell_completions.rs +++ b/tests/testsuite/shell_completions.rs @@ -6,6 +6,11 @@ use snapbox::assert_data_eq; #[cargo_test] fn bash() { + // HACK: At least on CI, bash is not working on macOS + if cfg!(target_os = "macos") { + return; + } + let input = "cargo \t\t"; let expected = snapbox::str![ "% @@ -26,10 +31,15 @@ fn bash() { #[cargo_test] fn elvish() { + // HACK: At least on CI, elvish is not working on macOS + if cfg!(target_os = "macos") { + return; + } + let input = "cargo \t\t"; let expected = snapbox::str![ "% cargo --config -_COMPLETING argument + COMPLETING argument --color --version check install read-manifest update --config -C clean locate-project remove vendor --explain -V config login report verify-project @@ -47,6 +57,11 @@ _COMPLETING argument #[cargo_test] fn fish() { + // HACK: At least on CI, fish is not working on macOS + if cfg!(target_os = "macos") { + return; + } + let input = "cargo \t\t"; let expected = snapbox::str![ "% cargo