Skip to content

Commit

Permalink
Merge pull request #146 from daboross/daboross/cleanup
Browse files Browse the repository at this point in the history
Misc. repository cleanup
  • Loading branch information
daboross authored Dec 15, 2024
2 parents 09d86b6 + fdba420 commit f24e11e
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 215 deletions.
179 changes: 32 additions & 147 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ name: tests

on:
push:
branches: main
pull_request:
branches: main

env:
CARGO_TERM_COLOR: always

jobs:
test:
name: Test Suite
name: Run Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -21,64 +19,26 @@ jobs:
os:
- ubuntu-latest
- windows-latest
toolchain:
- stable
- 1.70.0
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: build
args: --lib --bins --examples --tests --benches
- uses: actions-rs/cargo@v1
with:
command: build
args: --lib --bins --examples --tests --benches --all-features
- uses: actions-rs/cargo@v1
with:
command: test
- uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features
- uses: actions-rs/cargo@v1
with:
command: test
args: --features=colored
- uses: actions-rs/cargo@v1
with:
command: test
args: --features=syslog-3
- uses: actions-rs/cargo@v1
with:
command: test
args: --features=syslog-4
- uses: actions-rs/cargo@v1
with:
command: test
args: --features=syslog-6
- uses: actions-rs/cargo@v1
with:
command: test
args: --features=syslog-7
- uses: actions-rs/cargo@v1
with:
command: test
args: --features=reopen-03
- uses: actions-rs/cargo@v1
with:
command: test
args: --features=reopen-1
- uses: actions-rs/cargo@v1
with:
command: test
args: --features=meta-logging-in-format
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-features
- uses: actions/checkout@v4
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo build --all-targets
- run: cargo build --all-targets --no-default-features
- run: cargo build --all-targets --all-features
- run: cargo test
- run: cargo test --no-default-features
- run: cargo test --features=colored
- run: cargo test --features=syslog-3
- run: cargo test --features=syslog-4
- run: cargo test --features=syslog-6
- run: cargo test --features=syslog-7
- run: cargo test --features=reopen-03
- run: cargo test --features=reopen-1
- run: cargo test --features=meta-logging-in-format
- run: cargo test --all-features
- run: cargo run --example cmd-program
- run: cargo run --example cmd-program -- --verbose
- run: cargo run --example colored --features colored
Expand All @@ -90,115 +50,40 @@ jobs:
env:
RUSTDOCFLAGS: -D warnings
linux:
name: Linux-only Examples
name: Linux Examples
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
toolchain:
- stable
- 1.70.0
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions/checkout@v4
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo run --example syslog3 --features syslog-3
- run: cargo run --example syslog4 --features syslog-4
- run: cargo run --example syslog --features syslog-6
- run: cargo run --example syslog7 --features syslog-7
msrv:
name: MSRV Compatability - fern
name: MSRV Compat
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
# when updating this, also update rust-version in Cargo.toml
toolchain: 1.60.0
override: true
- uses: actions/checkout@v4
- run: rustup update 1.60.0 && rustup default 1.60.0
- run: cargo build
msrv2:
name: MSRV Compatability - fern/date-based
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.63.0
override: true
- run: cargo build --features date-based
- run: cargo build --features reopen-1,reopen-03,meta-logging-in-format,syslog-3
msrv_syslog_4:
name: MSRV Compatability - fern/syslog-4
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.65.0
override: true
- run: cargo build --features syslog-4
msrv_syslog_6:
name: MSRV Compatability - fern/syslog-6
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.67.1
override: true
- run: cargo build --features syslog-6
msrv_syslog_7:
name: MSRV Compatability - fern/syslog-7
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.67.1
override: true
- run: cargo build --features syslog-7
fmt_and_clippy:
optional_lints:
name: Optional Lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions/checkout@v4
- run: rustup update stable && rustup default stable
- run: cargo fmt --check
- run: cargo clippy --all-features --all-targets -- -D warnings
53 changes: 25 additions & 28 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
### Contributing
# Contributing

#### Getting started (section in README)

