Switch to nextest as test runner (#1418)

main
multisn8 2 years ago committed by GitHub
commit 2a9fa22341
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
[profile.ci.junit]
path = "results.xml"

@ -2,6 +2,9 @@ name: Build-and-Test
on: [push] on: [push]
env:
CARGO_TERM_COLOR: always
jobs: jobs:
build-windows: build-windows:
runs-on: windows-latest runs-on: windows-latest
@ -17,9 +20,9 @@ jobs:
components: rustfmt components: rustfmt
override: true override: true
- name: Install Utilities - name: Install cargo-nextest
run: | uses: taiki-e/install-action@nextest
cargo install cargo2junit
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v1
- name: Check Formatting - name: Check Formatting
@ -36,22 +39,13 @@ jobs:
NEOVIM_BIN: "C:/tools/neovim/nvim-win64/bin/nvim.exe" NEOVIM_BIN: "C:/tools/neovim/nvim-win64/bin/nvim.exe"
RUST_BACKTRACE: full RUST_BACKTRACE: full
run: | run: |
# Pay attention not to break BUILD stage of a test, cargo nextest run --profile ci
# when tests are failing at BUILD stage, everything after -- is ignored,
# and no json output will be generated.
# Because those arguments is passed to compiled test binary. And it is failed to compile.
cargo test -- -Z unstable-options --format json > results.json
# This and `set -eo pipefail` for MacOS/Linux
# is added, because without it pipe will eat exit status.
# Docs are stating that it should work by default, but it does not.
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
# Oh, it still does not fail on Windows. ¯\_(ツ)_/¯
cat results.json | cargo2junit > results.xml
- name: Publish Test Results - name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v1 uses: EnricoMi/publish-unit-test-result-action/composite@v1
if: always() if: always()
with: with:
files: results.xml files: target/nextest/ci/results.xml
- name: Build Release - name: Build Release
run: | run: |
@ -83,9 +77,11 @@ jobs:
run: | run: |
rustup target add aarch64-apple-darwin rustup target add aarch64-apple-darwin
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Install Utilities - name: Install Utilities
run: | run: |
cargo install cargo2junit
cargo install cargo-bundle cargo install cargo-bundle
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v1
@ -102,14 +98,13 @@ jobs:
env: env:
RUST_BACKTRACE: full RUST_BACKTRACE: full
run: | run: |
set -eo pipefail cargo nextest run --profile ci
cargo test -- -Z unstable-options --format json | cargo2junit > results.xml
- name: Publish Test Results - name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v1 uses: EnricoMi/publish-unit-test-result-action/composite@v1
if: always() if: always()
with: with:
files: results.xml files: target/nextest/ci/results.xml
- name: Build x86 app - name: Build x86 app
env: env:
@ -162,9 +157,8 @@ jobs:
components: rustfmt components: rustfmt
override: true override: true
- name: Install Utilities - name: Install cargo-nextest
run: | uses: taiki-e/install-action@nextest
cargo install cargo2junit
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v1
@ -183,14 +177,13 @@ jobs:
env: env:
RUST_BACKTRACE: full RUST_BACKTRACE: full
run: | run: |
set -eo pipefail cargo nextest run --profile ci
cargo test -- -Z unstable-options --format json | cargo2junit > results.xml
- name: Publish Test Results - name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v1 uses: EnricoMi/publish-unit-test-result-action@v1
if: always() if: always()
with: with:
files: results.xml files: target/nextest/ci/results.xml
- name: Build Release - name: Build Release
run: | run: |

Loading…
Cancel
Save