Skip to content

Commit 1b1bf8b

Browse files
committed
Add justfile
1 parent e4444c8 commit 1b1bf8b

File tree

3 files changed

+63
-8
lines changed

3 files changed

+63
-8
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,17 @@ jobs:
4747
uses: actions/checkout@v4
4848
- name: Disable bench dependencies
4949
run: ./.github/workflows/disable-bench-deps.sh
50+
- uses: extractions/setup-just@v3
5051
- name: Install Rust nightly
5152
run: |
5253
rustup toolchain install nightly
5354
rustup component add rustfmt --toolchain nightly
5455
- name: Restore cargo caches
5556
uses: Swatinem/rust-cache@v2
56-
- name: Check formatting
57-
run: cargo +nightly fmt --all --verbose -- --check
57+
- name: Check Rust formatting
58+
run: just fmt --verbose -- --check
59+
- name: Check justfile formatting
60+
run: just --unstable --fmt --check
5861

5962
test:
6063
strategy:
@@ -75,13 +78,17 @@ jobs:
7578
timezoneWindows: "China Standard Time"
7679
- name: Disable bench dependencies
7780
run: ./.github/workflows/disable-bench-deps.sh
81+
- uses: extractions/setup-just@v3
7882
- name: Install dependencies
7983
if: matrix.os == 'ubuntu-latest'
8084
run: sudo bash ./.github/workflows/install-deps.sh
8185
- name: Restore cargo caches
8286
uses: Swatinem/rust-cache@v2
83-
- name: Run tests
87+
- name: Run tests with selected features
8488
run: cargo test --features "${{ matrix.fn_features }} ${{ matrix.cfg_feature }}" --verbose
89+
- name: Run tests with all features
90+
if: matrix.fn_features == '' && matrix.cfg_feature == ''
91+
run: just test
8592
- name: Run examples
8693
if: matrix.fn_features != ''
8794
run: |
@@ -102,6 +109,7 @@ jobs:
102109
- name: Disable bench dependencies
103110
if: matrix.target != fromJSON(needs.matrix.outputs.ci_targets)[0]
104111
run: ./.github/workflows/disable-bench-deps.sh
112+
- uses: extractions/setup-just@v3
105113
- name: Install dependencies
106114
run: sudo bash ./.github/workflows/install-deps.sh
107115
- name: Install Rust nightly
@@ -116,7 +124,7 @@ jobs:
116124
- name: Restore cargo caches
117125
uses: Swatinem/rust-cache@v2
118126
- name: Run clippy
119-
run: cargo clippy --all-features --tests --examples -- -D warnings
127+
run: just clippy -- -D warnings
120128
- name: Run clippy nightly
121129
run: |
122130
cargo +nightly clippy --all-features --tests --examples
@@ -148,6 +156,7 @@ jobs:
148156
uses: actions/checkout@v4
149157
- name: Disable bench dependencies
150158
run: ./.github/workflows/disable-bench-deps.sh
159+
- uses: extractions/setup-just@v3
151160
- name: Install dependencies
152161
run: sudo bash ./.github/workflows/install-deps.sh
153162
- name: Install Rust target
@@ -157,7 +166,7 @@ jobs:
157166
- name: Restore cargo caches
158167
uses: Swatinem/rust-cache@v2
159168
- name: Run check
160-
run: cargo check --all-features --verbose
169+
run: just check --verbose
161170

162171
check-doc:
163172
strategy:
@@ -168,6 +177,7 @@ jobs:
168177
uses: actions/checkout@v4
169178
- name: Disable bench dependencies
170179
run: ./.github/workflows/disable-bench-deps.sh
180+
- uses: extractions/setup-just@v3
171181
- name: Install dependencies
172182
run: sudo bash ./.github/workflows/install-deps.sh
173183
- name: Install Rust nightly
@@ -177,10 +187,10 @@ jobs:
177187
- name: Run rustdoc nightly
178188
run: |
179189
RUSTDOCFLAGS='-D warnings -A rustdoc::broken-intra-doc-links'
180-
cargo +nightly doc --verbose -Z unstable-options -Z rustdoc-scrape-examples
190+
just _doc-default-features --verbose
181191
182192
RUSTDOCFLAGS='-D warnings'
183-
cargo +nightly doc --all-features --verbose -Z unstable-options -Z rustdoc-scrape-examples
193+
just doc --verbose
184194
185195
check-msrv:
186196
needs: [matrix]
@@ -347,13 +357,14 @@ jobs:
347357
uses: actions/checkout@v4
348358
- name: Disable bench dependencies
349359
run: ./.github/workflows/disable-bench-deps.sh
360+
- uses: extractions/setup-just@v3
350361
- name: Install Rust nightly
351362
run: rustup toolchain install nightly
352363
- name: Restore cargo caches
353364
uses: Swatinem/rust-cache@v2
354365
- name: Run benchmark
355366
run: |
356-
cargo +nightly bench --features "multi-thread,runtime-pattern,serde_json,log" \
367+
just bench \
357368
--bench spdlog_rs \
358369
--bench spdlog_rs_pattern \
359370
--bench spdlog_rs_log_crate_proxy \

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ Unreleased commits are active on [`main-dev`] branch, and [`main`] branch is onl
4545

4646
If you are going to contribute `spdlog-rs`, please make sure to check out the [`main-dev`] branch and select the [`main-dev`] branch as the base when opening PR.
4747

48+
Due to the complexity of combining crate feature gates, this repository provides a [justfile] for tool [`just`] to easily interact with `cargo` during development. Run command `just --list` to check the available recipes specifically for this project.
49+
4850
## Supported Rust versions
4951

5052
<!--
@@ -82,3 +84,5 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
8284
[open an issue]: https://github.com/SpriteOvO/spdlog-rs/issues/new/choose
8385
[`main-dev`]: https://github.com/SpriteOvO/spdlog-rs/tree/main-dev
8486
[`main`]: https://github.com/SpriteOvO/spdlog-rs/tree/main
87+
[justfile]: /justfile
88+
[`just`]: https://github.com/casey/just

justfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
just := 'just' + ' --justfile=' + justfile()
2+
3+
_:
4+
@{{ just }} --list
5+
6+
alias format := fmt
7+
8+
fmt *ARGS:
9+
cargo +nightly fmt --all {{ ARGS }}
10+
11+
test *ARGS:
12+
cargo test \
13+
--features 'log native libsystemd multi-thread runtime-pattern serde serde_json sval' \
14+
--features 'flexible-string source-location test' \
15+
{{ ARGS }}
16+
17+
clippy *ARGS:
18+
cargo clippy --all-features --tests --examples {{ ARGS }}
19+
20+
check *ARGS:
21+
cargo check --all-features {{ ARGS }}
22+
23+
_doc-default-features *ARGS:
24+
cargo +nightly doc -Z unstable-options -Z rustdoc-scrape-examples {{ ARGS }}
25+
26+
doc *ARGS:
27+
@{{ just }} _doc-default-features --all-features {{ ARGS }}
28+
29+
bench *ARGS:
30+
cargo +nightly bench --features 'multi-thread runtime-pattern serde_json log' {{ ARGS }}
31+
32+
[private]
33+
publish crate-name *ARGS:
34+
cargo clean
35+
cargo package --package {{ crate-name }}
36+
@{{ just }} _publish-confirmed {{ crate-name }} {{ ARGS }}
37+
38+
[confirm("Please check 'target/package' directory, keep going? (y/N)")]
39+
_publish-confirmed crate-name *ARGS:
40+
cargo publish --package {{ crate-name }} {{ ARGS }}

0 commit comments

Comments
 (0)