From f1b5252614991e2cbc852e4cd3fa5a72e2ba7c9f Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Mon, 22 Jun 2026 18:29:24 -0400 Subject: [PATCH 1/2] chore: update justfile and CI steps, no functional changes --- .editorconfig | 19 +++++++-- .github/workflows/ci.yml | 22 ++++++----- .github/workflows/dependabot.yml | 2 +- .gitignore | 2 + .pre-commit-config.yaml | 7 +++- Cargo.toml | 4 +- LICENSE-APACHE | 25 ------------ clippy.toml | 1 + codecov.yml | 6 +++ justfile | 67 +++++++++++++++++++++----------- 10 files changed, 91 insertions(+), 64 deletions(-) create mode 100644 codecov.yml diff --git a/.editorconfig b/.editorconfig index f9366fa..69ab656 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,8 +1,21 @@ root = true [*] -indent_style = space -indent_size = 4 charset = utf-8 -trim_trailing_whitespace = true +end_of_line = lf +indent_size = 4 +indent_style = space insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +indent_size = 2 + +[*.{yml,yaml}] +indent_size = 2 + +[LICENSE-{APACHE,MIT}] +indent_size = unset + +[*.lock] +indent_size = unset diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75f5a32..f0ba691 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: name: Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v7 - if: github.event_name != 'release' && github.event_name != 'workflow_dispatch' uses: Swatinem/rust-cache@v2 - uses: taiki-e/install-action@v2 @@ -31,36 +31,38 @@ jobs: name: Test MSRV runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v7 - if: github.event_name != 'release' && github.event_name != 'workflow_dispatch' uses: Swatinem/rust-cache@v2 - uses: taiki-e/install-action@v2 - with: { tool: 'just' } + with: { tool: 'just,cargo-binstall,cargo-minimal-versions,cargo-hack' } - name: Read MSRV id: msrv run: echo "value=$(just get-msrv)" >> $GITHUB_OUTPUT + - name: Install nightly Rust for minimal dependency resolution + uses: dtolnay/rust-toolchain@stable + with: { toolchain: nightly } - name: Install MSRV Rust ${{ steps.msrv.outputs.value }} uses: dtolnay/rust-toolchain@stable with: toolchain: ${{ steps.msrv.outputs.value }} - - run: just ci_mode=0 ci-test-msrv # Ignore warnings in MSRV + - run: just ci-test-msrv coverage: name: Code Coverage if: github.event_name != 'release' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v7 - uses: Swatinem/rust-cache@v2 - uses: taiki-e/install-action@v2 with: { tool: 'just,cargo-llvm-cov' } - - name: Generate code coverage - run: just ci-coverage + - run: just ci-coverage - name: Upload coverage to Codecov - uses: codecov/codecov-action@v5 + uses: codecov/codecov-action@v7 with: token: ${{ secrets.CODECOV_TOKEN }} - files: target/llvm-cov/codecov.info + files: target/llvm-cov/lcov.info # This job checks if any of the previous jobs failed or were canceled. # This approach also allows some jobs to be skipped if they are not needed. @@ -92,7 +94,7 @@ jobs: group: release-plz-${{ github.ref }} cancel-in-progress: false steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v7 with: { fetch-depth: 0 } - uses: dtolnay/rust-toolchain@stable - name: Publish to crates.io if crate's version is newer diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index b77d18d..3566566 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -8,7 +8,7 @@ jobs: steps: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v2 + uses: dependabot/fetch-metadata@v3 - name: Approve Dependabot PRs if: steps.metadata.outputs.update-type == 'version-update:semver-patch' run: gh pr review --approve "$PR_URL" diff --git a/.gitignore b/.gitignore index dde7fc1..279f473 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ .idea/ .vscode/ debug/ +flamegraph*.svg +perf.data* target/ temp/ tmp/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fc2e3a1..420c217 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,7 +20,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.5.5 + rev: v1.5.6 hooks: - id: forbid-tabs - id: remove-tabs @@ -33,3 +33,8 @@ repos: entry: sh -c "cargo fmt --all" language: rust pass_filenames: false + + - repo: https://github.com/editorconfig-checker/editorconfig-checker.python + rev: 3.6.1 + hooks: + - id: editorconfig-checker diff --git a/Cargo.toml b/Cargo.toml index 2ac342c..5e5b8cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,8 +17,8 @@ categories = ["science::geo"] rust-version = "1.78" [dependencies] -serde = { version = "1", features = ["derive"] } -serde_json = "1" +serde = { version = "1.0.103", features = ["derive"] } +serde_json = "1.0.50" serde_tuple = "1.1.0" thiserror = "2" diff --git a/LICENSE-APACHE b/LICENSE-APACHE index 11069ed..1b5ec8b 100644 --- a/LICENSE-APACHE +++ b/LICENSE-APACHE @@ -174,28 +174,3 @@ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/clippy.toml b/clippy.toml index 3616445..c647029 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,2 +1,3 @@ +allow-mixed-uninlined-format-args = false allow-unwrap-in-tests = true avoid-breaking-exported-api = false diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..b41c205 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,6 @@ +codecov: + require_ci_to_pass: false + +coverage: + status: + patch: off diff --git a/justfile b/justfile index d36bc4b..c2893a4 100755 --- a/justfile +++ b/justfile @@ -1,11 +1,12 @@ #!/usr/bin/env just --justfile -# Define the name of the main crate based -main_crate := file_name(justfile_directory()) +main_crate := 'tilejson' # How to call the current just executable. Note that just_executable() may have `\` in Windows paths, so we need to quote it. just := quote(just_executable()) # cargo-binstall needs a workaround due to caching when used in CI binstall_args := if env('CI', '') != '' {'--no-confirm --no-track --disable-telemetry'} else {''} +# location of the coverage output, used by CI +coverage_lcov := 'target/llvm-cov/lcov.info' # if running in CI, treat warnings as errors by setting RUSTFLAGS and RUSTDOCFLAGS to '-D warnings' unless they are already set # Use `CI=true just ci-test` to run the same tests as in GitHub CI. @@ -26,17 +27,23 @@ build: check: cargo check --workspace --all-features --all-targets -# Generate code coverage report to upload to codecov.io +# Generate LCOV coverage report for CI to upload to codecov.io ci-coverage: env-info && \ - (coverage '--codecov --output-path target/llvm-cov/codecov.info') - # ATTENTION: the full file path above is used in the CI workflow - mkdir -p target/llvm-cov + (_coverage '--lcov' '--output-path' quote(coverage_lcov)) + rm -rf {{quote(parent_directory(coverage_lcov))}} + mkdir -p {{quote(parent_directory(coverage_lcov))}} # Run all tests as expected by CI -ci-test: env-info test-fmt clippy check test test-doc && assert-git-is-clean +ci-test: env-info test-fmt clippy test test-doc && assert-git-is-clean -# Run minimal subset of tests to ensure compatibility with MSRV -ci-test-msrv: env-info check test +# Compile default features with minimal dependencies on the configured MSRV +ci-test-msrv: + {{just}} ci_mode=0 env-info _check-msrv-default + {{just}} assert-git-is-clean + +# Set toolchain and run ci-test-msrv +ci-test-msrv-with-toolchain: + RUSTUP_TOOLCHAIN="$({{just}} get-msrv)" {{just}} ci-test-msrv # Clean all build artifacts clean: @@ -47,9 +54,14 @@ clean: clippy *args: cargo clippy --workspace --all-features --all-targets {{args}} -# Generate code coverage report. Will install `cargo llvm-cov` if missing. -coverage *args='--no-clean --open': (cargo-install 'cargo-llvm-cov') - cargo llvm-cov --workspace --all-features --all-targets --include-build-script {{args}} +# Generate and open the HTML coverage report +coverage: (_coverage '--open') + +# Clean, collect, and aggregate coverage using the requested report arguments +_coverage *report_args: (cargo-install 'cargo-llvm-cov') + cargo llvm-cov clean --workspace + cargo llvm-cov --no-report --workspace --all-features --all-targets + cargo llvm-cov report --include-build-script {{report_args}} # Build and open code documentation docs *args='--open': @@ -58,7 +70,7 @@ docs *args='--open': # Print environment info env-info: @echo "Running for '{{main_crate}}' crate {{if ci_mode == '1' {'in CI mode'} else {'in dev mode'} }} on {{os()}} / {{arch()}}" - @echo "PWD $(pwd)" + @echo "PWD {{justfile_directory()}}" {{just}} --version rustc --version cargo --version @@ -85,14 +97,25 @@ fmt-toml *args: (cargo-install 'cargo-sort') # Get a package field from the metadata get-crate-field field package=main_crate: (assert-cmd 'jq') - 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}}")' + @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}}")' # Get the minimum supported Rust version (MSRV) for the crate get-msrv package=main_crate: (get-crate-field 'rust_version' package) -# Find the minimum supported Rust version (MSRV) using cargo-msrv extension, and update Cargo.toml +# Find the minimum supported Rust version (MSRV), update Cargo.toml, and test minimal dependencies msrv: (cargo-install 'cargo-msrv') - cargo msrv find --write-msrv --ignore-lockfile --all-features + cargo msrv find --write-msrv --ignore-lockfile -- {{just}} _check-msrv-default + +# Compile the crate's default features using a dynamically generated minimal Cargo.lock +_check-msrv-default: (cargo-install 'cargo-minimal-versions') (cargo-install 'cargo-hack') + #!/usr/bin/env bash + set -euo pipefail + # cargo-msrv probes with rustup, but nested cargo subcommands may otherwise + # fall back to the default Cargo and emit flags unsupported by the candidate rustc. + toolchain="$(rustc --version | cut -d' ' -f2)" + export RUSTUP_TOOLCHAIN="$toolchain" + export CARGO="$(rustup which --toolchain "$toolchain" cargo)" + cargo minimal-versions check --direct --package {{main_crate}} # Run cargo-release release *args='': (cargo-install 'release-plz') @@ -102,7 +125,7 @@ release *args='': (cargo-install 'release-plz') semver *args: (cargo-install 'cargo-semver-checks') cargo semver-checks --all-features {{args}} -# Run all unit and integration tests +# Run all tests test: cargo test --workspace --all-features --all-targets cargo test --doc --workspace --all-features @@ -135,11 +158,11 @@ assert-cmd command: [private] assert-git-is-clean: @if [ -n "$(git status --untracked-files --porcelain)" ]; then \ - >&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." ;\ - >&2 echo "######### git status ##########" ;\ - git status ;\ - git --no-pager diff ;\ - exit 1 ;\ + >&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." ;\ + >&2 echo "######### git status ##########" ;\ + git status ;\ + git --no-pager diff ;\ + exit 1 ;\ fi # Check if a certain Cargo command is installed, and install it if needed From 7980b67e2116992f4674988d65bf74c7c1bfe994 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Mon, 22 Jun 2026 19:09:00 -0400 Subject: [PATCH 2/2] chore: update .gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 279f473..a5e11b6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,11 @@ **/*.rs.bk +*.iml *.pdb +.DS_Store .idea/ .vscode/ +codecov +codecov.SHA256SUM* debug/ flamegraph*.svg perf.data*