2022-04-28 22:57:26 +00:00
|
|
|
on:
|
|
|
|
pull_request:
|
2023-07-08 10:48:01 +00:00
|
|
|
push:
|
2022-04-28 22:57:26 +00:00
|
|
|
branches:
|
|
|
|
- main
|
2021-09-04 07:52:28 +00:00
|
|
|
|
2022-04-24 13:03:21 +00:00
|
|
|
name: continuous-integration
|
2021-09-04 07:52:28 +00:00
|
|
|
|
2023-07-08 10:48:01 +00:00
|
|
|
env:
|
Fix unit tests on Android (#10224)
# Description
* The path to the binaries for tests is slightly incorrect. It is
missing the build target when it is set with the `CARGO_BUILD_TARGET`
environment variable. For example, when `CARGO_BUILD_TARGET` is set to
`aarch64-linux-android`, the path to the `nu` binary is:
`./target/aarch64-linux-android/debug/nu`
rather than
`./target/debug/nu`
This is common on Termux since the default target that rustc detects can
cause problems on some projects, such as [python's `cryptography`
package](https://github.com/pyca/cryptography/issues/7248).
This technically isn't a problem specific to Android, but is more likely
to happen on Android due to the latter.
* Additionally, the existing variable named `NUSHELL_CARGO_TARGET` is in
fact the profile, not the build target, so this was renamed to
`NUSHELL_CARGO_PROFILE`. This change is included because without the
rename, the build system would be using `CARGO_BUILD_TARGET` for the
build target and `NUSHELL_CARGO_TARGET` for the build profile, which is
confusing.
* `std path add` tests were missing `android` test
# User-Facing Changes
For those who would like to build nushell on Termux, the unit tests will
pass now.
2023-09-05 08:17:34 +00:00
|
|
|
NUSHELL_CARGO_PROFILE: ci
|
2023-07-08 10:48:01 +00:00
|
|
|
NU_LOG_LEVEL: DEBUG
|
2023-08-20 22:08:49 +00:00
|
|
|
CLIPPY_OPTIONS: "-D warnings -D clippy::unwrap_used"
|
2023-07-08 10:48:01 +00:00
|
|
|
|
2021-09-04 07:52:28 +00:00
|
|
|
jobs:
|
2023-07-08 10:48:01 +00:00
|
|
|
fmt-clippy:
|
2021-09-04 07:52:28 +00:00
|
|
|
strategy:
|
2022-05-16 04:02:11 +00:00
|
|
|
fail-fast: true
|
2021-09-04 07:52:28 +00:00
|
|
|
matrix:
|
2022-12-05 18:12:36 +00:00
|
|
|
# Pinning to Ubuntu 20.04 because building on newer Ubuntu versions causes linux-gnu
|
|
|
|
# builds to link against a too-new-for-many-Linux-installs glibc version. Consider
|
|
|
|
# revisiting this when 20.04 is closer to EOL (April 2025)
|
|
|
|
platform: [windows-latest, macos-latest, ubuntu-20.04]
|
2023-07-08 10:48:01 +00:00
|
|
|
feature: [default, dataframe, extra]
|
2022-12-24 21:44:52 +00:00
|
|
|
include:
|
2023-07-08 10:48:01 +00:00
|
|
|
- feature: default
|
2022-12-24 21:44:52 +00:00
|
|
|
flags: ""
|
2023-07-08 10:48:01 +00:00
|
|
|
- feature: dataframe
|
|
|
|
flags: "--features=dataframe"
|
|
|
|
- feature: extra
|
|
|
|
flags: "--features=extra"
|
2022-12-24 21:44:52 +00:00
|
|
|
exclude:
|
|
|
|
- platform: windows-latest
|
2023-07-08 10:48:01 +00:00
|
|
|
feature: dataframe
|
2022-12-24 21:44:52 +00:00
|
|
|
- platform: macos-latest
|
2023-07-08 10:48:01 +00:00
|
|
|
feature: dataframe
|
2021-09-04 07:52:28 +00:00
|
|
|
|
2021-10-11 19:19:43 +00:00
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
|
2021-09-04 07:52:28 +00:00
|
|
|
steps:
|
2022-10-21 07:25:02 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-09-04 07:52:28 +00:00
|
|
|
|
2022-10-30 07:24:10 +00:00
|
|
|
- name: Setup Rust toolchain and cache
|
2023-06-13 12:31:23 +00:00
|
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1.5.0
|
2023-06-23 19:53:45 +00:00
|
|
|
with:
|
|
|
|
rustflags: ""
|
2022-04-28 18:18:27 +00:00
|
|
|
|
2022-12-07 02:57:07 +00:00
|
|
|
- name: cargo fmt
|
|
|
|
run: cargo fmt --all -- --check
|
2022-02-12 20:48:17 +00:00
|
|
|
|
2022-04-28 19:39:21 +00:00
|
|
|
- name: Clippy
|
2023-07-08 10:48:01 +00:00
|
|
|
run: cargo clippy --workspace ${{ matrix.flags }} --exclude nu_plugin_* -- $CLIPPY_OPTIONS
|
2022-05-16 04:02:11 +00:00
|
|
|
|
2023-07-08 10:48:01 +00:00
|
|
|
tests:
|
2022-04-29 19:48:04 +00:00
|
|
|
strategy:
|
2022-05-16 04:02:11 +00:00
|
|
|
fail-fast: true
|
2022-04-29 19:48:04 +00:00
|
|
|
matrix:
|
2022-12-05 18:12:36 +00:00
|
|
|
platform: [windows-latest, macos-latest, ubuntu-20.04]
|
2023-07-08 10:48:01 +00:00
|
|
|
feature: [default, dataframe, extra]
|
2022-04-29 19:48:04 +00:00
|
|
|
include:
|
2023-07-08 10:48:01 +00:00
|
|
|
- feature: default
|
2022-05-02 09:32:57 +00:00
|
|
|
flags: ""
|
2023-07-08 10:48:01 +00:00
|
|
|
- feature: dataframe
|
2022-11-23 00:58:11 +00:00
|
|
|
flags: "--features=dataframe"
|
2023-07-08 10:48:01 +00:00
|
|
|
- feature: extra
|
2023-06-14 23:06:22 +00:00
|
|
|
flags: "--features=extra"
|
2022-04-29 19:48:04 +00:00
|
|
|
exclude:
|
|
|
|
- platform: windows-latest
|
2023-07-08 10:48:01 +00:00
|
|
|
feature: dataframe
|
2022-04-29 19:48:04 +00:00
|
|
|
- platform: macos-latest
|
2023-07-08 10:48:01 +00:00
|
|
|
feature: dataframe
|
2023-06-14 23:06:22 +00:00
|
|
|
- platform: windows-latest
|
2023-07-08 10:48:01 +00:00
|
|
|
feature: extra
|
2023-06-14 23:06:22 +00:00
|
|
|
- platform: macos-latest
|
2023-07-08 10:48:01 +00:00
|
|
|
feature: extra
|
2022-04-29 19:48:04 +00:00
|
|
|
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
|
|
|
|
steps:
|
2022-10-21 07:25:02 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-04-29 19:48:04 +00:00
|
|
|
|
2022-10-30 07:24:10 +00:00
|
|
|
- name: Setup Rust toolchain and cache
|
2023-06-13 12:31:23 +00:00
|
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1.5.0
|
2023-06-23 19:53:45 +00:00
|
|
|
with:
|
|
|
|
rustflags: ""
|
2022-04-29 19:48:04 +00:00
|
|
|
|
2022-02-12 20:48:17 +00:00
|
|
|
- name: Tests
|
2022-12-07 02:57:07 +00:00
|
|
|
run: cargo test --workspace --profile ci --exclude nu_plugin_* ${{ matrix.flags }}
|
2022-02-12 20:48:17 +00:00
|
|
|
|
standard library: bring the tests into the main CI (#8525)
Should close one of the tasks in #8450.
# Description
> **Note**
> in order of appearance in the global diff
- 1b7497c41966306aa3103a95a9b5ef5df7111ee4 adds the `std-tests` job to
the CI which
1. installs `nushell` in the runner
2. run the `tests.nu` module
> see `open .github/workflows/ci.yml | get jobs.std-tests | to yaml`
-
[`ec85b6fd`..`9c122115`](ec85b6fd3fc004cd94e3fada5c8e5fe2714fd629..9c12211564ca8ee90ed65ae45776dccb8f8e4ef1)
is where all the magic happens => see below
- :test_tube: 799c7eb7fd5f140289b36b9dbc00329c50e2fbda introduces some
bugs and failing test to see how the CI behaves => see how the [tests
failed](https://github.com/nushell/nushell/actions/runs/4460098237/jobs/7833018256)
as expected :x:
- :test_tube: and c3de1fafb5c5313e30c08c9ca57e09df33b61b74 reverts the
failing tests, i.e. the previous commit, leaving a standard library
whose tests all pass :tada: => see the [tests
passing](https://github.com/nushell/nushell/actions/runs/4460153434/jobs/7833110719?pr=8525#step:5:1)
now :heavy_check_mark:
## the changes to the runner
> see
[`ec85b6fd`..`9c122115`](ec85b6fd3fc004cd94e3fada5c8e5fe2714fd629..9c12211564ca8ee90ed65ae45776dccb8f8e4ef1)
the issue with the previous runner was the following: the clever trick
of using `nu -c "use ...; test"` did print the errors when occuring but
they did not capture the true "failure", i.e. in all cases the
`$env.LAST_EXIT_CODE` was set to `0`, never stopping the CI when a test
failed :thinking:
i first tried to `try` / `catch` the error in
ec85b6fd3fc004cd94e3fada5c8e5fe2714fd629 which kinda worked but only
throw a single error, the first one
i thought it was not the best and started thinking about a solution to
have a complete report of all failing tests, at once, to avoid running
the CI multiple times!
the easiest solution i found was the one i implemented in
9c12211564ca8ee90ed65ae45776dccb8f8e4ef1
> **Warning**
> this changes the structure of the runner quite a bit, but the `for`
loops where annoying to manipulate structured data and allow the runner
to draw a complete report...
now the runner does the following
- compute the list of all available tests in a table with the `file`,
`module` and `name` columns (first part of the pipe until `flatten` and
`rename`)
- run the tests one by one computing the new `pass` column
- with a `log info`
- captures the failing ones => puts `true` in `pass` if the test passes,
`false` otherwise
- if at least one test has failed, throw a single error with the list of
failing tests
### hope you'll like it :relieved:
# User-Facing Changes
```
$nothing
```
# Tests + Formatting
the standard tests now return a true error that will stop the CI
# After Submitting
```
$nothing
```
2023-03-25 18:29:08 +00:00
|
|
|
std-lib-and-python-virtualenv:
|
2022-02-12 20:48:17 +00:00
|
|
|
strategy:
|
2022-05-16 04:02:11 +00:00
|
|
|
fail-fast: true
|
2022-02-12 20:48:17 +00:00
|
|
|
matrix:
|
2022-12-05 18:12:36 +00:00
|
|
|
platform: [ubuntu-20.04, macos-latest, windows-latest]
|
2022-03-18 22:36:38 +00:00
|
|
|
py:
|
|
|
|
- py
|
2022-02-12 20:48:17 +00:00
|
|
|
|
|
|
|
runs-on: ${{ matrix.platform }}
|
2021-09-04 07:52:28 +00:00
|
|
|
|
2022-02-12 20:48:17 +00:00
|
|
|
steps:
|
2022-10-21 07:25:02 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-02-12 20:48:17 +00:00
|
|
|
|
2022-10-30 07:24:10 +00:00
|
|
|
- name: Setup Rust toolchain and cache
|
2023-06-13 12:31:23 +00:00
|
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1.5.0
|
2023-06-23 19:53:45 +00:00
|
|
|
with:
|
|
|
|
rustflags: ""
|
2022-04-28 22:57:26 +00:00
|
|
|
|
2022-02-12 20:48:17 +00:00
|
|
|
- name: Install Nushell
|
standard library: bring the tests into the main CI (#8525)
Should close one of the tasks in #8450.
# Description
> **Note**
> in order of appearance in the global diff
- 1b7497c41966306aa3103a95a9b5ef5df7111ee4 adds the `std-tests` job to
the CI which
1. installs `nushell` in the runner
2. run the `tests.nu` module
> see `open .github/workflows/ci.yml | get jobs.std-tests | to yaml`
-
[`ec85b6fd`..`9c122115`](ec85b6fd3fc004cd94e3fada5c8e5fe2714fd629..9c12211564ca8ee90ed65ae45776dccb8f8e4ef1)
is where all the magic happens => see below
- :test_tube: 799c7eb7fd5f140289b36b9dbc00329c50e2fbda introduces some
bugs and failing test to see how the CI behaves => see how the [tests
failed](https://github.com/nushell/nushell/actions/runs/4460098237/jobs/7833018256)
as expected :x:
- :test_tube: and c3de1fafb5c5313e30c08c9ca57e09df33b61b74 reverts the
failing tests, i.e. the previous commit, leaving a standard library
whose tests all pass :tada: => see the [tests
passing](https://github.com/nushell/nushell/actions/runs/4460153434/jobs/7833110719?pr=8525#step:5:1)
now :heavy_check_mark:
## the changes to the runner
> see
[`ec85b6fd`..`9c122115`](ec85b6fd3fc004cd94e3fada5c8e5fe2714fd629..9c12211564ca8ee90ed65ae45776dccb8f8e4ef1)
the issue with the previous runner was the following: the clever trick
of using `nu -c "use ...; test"` did print the errors when occuring but
they did not capture the true "failure", i.e. in all cases the
`$env.LAST_EXIT_CODE` was set to `0`, never stopping the CI when a test
failed :thinking:
i first tried to `try` / `catch` the error in
ec85b6fd3fc004cd94e3fada5c8e5fe2714fd629 which kinda worked but only
throw a single error, the first one
i thought it was not the best and started thinking about a solution to
have a complete report of all failing tests, at once, to avoid running
the CI multiple times!
the easiest solution i found was the one i implemented in
9c12211564ca8ee90ed65ae45776dccb8f8e4ef1
> **Warning**
> this changes the structure of the runner quite a bit, but the `for`
loops where annoying to manipulate structured data and allow the runner
to draw a complete report...
now the runner does the following
- compute the list of all available tests in a table with the `file`,
`module` and `name` columns (first part of the pipe until `flatten` and
`rename`)
- run the tests one by one computing the new `pass` column
- with a `log info`
- captures the failing ones => puts `true` in `pass` if the test passes,
`false` otherwise
- if at least one test has failed, throw a single error with the list of
failing tests
### hope you'll like it :relieved:
# User-Facing Changes
```
$nothing
```
# Tests + Formatting
the standard tests now return a true error that will stop the CI
# After Submitting
```
$nothing
```
2023-03-25 18:29:08 +00:00
|
|
|
run: cargo install --path . --locked --no-default-features
|
|
|
|
|
|
|
|
- name: Standard library tests
|
2023-06-10 18:16:17 +00:00
|
|
|
run: nu -c 'use std testing; testing run-tests --path crates/nu-std'
|
2022-02-12 20:48:17 +00:00
|
|
|
|
2022-03-18 22:36:38 +00:00
|
|
|
- name: Setup Python
|
2022-10-21 07:25:02 +00:00
|
|
|
uses: actions/setup-python@v4
|
2022-03-18 22:36:38 +00:00
|
|
|
with:
|
|
|
|
python-version: "3.10"
|
2022-02-12 20:48:17 +00:00
|
|
|
|
2022-03-18 22:36:38 +00:00
|
|
|
- name: Install virtualenv
|
2023-08-20 14:00:59 +00:00
|
|
|
run: pip install virtualenv
|
2022-03-18 22:36:38 +00:00
|
|
|
shell: bash
|
2022-02-12 20:48:17 +00:00
|
|
|
|
2022-03-18 22:36:38 +00:00
|
|
|
- name: Test Nushell in virtualenv
|
2023-08-20 14:00:59 +00:00
|
|
|
run: nu scripts/test_virtualenv.nu
|
2022-03-18 22:36:38 +00:00
|
|
|
shell: bash
|
2022-05-02 07:20:57 +00:00
|
|
|
|
|
|
|
plugins:
|
|
|
|
strategy:
|
2022-05-16 04:02:11 +00:00
|
|
|
fail-fast: true
|
2022-05-02 07:20:57 +00:00
|
|
|
matrix:
|
2022-12-05 18:12:36 +00:00
|
|
|
platform: [windows-latest, macos-latest, ubuntu-20.04]
|
2022-05-02 07:20:57 +00:00
|
|
|
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
|
|
|
|
steps:
|
2022-10-21 07:25:02 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-05-02 07:20:57 +00:00
|
|
|
|
2022-10-30 07:24:10 +00:00
|
|
|
- name: Setup Rust toolchain and cache
|
2023-06-13 12:31:23 +00:00
|
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1.5.0
|
2023-06-23 19:53:45 +00:00
|
|
|
with:
|
|
|
|
rustflags: ""
|
2022-05-02 07:20:57 +00:00
|
|
|
|
2022-05-13 11:40:46 +00:00
|
|
|
- name: Clippy
|
2023-07-08 10:48:01 +00:00
|
|
|
run: cargo clippy --package nu_plugin_* ${{ matrix.flags }} -- $CLIPPY_OPTIONS
|
2022-05-02 07:20:57 +00:00
|
|
|
|
2022-05-13 11:40:46 +00:00
|
|
|
- name: Tests
|
2022-12-07 02:57:07 +00:00
|
|
|
run: cargo test --profile ci --package nu_plugin_*
|