Skip to content

Commit

Permalink
Add color-eyre to workspace (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
ten3roberts authored Mar 14, 2024
2 parents 75beaae + eb8d059 commit 7a5c32a
Show file tree
Hide file tree
Showing 47 changed files with 4,915 additions and 17 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ jobs:
features:
- # default
- --no-default-features
- --features track-caller
- --no-default-features --features track-caller
- --no-default-features --features auto-install
- --features pyo3
- --features auto-install
- --all-features
steps:
- uses: actions/checkout@v1
Expand All @@ -67,8 +67,8 @@ jobs:
features:
- # default
- --no-default-features
- --features track-caller
- --features auto-install
- --no-default-features --features track-caller
- --no-default-features --features auto-install
# skip `--features pyo3` and `--all-features` because pyo3 doesn't support this msrv
steps:
- uses: actions/checkout@v1
Expand Down Expand Up @@ -136,6 +136,7 @@ jobs:
with:
command: clippy
args: --all-targets --all-features -- -D warnings

miri:
name: Miri
runs-on: ubuntu-latest
Expand Down
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace]
members = [
"color-eyre",
"color-spantrace",
"eyre"
]
Expand All @@ -15,3 +16,9 @@ rust-version = "1.65.0"
[workspace.dependencies]
indenter = "0.3.0"
once_cell = "1.18.0"
owo-colors = "3.2.0"

[profile.dev.package.backtrace]
opt-level = 3


15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
eyre
====
# eyre

