Improve human panic output #968
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: "Test & Lint" | |
on: | |
push: | |
# Don't run CI for tags; there's always a branch for the tag as well so | |
# there's no point in testing it separately | |
tags-ignore: "*" | |
# Only test direct pushes to main; for other branches we can always create a | |
# (draft) PR if we need CI. See https://github.com/orgs/community/discussions/26276#discussioncomment-3251154 | |
# for the general idea. | |
branches: main | |
paths-ignore: | |
- screenshots/** | |
- README.md | |
- CHANGELOG.md | |
- LICENSE | |
pull_request: | |
jobs: | |
# See https://mozilla.github.io/cargo-vet/configuring-ci.html | |
cargo-vet: | |
runs-on: ubuntu-latest | |
env: | |
CARGO_VET_VERSION: 0.10.0 | |
steps: | |
- uses: actions/checkout@master | |
- name: Install Rust | |
run: rustup update stable && rustup default stable | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ runner.tool_cache }}/cargo-vet | |
key: cargo-vet-bin-${{ env.CARGO_VET_VERSION }} | |
- name: Add the tool cache directory to the search path | |
run: echo "${{ runner.tool_cache }}/cargo-vet/bin" >> $GITHUB_PATH | |
- name: Ensure that the tool cache is populated with the cargo-vet binary | |
run: cargo install --root ${{ runner.tool_cache }}/cargo-vet --version ${{ env.CARGO_VET_VERSION }} cargo-vet | |
- name: Invoke cargo-vet | |
run: cargo vet --locked | |
# Lint things which are independent from the build target | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Scripts | |
- uses: docker://mvdan/shfmt | |
with: | |
args: -i 4 -l -d scripts/combine-screenshots scripts/package scripts/screenshot-windows | |
- uses: docker://koalaman/shellcheck:stable | |
with: | |
args: -S style -o all scripts/combine-screenshots scripts/package scripts/screenshot-windows | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
# Test formatting | |
- run: cargo fmt --all -- --check | |
# Dependency policies | |
- uses: EmbarkStudios/cargo-deny-action@v2 | |
- uses: EmbarkStudios/cargo-deny-action@v2 | |
with: | |
arguments: "--no-default-features" | |
manifest-path: "./pulldown-cmark-mdcat/Cargo.toml" | |
# Manpage | |
- uses: docker://asciidoctor/docker-asciidoctor | |
with: | |
args: asciidoctor -b manpage -a reproducible --warnings mdcat.1.adoc | |
- run: man -l --warnings=w --pager=cat mdcat.1 | |
env: | |
MANWIDTH: 80 | |
# Test mdcat itself | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
target: | |
# Default linux build | |
- x86_64-unknown-linux-gnu | |
# macOS | |
- x86_64-apple-darwin | |
# Windows | |
- x86_64-pc-windows-msvc | |
include: | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
- target: x86_64-apple-darwin | |
os: macOS-latest | |
- target: x86_64-pc-windows-msvc | |
os: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
components: clippy | |
# Since Windows builds are comparatively slow, we skip quite a few builds on Windows to speed up pipelines | |
# Test library with no features | |
- run: cargo build -p pulldown-cmark-mdcat --all-targets --locked --no-default-features | |
if: ${{ !contains(matrix.target, 'windows') }} | |
- run: cargo clippy -p pulldown-cmark-mdcat --all-targets --locked --no-default-features | |
if: ${{ !contains(matrix.target, 'windows') }} | |
- run: cargo test -p pulldown-cmark-mdcat --locked --no-default-features | |
if: ${{ !contains(matrix.target, 'windows') }} | |
- run: cargo doc -p pulldown-cmark-mdcat --locked --no-default-features | |
if: ${{ !contains(matrix.target, 'windows') }} | |
# Build and test entire workspace in default configuration | |
- run: cargo build --workspace --all-targets --locked --target ${{ matrix.target }} | |
- run: cargo clippy --workspace --all-targets --locked --target ${{ matrix.target }} | |
- run: cargo test --workspace --locked --target ${{ matrix.target }} | |
- run: cargo doc --workspace --locked --target ${{ matrix.target }} | |
if: ${{ !contains(matrix.target, 'windows') }} | |
# Run on our complete example, just to assert that the CLI doesn't crash | |
- run: cargo run --target ${{ matrix.target }} -- sample/common-mark.md |