Contributions are welcome!
## Overview (mirrored in README)

The easiest way for you to contribute right now is to use `fern` in your application, and see where it's lacking. The current library should have a solid base, but not many log adapters or niche features.
There's one thing I need right now, more than anything else: input on what fern does well, and what it should keep
doing well. See [Project Direction](#project-direction).

If you have a use case `fern` does not cover, filing an issue will be immensely useful to me, to anyone wanting to contribute to the project, and (hopefully) to you once the feature is implemented!
Besides that, I'm open to PRs! I'll probably review promptly, and I'm always open to being nudged if I don't.

If you've just filed an issue, or you want to approach one of our [existing ones](https://github.com/daboross/fern/issues), mentoring is available! Tag me with @daboross on an issue, or send me an email at daboross @ daboross.net, and I'll be available to help.
For small PRs, I'll mark anything I need changed in a review, and work with you on that.

As a note, all contributions are expected to follow [the Rust Code of Conduct](https://www.rust-lang.org/en-US/conduct.html).
For larger PRs, I reserve the right to pull in your commits as they are, then fix things I want to be different myself.
In a workplace, I'd try to never do this - but this is a hobby project for me, and I'd rather be overly particular about
fern's implementation than be reasonable.

#### `fern` project structure
This is a change from my previous policy.

## Code of Conduct.

All interactions are expected to follow [the Rust Code of Conduct](https://www.rust-lang.org/en-US/conduct.html).

## `fern` project structure

Fern attempts to be an idiomatic rust library and to maintain a sane structure. All source code is located in `src/`, and tests are in `tests/`.

Expand All @@ -24,40 +32,29 @@ The source is split into four modules:

Hopefully these modules are fairly separated, and it's clear when you'll need to work on multiple sections. Adding a new log implementation, for instance, will need to touch `builders.rs` for configuration, and `log_impl.rs` for the implementation - both pieces of code will connect via `builders::Dispatch::into_dispatch`, but besides that, things should be fairly separate.

#### Pull requests
## Pull requests

Pull requests are _the_ way to change code using git. If you aren't familiar with them in general, GitHub has some [excellent documentation](https://help.github.com/articles/about-pull-requests/).

There aren't many hard guidelines in this repository on how specifically to format your request. Main points:

- Please include a descriptive title for your pull request, and elaborate on what's changed in the description.
- Feel free to open a PR before the feature is completely ready, and commit directly to the PR branch.
- This is also great for review of PRs before merging
- All commits will be squashed together on merge, so don't worry about force pushing yourself.
- Please include at least a short description in each commit, and more of one in the "main" feature commit. Doesn't
have to be much, but someone reading the history should easily tell what's different now from before.
- If you have `rustfmt-nightly` installed, using it is recommended. I can also format the code after merging the code,
but formatting it consistently will make reviewing nicer.

### Testing
- Use `cargo fmt` to format your code.

## Testing

Building fern is as easy as is expected, `cargo build`.

As of fern 0.5, testing can also easily be done with `cargo test`.

To run and test the example programs, use:
To run build everything and run all tests, use:

```sh
cargo run --example cmd-program # test less logging
cargo run --example cmd-program -- --verbose # test more logging
cargo run --example colored --features=colored # test colored log levels
cargo build --all-features --all-targets
cargo test --all-features
```

Feel free to add tests and examples demonstrating new features as you see fit. Pull requests which solely add new/interesting example programs are also welcome.

### Mentoring
## Mentoring

With all that said, contributing to a library, especially if new to rust, can be daunting.
Contributing to a project can be daunting.

Feel free to email me at daboross @ daboross.net with any questions!
Email me at daboross @ daboross.net with any questions!
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name = "fern"
version = "0.7.1"
authors = ["David Ross <[email protected]>"]
description = "Simple, efficient logging"
edition = "2018"
edition = "2021"
# when updating this, also update toolchain in .github/workflows/rust.yml
rust-version = "1.60"

Expand Down
Loading

0 comments on commit f24e11e

Please sign in to comment.