Skip to content

use anyhow::bail instead of errors dedicated to printers #444

use anyhow::bail instead of errors dedicated to printers

use anyhow::bail instead of errors dedicated to printers #444

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
unit-test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: true
runs-on: ${{ matrix.os }}
env:
RUSTFLAGS: -D warnings
RUST_BACKTRACE: 1
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Run tests
run: |
cargo llvm-cov --color always --lcov --output-path lcov.info
cargo llvm-cov --color always --no-run
shell: bash
- name: Sanity check
run: cargo run --color always -- hgrep README.md
- run: cargo run --color always --no-default-features --features syntect-printer -- --version
- run: cargo run --color always --no-default-features --features bat-printer -- --version
- run: cargo run --color always --no-default-features --features syntect-printer,bat-printer -- --version
- run: cargo run --color always --no-default-features --features ripgrep,syntect-printer -- --version
- run: cargo run --color always --no-default-features --features ripgrep,bat-printer -- --version
# `head -n` exits before `cargo run` exits. Since `cargo run` does not know that, it tries to write additional
# outputs to stdout. But the stdout is already closed by the succeeding process.
- run: cargo run --color always -- Printer src | head -n 5
- uses: codecov/codecov-action@v3
with:
files: lcov.info
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: rustfmt
run: cargo fmt -- --check --color always
- name: clippy
run: cargo clippy --color always --benches --tests --all -- -D warnings