diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 93110279..4892e0b9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -329,9 +329,17 @@ jobs: # Test release binary on a variety of OS platforms. os-tests: - name: "OS tests" + strategy: + fail-fast: false + matrix: + include: + - container: "fedora:latest" + description: "Fedora [latest]" + prereqs_command: "dnf install -y bash-completion iputils grep less sed" + + name: "OS tests (${{ matrix.description }})" runs-on: ubuntu-latest - container: fedora:latest + container: ${{ matrix.container }} needs: build steps: # Checkout sources for YAML-based test cases @@ -356,16 +364,20 @@ jobs: run: | set -euxo pipefail chmod +x binaries/* + ls -l -R sources/brush-shell/tests ls -l binaries - name: Install prerequisites - run: dnf install -y bash-completion + if: ${{ matrix.prereqs_command != '' }} + run: ${{ matrix.prereqs_command }} - name: Run tests run: | - export CARGO_TARGET_DIR=binaries - export CARGO_BIN_EXE_brush=binaries/brush - export CARGO_MANIFEST_DIR=sources/brush-shell + export CARGO_TARGET_DIR=$PWD/binaries + export CARGO_BIN_EXE_brush=$PWD/binaries/brush + export CARGO_MANIFEST_DIR=$PWD/sources/brush-shell + + export BRUSH_VERBOSE=true result=0 for test_name in binaries/*tests*; do diff --git a/brush-shell/Cargo.toml b/brush-shell/Cargo.toml index f4a44f7a..8dbd52b4 100644 --- a/brush-shell/Cargo.toml +++ b/brush-shell/Cargo.toml @@ -42,7 +42,7 @@ async-trait = "0.1.83" brush-parser = { version = "^0.2.9", path = "../brush-parser" } brush-core = { version = "^0.2.11", path = "../brush-core" } cfg-if = "1.0.0" -clap = { version = "4.5.17", features = ["derive", "wrap_help"] } +clap = { version = "4.5.17", features = ["derive", "env", "wrap_help"] } const_format = "0.2.33" git-version = "0.3.9" lazy_static = "1.5.0" diff --git a/brush-shell/tests/compat_tests.rs b/brush-shell/tests/compat_tests.rs index 78bd7e26..4227e19c 100644 --- a/brush-shell/tests/compat_tests.rs +++ b/brush-shell/tests/compat_tests.rs @@ -112,8 +112,14 @@ async fn cli_integration_tests(options: TestOptions) -> Result<()> { test_configs.push(TestConfig::for_sh_testing(&options)?); } + let glob_pattern = format!("{dir}/tests/cases/**/*.yaml"); + + if options.verbose { + eprintln!("Running tests cases: {glob_pattern}"); + } + // Spawn each test case set separately. - for entry in glob::glob(format!("{dir}/tests/cases/**/*.yaml").as_ref()).unwrap() { + for entry in glob::glob(glob_pattern.as_ref()).unwrap() { let entry = entry.unwrap(); let yaml_file = std::fs::File::open(entry.as_path())?; @@ -1282,7 +1288,7 @@ struct TestOptions { pub display_known_failure_details: bool, /// Display details regarding successful test cases - #[clap(short = 'v', long = "verbose")] + #[clap(short = 'v', long = "verbose", env = "BRUSH_VERBOSE")] pub verbose: bool, /// Enable a specific configuration