use dep:
features explicitly
#470
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
jobs: | |
unit-test: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest, macos-14] | |
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 | |
# Test hgrep can ignore broken pipe error. `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 | |
if: ${{ matrix.os != 'windows-latest' }} | |
- run: | | |
$ErrorActionPreference = "Continue" | |
cargo run --color always -- Printer src | head -n 5 | |
if: ${{ matrix.os == 'windows-latest' }} | |
shell: pwsh | |
- uses: codecov/codecov-action@v4 | |
with: | |
files: lcov.info | |
token: ${{ secrets.CODECOV_TOKEN }} | |
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 |