From 94a0e3060a55a98dfc2d083913c93f0c06dfb034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=BD=C3=A1dn=C3=ADk?= Date: Sat, 12 Feb 2022 22:48:17 +0200 Subject: [PATCH] Update CI (#4445) * Add different features combinations * Specify styles manually * Fix args * Fix typo * Let other CI jobs finish if one fails * Fix unused symbols without plugin feature * Put "which" tests behind "which" feature * Add Python virtualenv job * Oops forgot git command * Install Nushell in virtualenv tests * Add names to steps; Test v.env in separate step * cd into virtualenv * Do not run on Python 2.7 * Build Nushell after formatting and clippy checks --- .github/workflows/ci.yml | 89 +++++++++++++++++++++---- crates/nu-command/tests/commands/mod.rs | 1 + src/config_files.rs | 4 +- 3 files changed, 80 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b3a066fc..239cecced 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,38 +5,101 @@ name: Continuous integration jobs: ci: strategy: + fail-fast: false matrix: platform: [ubuntu-latest, macos-latest, windows-latest] + style: [minimal, default, all] rust: - stable + include: + - style: minimal + flags: '--no-default-features' + - style: default + flags: '' + - style: all + flags: '--all-features' runs-on: ${{ matrix.platform }} steps: - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - name: Setup Rust toolchain + uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: ${{ matrix.rust }} override: true components: rustfmt, clippy - - uses: actions-rs/cargo@v1 - with: - command: build - - - uses: actions-rs/cargo@v1 - with: - command: test - args: --all --all-features - - - uses: actions-rs/cargo@v1 + - name: Rustfmt + uses: actions-rs/cargo@v1 with: command: fmt args: --all -- --check - - uses: actions-rs/cargo@v1 + - name: Clippy + uses: actions-rs/cargo@v1 with: command: clippy - args: --all --all-features -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect + args: --all ${{ matrix.flags }} -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect + + - name: Build Nushell + uses: actions-rs/cargo@v1 + with: + command: build + args: ${{ matrix.flags }} + + - name: Tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --all ${{ matrix.flags }} + + + python-virtualenv: + strategy: + fail-fast: false + matrix: + platform: [ubuntu-latest, macos-latest, windows-latest] + rust: + - stable + py: + - py + + runs-on: ${{ matrix.platform }} + + steps: + - uses: actions/checkout@v2 + + - name: Setup Rust toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + components: rustfmt, clippy + + - name: Install Nushell + uses: actions-rs/cargo@v1 + with: + command: install + args: --path=. --no-default-features + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + + - run: python -m pip install tox + + - name: Install virtualenv + run: | + git clone https://github.com/kubouch/virtualenv.git && \ + cd virtualenv && \ + git checkout engine-q-update + shell: bash + + - name: Test Nushell in virtualenv + run: cd virtualenv && tox -e ${{ matrix.py }} -- -k nushell + shell: bash diff --git a/crates/nu-command/tests/commands/mod.rs b/crates/nu-command/tests/commands/mod.rs index 8ced100b1..695d7c540 100644 --- a/crates/nu-command/tests/commands/mod.rs +++ b/crates/nu-command/tests/commands/mod.rs @@ -61,6 +61,7 @@ mod touch; mod uniq; mod update; mod where_; +#[cfg(feature = "which")] mod which; mod with_env; mod wrap; diff --git a/src/config_files.rs b/src/config_files.rs index 5adab05d1..c211f3676 100644 --- a/src/config_files.rs +++ b/src/config_files.rs @@ -5,10 +5,12 @@ use nu_protocol::engine::{EngineState, Stack, StateDelta, StateWorkingSet}; use std::path::PathBuf; const NUSHELL_FOLDER: &str = "nushell"; -const PLUGIN_FILE: &str = "plugin.nu"; const CONFIG_FILE: &str = "config.nu"; const HISTORY_FILE: &str = "history.txt"; +#[cfg(feature = "plugin")] +const PLUGIN_FILE: &str = "plugin.nu"; +#[cfg(feature = "plugin")] pub(crate) fn read_plugin_file(engine_state: &mut EngineState, stack: &mut Stack) { // Reading signatures from signature file // The plugin.nu file stores the parsed signature collected from each registered plugin