Skip to content

Commit 8801cbb

Browse files
committed
Add release-plz to CI
1 parent dbaf9ed commit 8801cbb

File tree

10 files changed

+82
-45
lines changed

10 files changed

+82
-45
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
args: --all ${{ matrix.features }}
6161

6262
test-msrv:
63-
name: Test Suite
63+
name: Test Suite (msrv)
6464
runs-on: ubuntu-latest
6565
strategy:
6666
matrix:
@@ -82,7 +82,7 @@ jobs:
8282
args: --all ${{ matrix.features }}
8383

8484
test-os:
85-
name: Test Suite
85+
name: Test Suite (os)
8686
runs-on: ${{ matrix.os }}
8787
strategy:
8888
matrix:

.github/workflows/release-plz.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release-plz
2+
3+
permissions:
4+
pull-requests: write
5+
contents: write
6+
7+
on:
8+
push:
9+
branches:
10+
- master
11+
12+
jobs:
13+
14+
# Release unpublished packages.
15+
release-plz-release:
16+
name: Release-plz release
17+
runs-on: ubuntu-latest
18+
if: ${{ github.repository_owner == 'eyre-rs' }}
19+
permissions:
20+
contents: write
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
- name: Install Rust toolchain
27+
uses: dtolnay/rust-toolchain@stable
28+
- name: Run release-plz
29+
uses: release-plz/[email protected]
30+
with:
31+
command: release
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
35+
36+
# Create a PR with the new versions and changelog, preparing the next release.
37+
release-plz-pr:
38+
name: Release-plz PR
39+
runs-on: ubuntu-latest
40+
if: ${{ github.repository_owner == 'eyre-rs' }}
41+
permissions:
42+
contents: write
43+
pull-requests: write
44+
concurrency:
45+
group: release-plz-${{ github.ref }}
46+
cancel-in-progress: false
47+
steps:
48+
- name: Checkout repository
49+
uses: actions/checkout@v4
50+
with:
51+
fetch-depth: 0
52+
- name: Install Rust toolchain
53+
uses: dtolnay/rust-toolchain@stable
54+
- name: Run release-plz
55+
uses: release-plz/[email protected]
56+
with:
57+
command: release-pr
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

color-eyre/Cargo.toml

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -44,40 +44,6 @@ rustdoc-args = ["--cfg", "docsrs"]
4444
[package.metadata.release]
4545
dev-version = false
4646

47-
[[package.metadata.release.pre-release-replacements]]
48-
file = "CHANGELOG.md"
49-
search = "Unreleased"
50-
replace="{{version}}"
51-
52-
[[package.metadata.release.pre-release-replacements]]
53-
file = "src/lib.rs"
54-
search = "#!\\[doc\\(html_root_url.*"
55-
replace = "#![doc(html_root_url = \"https://docs.rs/{{crate_name}}/{{version}}\")]"
56-
exactly = 1
57-
58-
[[package.metadata.release.pre-release-replacements]]
59-
file = "CHANGELOG.md"
60-
search = "\\.\\.\\.HEAD"
61-
replace="...{{tag_name}}"
62-
exactly = 1
63-
64-
[[package.metadata.release.pre-release-replacements]]
65-
file = "CHANGELOG.md"
66-
search = "ReleaseDate"
67-
replace="{{date}}"
68-
69-
[[package.metadata.release.pre-release-replacements]]
70-
file="CHANGELOG.md"
71-
search="<!-- next-header -->"
72-
replace="<!-- next-header -->\n\n## [Unreleased] - ReleaseDate"
73-
exactly=1
74-
75-
[[package.metadata.release.pre-release-replacements]]
76-
file="CHANGELOG.md"
77-
search="<!-- next-url -->"
78-
replace="<!-- next-url -->\n[Unreleased]: https://github.com/eyre-rs/{{crate_name}}/compare/{{tag_name}}...HEAD"
79-
exactly=1
80-
8147
[[example]]
8248
name = "color-eyre-usage"
8349
path = "examples/usage.rs"