[![Build Status][actions-badge]][actions-url]
[![Latest Version](https://img.shields.io/crates/v/eyre.svg)](https://crates.io/crates/eyre)
[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/eyre)
[![Latest Version][version-badge]][version-url]
[![Rust Documentation][docs-badge]][docs-url]
[![Discord chat][discord-badge]][discord-url]

[actions-badge]: https://github.com/eyre-rs/eyre/workflows/Continuous%20integration/badge.svg
[actions-url]: https://github.com/eyre-rs/eyre/actions?query=workflow%3A%22Continuous+integration%22
[version-badge]: https://img.shields.io/crates/v/eyre.svg
[version-url]: https://crates.io/crates/eyre
[docs-badge]: https://img.shields.io/badge/docs-latest-blue.svg
[docs-url]: https://docs.rs/eyre
[discord-badge]: https://img.shields.io/discord/960645145018110012?label=eyre%20community%20discord
[discord-url]: https://discord.gg/z94RqmUTKB

Expand Down Expand Up @@ -255,10 +258,10 @@ implements `context` for options which you can import to make existing
[`anyhow`]: https://github.com/dtolnay/anyhow
[`tracing_error::SpanTrace`]: https://docs.rs/tracing-error/*/tracing_error/struct.SpanTrace.html
[`stable-eyre`]: https://github.com/eyre-rs/stable-eyre
[`color-eyre`]: https://github.com/eyre-rs/color-eyre
[`color-eyre`]: https://github.com/eyre-rs/eyre/tree/master/color-eyre
[`jane-eyre`]: https://github.com/yaahc/jane-eyre
[`simple-eyre`]: https://github.com/eyre-rs/simple-eyre
[`color-spantrace`]: https://github.com/eyre-rs/color-spantrace
[`color-spantrace`]: https://github.com/eyre-rs/eyre/tree/master/color-spantrace
[`color-backtrace`]: https://github.com/athre0z/color-backtrace

[^1]: example and explanation of breakage https://github.com/eyre-rs/eyre/issues/30#issuecomment-647650361
Expand Down
135 changes: 135 additions & 0 deletions color-eyre/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
on:
push:
branches:
- master
pull_request: {}

name: Continuous integration

jobs:
check:
name: Check
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: check

test-features:
name: Test Features
runs-on: ubuntu-latest
strategy:
matrix:
features:
-
- --all-features
- --no-default-features
- --no-default-features --features issue-url
- --no-default-features --features capture-spantrace
- --no-default-features --features track-caller
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: test
args: ${{ matrix.features }}

test-versions:
name: Test Versions
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- wasm32-unknown-unknown
rust:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
target: ${{ matrix.target }}
toolchain: ${{ matrix.rust }}
override: true
- name: install test runner for wasm
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
if: ${{ matrix.target == 'wasm32-unknown-unknown' }}
- uses: actions-rs/cargo@v1
with:
command: test
target: ${{ matrix.target }}
toolchain: ${{ matrix.rust }}
if: ${{ matrix.target != 'wasm32-unknown-unknown' }}
- name: run wasm tests
run: wasm-pack test --node
if: ${{ matrix.target == 'wasm32-unknown-unknown' }}

test-os:
name: Test Operating Systems
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: actions-rs/cargo@v1
with:
command: test

fmt:
name: Rustfmt
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
88 changes: 88 additions & 0 deletions color-eyre/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

<!-- next-header -->

## [Unreleased] - ReleaseDate

## [0.6.2] - 2022-07-11
### Added
- Option to disable display of location section in error reports

## [0.6.1] - 2022-02-24
### Changed
- Collapsed backtrace help text into fewer lines

## [0.6.0] - 2022-01-12
### Changed
- Updated dependencies to match newest tracing versions

## [0.5.11] - 2021-04-13

## [0.5.10] - 2020-12-02
### Added
- Support custom themes

## [0.5.9] - 2020-12-02
### Fixed
- Bumped color-spantrace dependency version to fix a panic

## [0.5.8] - 2020-11-23
### Added
- Exposed internal interfaces for the panic handler so that it can be wrapped
by consumers to customize the behaviour of the panic hook.

## [0.5.7] - 2020-11-05
### Fixed
- Added missing `cfg`s that caused compiler errors when only enabling the
`issue-url` feature

## [0.5.6] - 2020-10-02
### Added
- Add support for track caller added in eyre 0.6.1 and print original
callsites of errors in all `eyre::Reports` by default

## [0.5.5] - 2020-09-21
### Added
- add `issue_filter` method to `HookBuilder` for disabling issue generation
based on the error encountered.

## [0.5.4] - 2020-09-17
### Added
- Add new "issue-url" feature for generating issue creation links in error
reports pre-populated with information about the error

## [0.5.3] - 2020-09-14
### Added
- add `panic_section` method to `HookBuilder` for overriding the printer for
the panic message at the start of panic reports

## [0.5.2] - 2020-08-31
### Added
- make it so all `Section` trait methods can be called on `Report` in
addition to the already supported usage on `Result<T, E: Into<Report>>`
- panic_section to `HookBuilder` to add custom sections to panic reports
- display_env_section to `HookBuilder` to disable the output indicating what
environment variables can be set to manipulate the error reports
### Changed
- switched from ansi_term to owo-colors for colorizing output, allowing for
better compatibility with the Display trait

<!-- next-url -->
[Unreleased]: https://github.com/eyre-rs/color-eyre/compare/v0.6.2...HEAD
[0.6.2]: https://github.com/eyre-rs/color-eyre/compare/v0.6.1...v0.6.2
[0.6.1]: https://github.com/eyre-rs/color-eyre/compare/v0.6.0...v0.6.1
[0.6.0]: https://github.com/eyre-rs/color-eyre/compare/v0.5.11...v0.6.0
[0.5.11]: https://github.com/eyre-rs/color-eyre/compare/v0.5.10...v0.5.11
[0.5.10]: https://github.com/eyre-rs/color-eyre/compare/v0.5.9...v0.5.10
[0.5.9]: https://github.com/eyre-rs/color-eyre/compare/v0.5.8...v0.5.9
[0.5.8]: https://github.com/eyre-rs/color-eyre/compare/v0.5.7...v0.5.8
[0.5.7]: https://github.com/eyre-rs/color-eyre/compare/v0.5.6...v0.5.7
[0.5.6]: https://github.com/eyre-rs/color-eyre/compare/v0.5.5...v0.5.6
[0.5.5]: https://github.com/eyre-rs/color-eyre/compare/v0.5.4...v0.5.5
[0.5.4]: https://github.com/eyre-rs/color-eyre/compare/v0.5.3...v0.5.4
[0.5.3]: https://github.com/eyre-rs/color-eyre/compare/v0.5.2...v0.5.3
[0.5.2]: https://github.com/eyre-rs/color-eyre/releases/tag/v0.5.2
83 changes: 83 additions & 0 deletions color-eyre/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[package]
name = "color-eyre"
version = "0.6.2"
description = "An error report handler for panics and eyre::Reports for colorful, consistent, and well formatted error reports for all kinds of errors."
documentation = "https://docs.rs/color-eyre"

authors = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
readme = { workspace = true }
rust-version = { workspace = true }

[features]
default = ["track-caller", "capture-spantrace"]
capture-spantrace = ["tracing-error", "color-spantrace"]
issue-url = ["url"]
track-caller = []

[dependencies]
eyre = "0.6.1"
tracing-error = { version = "0.2.0", optional = true }
backtrace = { version = "0.3.48", features = ["gimli-symbolize"] }
indenter = { workspace = true }
owo-colors = { workspace = true }
color-spantrace = { version = "0.2", optional = true }
once_cell = { workspace = true }
url = { version = "2.1.1", optional = true }

[dev-dependencies]
tracing-subscriber = { version = "0.3.0", features = ["env-filter"] }
tracing = "0.1.13"
pretty_assertions = "1.0.0"
thiserror = "1.0.19"
ansi-parser = "0.8.0"

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = "0.3.15"

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.release]
dev-version = false

[[package.metadata.release.pre-release-replacements]]
file = "CHANGELOG.md"
search = "Unreleased"
replace="{{version}}"

[[package.metadata.release.pre-release-replacements]]
file = "src/lib.rs"
search = "#!\\[doc\\(html_root_url.*"
replace = "#![doc(html_root_url = \"https://docs.rs/{{crate_name}}/{{version}}\")]"
exactly = 1

[[package.metadata.release.pre-release-replacements]]
file = "CHANGELOG.md"
search = "\\.\\.\\.HEAD"
replace="...{{tag_name}}"
exactly = 1

[[package.metadata.release.pre-release-replacements]]
file = "CHANGELOG.md"
search = "ReleaseDate"
replace="{{date}}"

[[package.metadata.release.pre-release-replacements]]
file="CHANGELOG.md"
search="<!-- next-header -->"
replace="<!-- next-header -->\n\n## [Unreleased] - ReleaseDate"
exactly=1

[[package.metadata.release.pre-release-replacements]]
file="CHANGELOG.md"
search="<!-- next-url -->"
replace="<!-- next-url -->\n[Unreleased]: https://github.com/eyre-rs/{{crate_name}}/compare/{{tag_name}}...HEAD"
exactly=1

[[example]]
name = "color-eyre-usage"
path = "examples/usage.rs"
1 change: 1 addition & 0 deletions color-eyre/LICENSE-APACHE
1 change: 1 addition & 0 deletions color-eyre/LICENSE-MIT
Loading

0 comments on commit 7a5c32a

Please sign in to comment.