generated from PlexSheep/baserepo
Compare commits
No commits in common. "master" and "v0.7.3-alpha.0" have entirely different histories.
master
...
v0.7.3-alp
|
@ -21,6 +21,8 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
rustup component add rustfmt
|
rustup component add rustfmt
|
||||||
rustup component add clippy
|
rustup component add clippy
|
||||||
|
- name: install python
|
||||||
|
run: apt update && apt install libpython3-dev -y
|
||||||
- name: config custom registry
|
- name: config custom registry
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.cargo/
|
mkdir -p ~/.cargo/
|
||||||
|
@ -43,4 +45,4 @@ jobs:
|
||||||
with:
|
with:
|
||||||
# Optional. Commit message for the created commit.
|
# Optional. Commit message for the created commit.
|
||||||
# Defaults to "Apply automatic changes"
|
# Defaults to "Apply automatic changes"
|
||||||
commit_message: "ci: automatic cargo CI changes"
|
commit_message: automatic cargo CI changes
|
|
@ -1,7 +0,0 @@
|
||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "github-actions"
|
|
||||||
directory: "/"
|
|
||||||
# Check for updates every Monday
|
|
||||||
schedule:
|
|
||||||
interval: "weekly"
|
|
|
@ -1,16 +1,10 @@
|
||||||
name: Rust CI
|
name: cargo devel CI
|
||||||
on:
|
on:
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- '**'
|
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- '**'
|
- '**'
|
||||||
# - '!master'
|
# - '!master'
|
||||||
|
|
||||||
env:
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
CI:
|
CI:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -48,10 +42,10 @@ jobs:
|
||||||
- name: cargo fmt
|
- name: cargo fmt
|
||||||
run: cargo fmt --all
|
run: cargo fmt --all
|
||||||
- name: cargo test
|
- name: cargo test
|
||||||
run: cargo test --all-features --all-targets --workspace
|
run: cargo test --all-features --all-targets --workspace && cargo test --all-features --workspace --doc
|
||||||
- name: commit back to repository
|
- name: commit back to repository
|
||||||
uses: stefanzweifel/git-auto-commit-action@v5
|
uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
with:
|
with:
|
||||||
# Optional. Commit message for the created commit.
|
# Optional. Commit message for the created commit.
|
||||||
# Defaults to "Apply automatic changes"
|
# Defaults to "Apply automatic changes"
|
||||||
commit_message: "ci: automatic Rust CI changes"
|
commit_message: automatic cargo CI changes
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
name: Release-plz
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
pull-requests: write
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
# Release unpublished packages.
|
|
||||||
release-plz-release:
|
|
||||||
name: Release-plz release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Install Rust toolchain
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
- name: Run release-plz
|
|
||||||
uses: MarcoIeni/release-plz-action@v0.5
|
|
||||||
with:
|
|
||||||
command: release
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
||||||
|
|
||||||
# Create a PR with the new versions and changelog, preparing the next release.
|
|
||||||
release-plz-pr:
|
|
||||||
name: Release-plz PR
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
concurrency:
|
|
||||||
group: release-plz-${{ github.ref }}
|
|
||||||
cancel-in-progress: false
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Install Rust toolchain
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
- name: Run release-plz
|
|
||||||
uses: MarcoIeni/release-plz-action@v0.5
|
|
||||||
with:
|
|
||||||
command: release-pr
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
|
@ -5,7 +5,7 @@ default-members = [".", "members/libpt-core"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
publish = true
|
publish = true
|
||||||
version = "0.7.3-alpha.2"
|
version = "0.7.3-alpha.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Christoph J. Scherr <software@cscherr.de>"]
|
authors = ["Christoph J. Scherr <software@cscherr.de>"]
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
|
@ -21,8 +21,8 @@ anyhow = "1.0.79"
|
||||||
thiserror = "1.0.56"
|
thiserror = "1.0.56"
|
||||||
libpt-core = { version = "0.5.0", path = "members/libpt-core" }
|
libpt-core = { version = "0.5.0", path = "members/libpt-core" }
|
||||||
libpt-bintols = { version = "0.5.1", path = "members/libpt-bintols" }
|
libpt-bintols = { version = "0.5.1", path = "members/libpt-bintols" }
|
||||||
libpt-log = { version = "0.6.2-alpha.1", path = "members/libpt-log" }
|
libpt-log = { version = "0.6.2-alpha.0", path = "members/libpt-log" }
|
||||||
libpt-cli = { version = "0.2.2-alpha.1", path = "members/libpt-cli" }
|
libpt-cli = { version = "0.2.2-alpha.0", path = "members/libpt-cli" }
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "libpt"
|
name = "libpt"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "libpt-cli"
|
name = "libpt-cli"
|
||||||
publish.workspace = true
|
publish.workspace = true
|
||||||
version = "0.2.2-alpha.2"
|
version = "0.2.2-alpha.0"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "libpt-log"
|
name = "libpt-log"
|
||||||
publish.workspace = true
|
publish.workspace = true
|
||||||
version = "0.6.2-alpha.2"
|
version = "0.6.2-alpha.0"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
|
|
|
@ -20,6 +20,4 @@ pub enum Error {
|
||||||
/// any other error type, wrapped in [`anyhow::Error`]
|
/// any other error type, wrapped in [`anyhow::Error`]
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Other(#[from] anyhow::Error),
|
Other(#[from] anyhow::Error),
|
||||||
#[error("Tried to open the logfile, but logging to file was not requested")]
|
|
||||||
LogfileButNoFilelog,
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,23 +151,9 @@ impl LoggerBuilder {
|
||||||
));
|
));
|
||||||
if self.log_to_file {
|
if self.log_to_file {
|
||||||
tracing_subscriber::registry()
|
tracing_subscriber::registry()
|
||||||
.with(layer.and_then({
|
.with(layer.and_then(
|
||||||
tracing_subscriber::fmt::layer()
|
tracing_subscriber::fmt::layer().with_writer(self.logfile().unwrap()),
|
||||||
.with_writer(
|
|
||||||
self.logfile()?
|
|
||||||
.expect("logging to file is requested but logfile returned None"),
|
|
||||||
)
|
|
||||||
.with_ansi(self.ansi)
|
|
||||||
.with_target(self.display_target)
|
|
||||||
.with_file(self.display_filename)
|
|
||||||
.with_thread_ids(self.display_thread_ids)
|
|
||||||
.with_line_number(self.display_line_number)
|
|
||||||
.with_thread_names(self.display_thread_names)
|
|
||||||
.with_span_events(self.span_events.clone())
|
|
||||||
.with_filter(tracing::level_filters::LevelFilter::from_level(
|
|
||||||
self.max_level,
|
|
||||||
))
|
))
|
||||||
}))
|
|
||||||
.init();
|
.init();
|
||||||
} else {
|
} else {
|
||||||
tracing_subscriber::registry().with(layer).init();
|
tracing_subscriber::registry().with(layer).init();
|
||||||
|
@ -177,24 +163,25 @@ impl LoggerBuilder {
|
||||||
Ok(Logger {})
|
Ok(Logger {})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Opens a new file for logging to.
|
fn logfile(&self) -> Option<std::fs::File> {
|
||||||
///
|
|
||||||
/// Format: `{log_dir}/{consumer_name}_2024-09-01.log`
|
|
||||||
///
|
|
||||||
/// Will be none if [`Self::log_to_file`] is [false].
|
|
||||||
fn logfile(&self) -> Result<Option<std::fs::File>> {
|
|
||||||
if !self.log_to_file {
|
if !self.log_to_file {
|
||||||
return Err(Error::LogfileButNoFilelog.into());
|
return None;
|
||||||
}
|
}
|
||||||
let mut path = self.log_dir.clone();
|
let mut path = self.log_dir.clone();
|
||||||
std::fs::create_dir_all(&path)?;
|
|
||||||
path.push(format!(
|
path.push(format!(
|
||||||
"{}_{}.log",
|
"{}.{}.log",
|
||||||
libpt_core::get_crate_name().unwrap_or_else(|| "logfile".to_string()),
|
libpt_core::get_crate_name().unwrap_or_else(|| "logfile".to_string()),
|
||||||
chrono::Local::now().date_naive()
|
chrono::Local::now().date_naive()
|
||||||
));
|
));
|
||||||
let file = std::fs::File::create(path)?;
|
let file = match std::fs::File::create(path) {
|
||||||
Ok(Some(file))
|
Ok(f) => f,
|
||||||
|
Err(e) => {
|
||||||
|
eprintln!("libpt: could not start logging to file: {e}");
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Some(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// enable or disable logging to and creating of logfiles
|
/// enable or disable logging to and creating of logfiles
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
cargo check --all-features --workspace
|
cargo check --all-features --workspace
|
||||||
echo ">>>>>>>> SELECT A NEW VERSION"
|
|
||||||
cargo ws version
|
|
||||||
NEW_VERSION=$(cat Cargo.toml | rg '^\s*version\s*=\s*"([^"]*)"\s*$' -or '$1')
|
|
||||||
echo ">>>>>>>> PUBLISHING RELEASE FOR REPO"
|
echo ">>>>>>>> PUBLISHING RELEASE FOR REPO"
|
||||||
bash scripts/release.sh
|
bash scripts/release.sh
|
||||||
echo ">>>>>>>> PUBLISHING TO CRATES.IO NEXT"
|
echo ">>>>>>>> PUBLISHING TO CRATES.IO NEXT"
|
||||||
|
|
Reference in New Issue