color-eyre/src/config.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ impl HookBuilder {
486486
/// .unwrap();
487487
///
488488
/// impl PanicMessage for MyPanicMessage {
489-
/// fn display(&self, pi: &std::panic::PanicInfo<'_>, f: &mut fmt::Formatter<'_>) -> fmt::Result {
489+
/// fn display(&self, pi: &std::panic::PanicHookInfo<'_>, f: &mut fmt::Formatter<'_>) -> fmt::Result {
490490
/// writeln!(f, "{}", "The application panicked (crashed).".red())?;
491491
///
492492
/// // Print panic message.
@@ -790,7 +790,11 @@ fn eyre_frame_filters(frames: &mut Vec<&Frame>) {
790790
struct DefaultPanicMessage(Theme);
791791

792792
impl PanicMessage for DefaultPanicMessage {
793-
fn display(&self, pi: &std::panic::PanicInfo<'_>, f: &mut fmt::Formatter<'_>) -> fmt::Result {
793+
fn display(
794+
&self,
795+
pi: &std::panic::PanicHookInfo<'_>,
796+
f: &mut fmt::Formatter<'_>,
797+
) -> fmt::Result {
794798
// XXX is my assumption correct that this function is guaranteed to only run after `color_eyre` was setup successfully (including setting `THEME`), and that therefore the following line will never panic? Otherwise, we could return `fmt::Error`, but if the above is true, I like `unwrap` + a comment why this never fails better
795799
let theme = &self.0;
796800

@@ -822,7 +826,7 @@ impl PanicMessage for DefaultPanicMessage {
822826
/// A type representing an error report for a panic.
823827
pub struct PanicReport<'a> {
824828
hook: &'a PanicHook,
825-
panic_info: &'a std::panic::PanicInfo<'a>,
829+
panic_info: &'a std::panic::PanicHookInfo<'a>,
826830
backtrace: Option<backtrace::Backtrace>,
827831
#[cfg(feature = "capture-spantrace")]
828832
span_trace: Option<tracing_error::SpanTrace>,
@@ -949,7 +953,7 @@ impl PanicHook {
949953
/// Convert self into the type expected by `std::panic::set_hook`.
950954
pub fn into_panic_hook(
951955
self,
952-
) -> Box<dyn Fn(&std::panic::PanicInfo<'_>) + Send + Sync + 'static> {
956+
) -> Box<dyn Fn(&std::panic::PanicHookInfo<'_>) + Send + Sync + 'static> {
953957
Box::new(move |panic_info| {
954958
eprintln!("{}", self.panic_report(panic_info));
955959
})
@@ -959,7 +963,7 @@ impl PanicHook {
959963
/// `Display` trait.
960964
pub fn panic_report<'a>(
961965
&'a self,
962-
panic_info: &'a std::panic::PanicInfo<'_>,
966+
panic_info: &'a std::panic::PanicHookInfo<'_>,
963967
) -> PanicReport<'a> {
964968
let v = panic_verbosity();
965969
let capture_bt = v != Verbosity::Minimal;

color-eyre/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@
355355
unused_parens,
356356
while_true
357357
)]
358-
#![allow(clippy::try_err)]
358+
#![allow(clippy::try_err, clippy::uninlined_format_args)]
359359

360360
use std::sync::Arc;
361361

color-eyre/src/section/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,12 @@ pub trait Section: crate::private::Sealed {
326326
fn suppress_backtrace(self, suppress: bool) -> Self::Return;
327327
}
328328

329-
/// Trait for printing a panic error message for the given PanicInfo
329+
/// Trait for printing a panic error message for the given PanicHookInfo
330330
pub trait PanicMessage: Send + Sync + 'static {
331331
/// Display trait equivalent for implementing the display logic
332-
fn display(&self, pi: &std::panic::PanicInfo<'_>, f: &mut fmt::Formatter<'_>) -> fmt::Result;
332+
fn display(
333+
&self,
334+
pi: &std::panic::PanicHookInfo<'_>,
335+
f: &mut fmt::Formatter<'_>,
336+
) -> fmt::Result;
333337
}

color-eyre/tests/bt_enabled.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use color_eyre::eyre;
22
use eyre::eyre;
33

44
#[test]
5+
#[allow(clippy::uninlined_format_args)]
56
fn enabled() {
67
color_eyre::config::HookBuilder::default()
78
.display_env_section(true)

color-eyre/tests/location_disabled.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#[cfg(feature = "track-caller")]
22
#[test]
3+
#[allow(clippy::uninlined_format_args)]
34
fn disabled() {
45
use color_eyre::eyre;
56
use eyre::eyre;

eyre/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@
360360
#![allow(
361361
clippy::needless_doctest_main,
362362
clippy::new_ret_no_self,
363+
clippy::uninlined_format_args,
363364
clippy::wrong_self_convention
364365
)]
365366

0 commit comments

Comments
 (0)