Skip to content

Switch to 2021 edition and Cargo's v2 resolver #271

Switch to 2021 edition and Cargo's v2 resolver

Switch to 2021 edition and Cargo's v2 resolver #271

Workflow file for this run

name: CI
on:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
jobs:
min_version:
name: Minimum supported rust version
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable minus 2 releases # MSRV policy = last three versions of stable
components: clippy
- name: Run cargo clippy
run: |
# Must run before `cargo check` until we use Rust 1.52
# See https://github.com/rust-lang/rust-clippy/issues/4612
cargo clippy --all-targets --all-features -- \
--allow clippy::unknown_clippy_lints \
--allow clippy::unnecessary_cast \
--allow clippy::block_in_if_condition_stmt
# Prevent regressions of https://github.com/trishume/syntect/issues/98
cargo clippy --all-features --lib -- --deny clippy::panic
- name: Run cargo check
run: |
cargo check --all-features --all-targets
documentation:
name: Documentation checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: RUSTDOCFLAGS='--deny warnings' cargo doc --no-deps --document-private-items --all-features
bat-tests:
name: Run bat syntax regression tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: 'syntect'
- uses: actions/checkout@v3
with:
repository: 'sharkdp/bat'
path: 'bat'
ref: master
submodules: true
- name: bat/tests/syntax-tests/regression_test.sh
run: |
cd bat
sed -i 's%\[dependencies.syntect\]%[dependencies.syntect]\npath = "../syntect"%' Cargo.toml
cargo build --release # Build bat so we can update the assets
PATH=target/release:$PATH ./assets/create.sh # Update assets with newly built bat
cargo build --release # Build bat using the newly updated assets
PATH=./target/release:$PATH tests/syntax-tests/regression_test.sh
build-and-test:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
- name: Build
run: |
cargo build
- name: Run tests
run: |
cargo test --features metadata
- name: Run tests with fancy
run: |
# Run these tests in release mode since they're slow as heck otherwise
cargo test --features default-fancy --no-default-features --release
- name: Ensure highlight works without 'plist-load' and 'yaml-load' features
run: |
cargo run --example synhtml --no-default-features --features html,default-syntaxes,default-themes,regex-onig -- examples/synhtml.rs
- name: Run tests with 'default-syntaxes' but without 'default-themes'
run: |
cargo test --lib --example synstats --no-default-features --features default-syntaxes,yaml-load,regex-onig
- name: Run tests without default features
run: |
cargo test --lib --no-default-features
- name: make stuff
run: |
make assets
make syntest
make syntest-fancy
- name: Docs
run: |
cargo doc