Skip to content

Commit 25a5a82

Browse files
authored
chore: update justfile and CI steps, no functional changes (#46)
- [x] I agree to follow the project's [code of conduct](https://github.com/georust/geo/blob/master/CODE_OF_CONDUCT.md). ~- [ ] I added an entry to `CHANGES.md` if knowledge of this change could be valuable to users.~ ---
1 parent 0da0c0e commit 25a5a82

10 files changed

Lines changed: 95 additions & 64 deletions

File tree

.editorconfig

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
root = true
22

33
[*]
4-
indent_style = space
5-
indent_size = 4
64
charset = utf-8
7-
trim_trailing_whitespace = true
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
88
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
indent_size = 2
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2
16+
17+
[LICENSE-{APACHE,MIT}]
18+
indent_size = unset
19+
20+
[*.lock]
21+
indent_size = unset

.github/workflows/ci.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
name: Test
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: actions/checkout@v5
23+
- uses: actions/checkout@v7
2424
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
2525
uses: Swatinem/rust-cache@v2
2626
- uses: taiki-e/install-action@v2
@@ -31,36 +31,38 @@ jobs:
3131
name: Test MSRV
3232
runs-on: ubuntu-latest
3333
steps:
34-
- uses: actions/checkout@v5
34+
- uses: actions/checkout@v7
3535
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
3636
uses: Swatinem/rust-cache@v2
3737
- uses: taiki-e/install-action@v2
38-
with: { tool: 'just' }
38+
with: { tool: 'just,cargo-binstall,cargo-minimal-versions,cargo-hack' }
3939
- name: Read MSRV
4040
id: msrv
4141
run: echo "value=$(just get-msrv)" >> $GITHUB_OUTPUT
42+
- name: Install nightly Rust for minimal dependency resolution
43+
uses: dtolnay/rust-toolchain@stable
44+
with: { toolchain: nightly }
4245
- name: Install MSRV Rust ${{ steps.msrv.outputs.value }}
4346
uses: dtolnay/rust-toolchain@stable
4447
with:
4548
toolchain: ${{ steps.msrv.outputs.value }}
46-
- run: just ci_mode=0 ci-test-msrv # Ignore warnings in MSRV
49+
- run: just ci-test-msrv
4750

4851
coverage:
4952
name: Code Coverage
5053
if: github.event_name != 'release'
5154
runs-on: ubuntu-latest
5255
steps:
53-
- uses: actions/checkout@v5
56+
- uses: actions/checkout@v7
5457
- uses: Swatinem/rust-cache@v2
5558
- uses: taiki-e/install-action@v2
5659
with: { tool: 'just,cargo-llvm-cov' }
57-
- name: Generate code coverage
58-
run: just ci-coverage
60+
- run: just ci-coverage
5961
- name: Upload coverage to Codecov
60-
uses: codecov/codecov-action@v5
62+
uses: codecov/codecov-action@v7
6163
with:
6264
token: ${{ secrets.CODECOV_TOKEN }}
63-
files: target/llvm-cov/codecov.info
65+
files: target/llvm-cov/lcov.info
6466

6567
# This job checks if any of the previous jobs failed or were canceled.
6668
# This approach also allows some jobs to be skipped if they are not needed.
@@ -92,7 +94,7 @@ jobs:
9294
group: release-plz-${{ github.ref }}
9395
cancel-in-progress: false
9496
steps:
95-
- uses: actions/checkout@v5
97+
- uses: actions/checkout@v7
9698
with: { fetch-depth: 0 }
9799
- uses: dtolnay/rust-toolchain@stable
98100
- name: Publish to crates.io if crate's version is newer

.github/workflows/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
steps:
99
- name: Dependabot metadata
1010
id: metadata
11-
uses: dependabot/fetch-metadata@v2
11+
uses: dependabot/fetch-metadata@v3
1212
- name: Approve Dependabot PRs
1313
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
1414
run: gh pr review --approve "$PR_URL"

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
**/*.rs.bk
2+
*.iml
23
*.pdb
4+
.DS_Store
35
.idea/
46
.vscode/
7+
codecov
8+
codecov.SHA256SUM*
59
debug/
10+
flamegraph*.svg
11+
perf.data*
612
target/
713
temp/
814
tmp/

.pre-commit-config.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ repos:
2020
- id: trailing-whitespace
2121

2222
- repo: https://github.com/Lucas-C/pre-commit-hooks
23-
rev: v1.5.5
23+
rev: v1.5.6
2424
hooks:
2525
- id: forbid-tabs
2626
- id: remove-tabs
@@ -33,3 +33,8 @@ repos:
3333
entry: sh -c "cargo fmt --all"
3434
language: rust
3535
pass_filenames: false
36+
37+
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
38+
rev: 3.6.1
39+
hooks:
40+
- id: editorconfig-checker

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ categories = ["science::geo"]
1717
rust-version = "1.78"
1818

1919
[dependencies]
20-
serde = { version = "1", features = ["derive"] }
21-
serde_json = "1"
20+
serde = { version = "1.0.103", features = ["derive"] }
21+
serde_json = "1.0.50"
2222
serde_tuple = "1.1.0"
2323
thiserror = "2"
2424

LICENSE-APACHE

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -174,28 +174,3 @@ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
174174
of your accepting any such warranty or additional liability.
175175

176176
END OF TERMS AND CONDITIONS
177-
178-
APPENDIX: How to apply the Apache License to your work.
179-
180-
To apply the Apache License to your work, attach the following
181-
boilerplate notice, with the fields enclosed by brackets "[]"
182-
replaced with your own identifying information. (Don't include
183-
the brackets!) The text should be enclosed in the appropriate
184-
comment syntax for the file format. We also recommend that a
185-
file or class name and description of purpose be included on the
186-
same "printed page" as the copyright notice for easier
187-
identification within third-party archives.
188-
189-
Copyright [yyyy] [name of copyright owner]
190-
191-
Licensed under the Apache License, Version 2.0 (the "License");
192-
you may not use this file except in compliance with the License.
193-
You may obtain a copy of the License at
194-
195-
http://www.apache.org/licenses/LICENSE-2.0
196-
197-
Unless required by applicable law or agreed to in writing, software
198-
distributed under the License is distributed on an "AS IS" BASIS,
199-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200-
See the License for the specific language governing permissions and
201-
limitations under the License.

clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
allow-mixed-uninlined-format-args = false
12
allow-unwrap-in-tests = true
23
avoid-breaking-exported-api = false

codecov.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
codecov:
2+
require_ci_to_pass: false
3+
4+
coverage:
5+
status:
6+
patch: off

justfile

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#!/usr/bin/env just --justfile
22

3-
# Define the name of the main crate based
4-
main_crate := file_name(justfile_directory())
3+
main_crate := 'tilejson'
54
# How to call the current just executable. Note that just_executable() may have `\` in Windows paths, so we need to quote it.
65
just := quote(just_executable())
76
# cargo-binstall needs a workaround due to caching when used in CI
87
binstall_args := if env('CI', '') != '' {'--no-confirm --no-track --disable-telemetry'} else {''}
8+
# location of the coverage output, used by CI
9+
coverage_lcov := 'target/llvm-cov/lcov.info'
910

1011
# if running in CI, treat warnings as errors by setting RUSTFLAGS and RUSTDOCFLAGS to '-D warnings' unless they are already set
1112
# Use `CI=true just ci-test` to run the same tests as in GitHub CI.
@@ -26,17 +27,23 @@ build:
2627
check:
2728
cargo check --workspace --all-features --all-targets
2829

29-
# Generate code coverage report to upload to codecov.io
30+
# Generate LCOV coverage report for CI to upload to codecov.io
3031
ci-coverage: env-info && \
31-
(coverage '--codecov --output-path target/llvm-cov/codecov.info')
32-
# ATTENTION: the full file path above is used in the CI workflow
33-
mkdir -p target/llvm-cov
32+
(_coverage '--lcov' '--output-path' quote(coverage_lcov))
33+
rm -rf {{quote(parent_directory(coverage_lcov))}}
34+
mkdir -p {{quote(parent_directory(coverage_lcov))}}
3435

3536
# Run all tests as expected by CI
36-
ci-test: env-info test-fmt clippy check test test-doc && assert-git-is-clean
37+
ci-test: env-info test-fmt clippy test test-doc && assert-git-is-clean
3738

38-
# Run minimal subset of tests to ensure compatibility with MSRV
39-
ci-test-msrv: env-info check test
39+
# Compile default features with minimal dependencies on the configured MSRV
40+
ci-test-msrv:
41+
{{just}} ci_mode=0 env-info _check-msrv-default
42+
{{just}} assert-git-is-clean
43+
44+
# Set toolchain and run ci-test-msrv
45+
ci-test-msrv-with-toolchain:
46+
RUSTUP_TOOLCHAIN="$({{just}} get-msrv)" {{just}} ci-test-msrv
4047

4148
# Clean all build artifacts
4249
clean:
@@ -47,9 +54,14 @@ clean:
4754
clippy *args:
4855
cargo clippy --workspace --all-features --all-targets {{args}}
4956

50-
# Generate code coverage report. Will install `cargo llvm-cov` if missing.
51-
coverage *args='--no-clean --open': (cargo-install 'cargo-llvm-cov')
52-
cargo llvm-cov --workspace --all-features --all-targets --include-build-script {{args}}
57+
# Generate and open the HTML coverage report
58+
coverage: (_coverage '--open')
59+
60+
# Clean, collect, and aggregate coverage using the requested report arguments
61+
_coverage *report_args: (cargo-install 'cargo-llvm-cov')
62+
cargo llvm-cov clean --workspace
63+
cargo llvm-cov --no-report --workspace --all-features --all-targets
64+
cargo llvm-cov report --include-build-script {{report_args}}
5365

5466
# Build and open code documentation
5567
docs *args='--open':
@@ -58,7 +70,7 @@ docs *args='--open':
5870
# Print environment info
5971
env-info:
6072
@echo "Running for '{{main_crate}}' crate {{if ci_mode == '1' {'in CI mode'} else {'in dev mode'} }} on {{os()}} / {{arch()}}"
61-
@echo "PWD $(pwd)"
73+
@echo "PWD {{justfile_directory()}}"
6274
{{just}} --version
6375
rustc --version
6476
cargo --version
@@ -85,14 +97,25 @@ fmt-toml *args: (cargo-install 'cargo-sort')
8597

8698
# Get a package field from the metadata
8799
get-crate-field field package=main_crate: (assert-cmd 'jq')
88-
cargo metadata --format-version 1 | jq -e -r '.packages | map(select(.name == "{{package}}")) | first | .{{field}} // error("Field \"{{field}}\" is missing in Cargo.toml for package {{package}}")'
100+
@cargo metadata --no-deps --format-version 1 | jq -e -r '.packages | map(select(.name == "{{package}}")) | first | .{{field}} // error("Field \"{{field}}\" is missing in Cargo.toml for package {{package}}")'
89101

90102
# Get the minimum supported Rust version (MSRV) for the crate
91103
get-msrv package=main_crate: (get-crate-field 'rust_version' package)
92104

93-
# Find the minimum supported Rust version (MSRV) using cargo-msrv extension, and update Cargo.toml
105+
# Find the minimum supported Rust version (MSRV), update Cargo.toml, and test minimal dependencies
94106
msrv: (cargo-install 'cargo-msrv')
95-
cargo msrv find --write-msrv --ignore-lockfile --all-features
107+
cargo msrv find --write-msrv --ignore-lockfile -- {{just}} _check-msrv-default
108+
109+
# Compile the crate's default features using a dynamically generated minimal Cargo.lock
110+
_check-msrv-default: (cargo-install 'cargo-minimal-versions') (cargo-install 'cargo-hack')
111+
#!/usr/bin/env bash
112+
set -euo pipefail
113+
# cargo-msrv probes with rustup, but nested cargo subcommands may otherwise
114+
# fall back to the default Cargo and emit flags unsupported by the candidate rustc.
115+
toolchain="$(rustc --version | cut -d' ' -f2)"
116+
export RUSTUP_TOOLCHAIN="$toolchain"
117+
export CARGO="$(rustup which --toolchain "$toolchain" cargo)"
118+
cargo minimal-versions check --direct --package {{main_crate}}
96119
97120
# Run cargo-release
98121
release *args='': (cargo-install 'release-plz')
@@ -102,7 +125,7 @@ release *args='': (cargo-install 'release-plz')
102125
semver *args: (cargo-install 'cargo-semver-checks')
103126
cargo semver-checks --all-features {{args}}
104127

105-
# Run all unit and integration tests
128+
# Run all tests
106129
test:
107130
cargo test --workspace --all-features --all-targets
108131
cargo test --doc --workspace --all-features
@@ -135,11 +158,11 @@ assert-cmd command:
135158
[private]
136159
assert-git-is-clean:
137160
@if [ -n "$(git status --untracked-files --porcelain)" ]; then \
138-
>&2 echo "ERROR: git repo is no longer clean. Make sure compilation and tests artifacts are in the .gitignore, and no repo files are modified." ;\
139-
>&2 echo "######### git status ##########" ;\
140-
git status ;\
141-
git --no-pager diff ;\
142-
exit 1 ;\
161+
>&2 echo "ERROR: git repo is no longer clean. Make sure compilation and tests artifacts are in the .gitignore, and no repo files are modified." ;\
162+
>&2 echo "######### git status ##########" ;\
163+
git status ;\
164+
git --no-pager diff ;\
165+
exit 1 ;\
143166
fi
144167

145168
# Check if a certain Cargo command is installed, and install it if needed

0 commit comments

Comments
 (0)