diff --git a/.codecov.yml b/.codecov.yml index aab3a8a..bd0d96c 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,15 +1,16 @@ codecov: require_ci_to_pass: true coverage: - range: 50..90 # coverage lower than 50 is red, higher than 90 green, between color code + range: 50..90 status: project: - default: # settings affecting project coverage - enabled: true # auto % coverage target - threshold: "5%" # allow for 5% reduction of coverage without failing - # do not run coverage on patch nor changes - target: false - patch: false + default: + target: "65%" + threshold: "1%" + patch: + default: + target: "60%" + threshold: "5%" changes: false ignore: - "src/bin" # don't consider binaries in coverage report @@ -17,4 +18,4 @@ ignore: - "tests" # we also don't care about coverage of test code - "benches" # or coverage of benchmarks - "protos" # coverage for protos are not necessary either - - "migrations" # exclude database stuff \ No newline at end of file + - "migrations" # exclude database stuff diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..ffd3c5b --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,93 @@ +name: CI +on: + - push + - pull_request + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + actionlint: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install actionlint + run: go install github.com/rhysd/actionlint/cmd/actionlint@v1.7.12 + + - name: Check workflows + run: | + "$(go env GOPATH)/bin/actionlint" + + tests: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install stable Rust + uses: dtolnay/rust-toolchain@stable + + - name: Cache Rust build artifacts + uses: Swatinem/rust-cache@v2 + + - name: Run workspace tests + run: cargo test --locked --workspace --all-targets + + fmt: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install stable rustfmt + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + + - name: Check formatting + run: cargo fmt --all -- --check + + clippy: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install stable clippy + uses: dtolnay/rust-toolchain@stable + with: + components: clippy + + - name: Cache Rust build artifacts + uses: Swatinem/rust-cache@v2 + + - name: Run clippy + run: cargo clippy --locked --workspace --all-targets -- -D warnings + + deny: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install stable Rust + uses: dtolnay/rust-toolchain@stable + + - name: Install cargo-deny + uses: taiki-e/install-action@v2 + with: + tool: cargo-deny + + - name: Check dependency policy + run: cargo deny check diff --git a/.github/workflows/codecov.yaml b/.github/workflows/codecov.yaml index 1ae12d7..23d538f 100644 --- a/.github/workflows/codecov.yaml +++ b/.github/workflows/codecov.yaml @@ -6,12 +6,7 @@ name: coverage jobs: report: name: Report - environment: coverage runs-on: ubuntu-latest - env: - CARGO_INCREMENTAL: "0" - RUSTFLAGS: "-Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" - RUSTDOCFLAGS: "-Cpanic=abort" steps: - name: Checkout repository @@ -19,9 +14,8 @@ jobs: - id: setup name: Setup Toolchain - uses: dtolnay/rust-toolchain@nightly + uses: dtolnay/rust-toolchain@stable with: - toolchain: nightly components: llvm-tools-preview - id: cache @@ -36,14 +30,15 @@ jobs: - id: coverage name: Generate Coverage Report run: | - mkdir .coverage - cargo llvm-cov --lcov --output-path=./.coverage/lcov.info + mkdir -p .coverage + cargo llvm-cov --locked --workspace --all-targets --lcov --output-path=./.coverage/lcov.info - id: upload name: Upload Coverage Report + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} file: ./.coverage/lcov.info verbose: true - fail_ci_if_error: true \ No newline at end of file + fail_ci_if_error: true diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml deleted file mode 100644 index 9d46794..0000000 --- a/.github/workflows/push.yaml +++ /dev/null @@ -1,9 +0,0 @@ -name: test_build_push -on: push -jobs: - build: # This does not build the whole proto files for production, it tests if rust / tonic - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable - - run: cargo test --all-features \ No newline at end of file diff --git a/.github/workflows/tag_publish.yaml b/.github/workflows/tag_publish.yaml index 5e68a04..f44c4c7 100644 --- a/.github/workflows/tag_publish.yaml +++ b/.github/workflows/tag_publish.yaml @@ -1,31 +1,126 @@ -name: automatic_test_build_publish +name: Publish crates.io packages + on: push: tags: - v* + +permissions: + contents: read + +concurrency: + group: publish-${{ github.ref_name }} + cancel-in-progress: false + jobs: - build: + publish: runs-on: ubuntu-latest + timeout-minutes: 45 + environment: release steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable - - name: Derive release version - run: echo "RELEASE_VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV" - - name: Test workspace - run: cargo test --workspace --locked + - name: Check out repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Install stable Rust + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + + - name: Cache Rust build artifacts + uses: Swatinem/rust-cache@v2 + + - name: Install cargo-deny + uses: taiki-e/install-action@v2 + with: + tool: cargo-deny + + - name: Validate release tag and package versions + shell: bash + env: + RELEASE_TAG: ${{ github.ref_name }} + run: | + if [[ ! "$RELEASE_TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$ ]]; then + printf 'Release tag must be vX.Y.Z compliant with SemVer: %s\n' "$RELEASE_TAG" >&2 + exit 1 + fi + + RELEASE_VERSION="${RELEASE_TAG#v}" + RELEASE_COMMIT="$(git rev-list -n 1 "$GITHUB_REF")" + git merge-base --is-ancestor "$RELEASE_COMMIT" origin/main || { + printf 'Release tag must point to a commit reachable from main.\n' >&2 + exit 1 + } + + for package in pithos_lib pithos; do + package_id="$(cargo pkgid -p "$package")" + package_version="${package_id##*@}" + if [[ "$package_version" != "$RELEASE_VERSION" ]]; then + printf '%s version %s does not match release tag %s.\n' "$package" "$package_version" "$RELEASE_VERSION" >&2 + exit 1 + fi + done + + printf 'RELEASE_VERSION=%s\n' "$RELEASE_VERSION" >> "$GITHUB_ENV" + + - name: Run workspace tests + run: cargo test --locked --workspace --all-targets + + - name: Check formatting + run: cargo fmt --all -- --check + + - name: Run Clippy + run: cargo clippy --locked --workspace --all-targets -- -D warnings + + - name: Check dependency policy + run: cargo deny check + - name: Package library run: cargo package -p pithos_lib --locked + - name: Dry-run library publish run: cargo publish -p pithos_lib --dry-run --locked - - name: Publish library - run: cargo publish -p pithos_lib --token ${CRATES_TOKEN} --locked + + - name: Publish or verify library + shell: bash env: - CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }} + run: | + if cargo publish -p pithos_lib --locked; then + exit 0 + fi + + cargo info "pithos_lib@$RELEASE_VERSION" --registry crates-io >/dev/null + + - name: Wait for library to reach crates.io + shell: bash + run: | + for _ in {1..30}; do + if cargo info "pithos_lib@$RELEASE_VERSION" --registry crates-io >/dev/null 2>&1; then + exit 0 + fi + + sleep 10 + done + + printf 'pithos_lib %s did not become available on crates.io.\n' "$RELEASE_VERSION" >&2 + exit 1 + - name: Package CLI run: cargo package -p pithos --locked + - name: Dry-run CLI publish run: cargo publish -p pithos --dry-run --locked - - name: Publish CLI - run: cargo publish -p pithos --token ${CRATES_TOKEN} --locked + + - name: Publish or verify CLI + shell: bash env: - CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }} + run: | + if cargo publish -p pithos --locked; then + exit 0 + fi + + cargo info "pithos@$RELEASE_VERSION" --registry crates-io >/dev/null diff --git a/Cargo.toml b/Cargo.toml index 4082ca7..87d77ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ resolver = "2" version = "0.7.2" authors = ["Jannis Schlegel ", "Sebastian Beyvers "] edition = "2024" +rust-version = "1.88" repository = "https://github.com/arunaengine/pithos" license = "MIT OR Apache-2.0" diff --git a/LICENSE-APACHE b/LICENSE-APACHE new file mode 100644 index 0000000..211727c --- /dev/null +++ b/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + 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 [2024] [ArunaStorage Team] + + 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/LICENSE b/LICENSE-MIT similarity index 94% rename from LICENSE rename to LICENSE-MIT index d0755a8..894d702 100644 --- a/LICENSE +++ b/LICENSE-MIT @@ -1,6 +1,6 @@ -MIT License +The MIT License (MIT) -Copyright (c) 2023 ArunaStorage +Copyright (c) 2024 ArunaStorage Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/crates/pithos/Cargo.toml b/crates/pithos/Cargo.toml index ca0b264..aa32f48 100644 --- a/crates/pithos/Cargo.toml +++ b/crates/pithos/Cargo.toml @@ -4,6 +4,7 @@ description = "CLI for the Pithos container file format" version = "0.7.2" authors.workspace = true edition.workspace = true +rust-version.workspace = true repository.workspace = true license.workspace = true diff --git a/crates/pithos_lib/Cargo.toml b/crates/pithos_lib/Cargo.toml index b8cc822..7c033a3 100644 --- a/crates/pithos_lib/Cargo.toml +++ b/crates/pithos_lib/Cargo.toml @@ -4,6 +4,7 @@ description = "Library and components for encrypting / compressing pithos (.pith version = "0.7.2" authors.workspace = true edition.workspace = true +rust-version.workspace = true repository.workspace = true license.workspace = true diff --git a/crates/pithos_lib/tests/reader.rs b/crates/pithos_lib/tests/reader.rs index c293357..b1e946c 100644 --- a/crates/pithos_lib/tests/reader.rs +++ b/crates/pithos_lib/tests/reader.rs @@ -70,12 +70,13 @@ fn test_reader_file_ranges() { let temp_dir = TempDir::new().unwrap(); let outfile_single = temp_dir.path().join("range.txt"); let outfile_multi = temp_dir.path().join("ranges.txt"); - if let Some(_) = directory.get_file_by_path("t8.shakespeare.txt") { + if directory.get_file_by_path("t8.shakespeare.txt").is_some() { reader .read_file( "t8.shakespeare.txt", &directory, Some(&outfile_single), + #[allow(clippy::single_range_in_vec_init)] Some(vec![261..272]), ) .unwrap(); @@ -303,6 +304,7 @@ fn test_read_to_crypt4gh() { let crypt4gh_output = Box::new( OpenOptions::new() .create(true) + .truncate(true) .write(true) .open(&crypt4gh_output_path) .unwrap(), @@ -338,7 +340,7 @@ fn test_read_to_crypt4gh() { if let PacketData::Decrypted(packets) = &header_packet.packet_data { for packet in packets { if let Packet::Encryption(encryption_packet) = packet { - data_key = Some(encryption_packet.get_encryption_key().clone()); + data_key = Some(*encryption_packet.get_encryption_key()); break 'outer; } } @@ -352,6 +354,7 @@ fn test_read_to_crypt4gh() { let raw_output_file = temp_dir.path().join("t8.shakespeare.txt"); let mut output = OpenOptions::new() .create(true) + .truncate(true) .write(true) .open(&raw_output_file) .unwrap(); diff --git a/crates/pithos_lib/tests/writer.rs b/crates/pithos_lib/tests/writer.rs index 562f407..d7d363c 100644 --- a/crates/pithos_lib/tests/writer.rs +++ b/crates/pithos_lib/tests/writer.rs @@ -419,7 +419,7 @@ fn test_directory() { assert_eq!(directory.files.len(), 8); - for (id, path, filetype, size) in vec![ + for (id, path, filetype, size) in [ (0, "dataset", FileType::Directory, 0), ( 1, diff --git a/crates/pithos_pyo3/Cargo.toml b/crates/pithos_pyo3/Cargo.toml index b673544..a1d6a22 100644 --- a/crates/pithos_pyo3/Cargo.toml +++ b/crates/pithos_pyo3/Cargo.toml @@ -2,10 +2,12 @@ name = "pithos_pyo3" description = "Client for the Pithos object storage file format" version = "0.7.0" +publish = false authors.workspace = true edition.workspace = true +rust-version.workspace = true repository.workspace = true license.workspace = true [dependencies] -pithos_lib = { version = "0.7.2", path = "../pithos_lib" } \ No newline at end of file +pithos_lib = { version = "0.7.2", path = "../pithos_lib" } diff --git a/deny.toml b/deny.toml new file mode 100644 index 0000000..422b404 --- /dev/null +++ b/deny.toml @@ -0,0 +1,242 @@ +# This template contains all of the possible sections and their default values + +# Note that all fields that take a lint level have these possible values: +# * deny - An error will be produced and the check will fail +# * warn - A warning will be produced, but the check will not fail +# * allow - No warning or error will be produced, though in some cases a note +# will be + +# The values provided in this template are the default values that will be used +# when any section or field is not specified in your own configuration + +# Root options + +# The graph table configures how the dependency graph is constructed and thus +# which crates the checks are performed against +[graph] +# If 1 or more target triples (and optionally, target_features) are specified, +# only the specified targets will be checked when running `cargo deny check`. +# This means, if a particular package is only ever used as a target specific +# dependency, such as, for example, the `nix` crate only being used via the +# `target_family = "unix"` configuration, that only having windows targets in +# this list would mean the nix crate, as well as any of its exclusive +# dependencies not shared by any other crates, would be ignored, as the target +# list here is effectively saying which targets you are building for. +targets = [ + # The triple can be any string, but only the target triples built in to + # rustc (as of 1.40) can be checked against actual config expressions + #"x86_64-unknown-linux-musl", + # You can also specify which target_features you promise are enabled for a + # particular target. target_features are currently not validated against + # the actual valid features supported by the target architecture. + #{ triple = "wasm32-unknown-unknown", features = ["atomics"] }, +] +# When creating the dependency graph used as the source of truth when checks are +# executed, this field can be used to prune crates from the graph, removing them +# from the view of cargo-deny. This is an extremely heavy hammer, as if a crate +# is pruned from the graph, all of its dependencies will also be pruned unless +# they are connected to another crate in the graph that hasn't been pruned, +# so it should be used with care. The identifiers are [Package ID Specifications] +# (https://doc.rust-lang.org/cargo/reference/pkgid-spec.html) +#exclude = [] +# If true, metadata will be collected with `--all-features`. Note that this can't +# be toggled off if true, if you want to conditionally enable `--all-features` it +# is recommended to pass `--all-features` on the cmd line instead +all-features = false +# If true, metadata will be collected with `--no-default-features`. The same +# caveat with `all-features` applies +no-default-features = false +# If set, these feature will be enabled when collecting metadata. If `--features` +# is specified on the cmd line they will take precedence over this option. +#features = [] + +# The output table provides options for how/if diagnostics are outputted +[output] +# When outputting inclusion graphs in diagnostics that include features, this +# option can be used to specify the depth at which feature edges will be added. +# This option is included since the graphs can be quite large and the addition +# of features from the crate(s) to all of the graph roots can be far too verbose. +# This option can be overridden via `--feature-depth` on the cmd line +feature-depth = 1 + +# This section is considered when running `cargo deny check advisories` +# More documentation for the advisories section can be found here: +# https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html +[advisories] +# The path where the advisory databases are cloned/fetched into +#db-path = "$CARGO_HOME/advisory-dbs" +# The url(s) of the advisory databases to use +#db-urls = ["https://github.com/rustsec/advisory-db"] +# A list of advisory IDs to ignore. Note that ignored advisories will still +# output a note when they are encountered. +ignore = [ + #"RUSTSEC-0000-0000", + #{ id = "RUSTSEC-0000-0000", reason = "you can specify a reason the advisory is ignored" }, + #"a-crate-that-is-yanked@0.1.1", # you can also ignore yanked crate versions if you wish + #{ crate = "a-crate-that-is-yanked@0.1.1", reason = "you can specify why you are ignoring the yanked crate" }, +] +# If this is true, then cargo deny will use the git executable to fetch advisory database. +# If this is false, then it uses a built-in git library. +# Setting this to true can be helpful if you have special authentication requirements that cargo-deny does not support. +# See Git Authentication for more information about setting up git authentication. +#git-fetch-with-cli = true + +# This section is considered when running `cargo deny check licenses` +# More documentation for the licenses section can be found here: +# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html +[licenses] +# List of explicitly allowed licenses +# See https://spdx.org/licenses/ for list of possible licenses +# [possible values: any SPDX 3.11 short identifier (+ optional exception)]. +allow = [ + "MIT", + "Apache-2.0", + "BSD-2-Clause", + "BSD-3-Clause", + "ISC", + "Unicode-3.0", +] +# The confidence threshold for detecting a license from license text. +# The higher the value, the more closely the license text must be to the +# canonical license text of a valid SPDX license file. +# [possible values: any between 0.0 and 1.0]. +confidence-threshold = 0.8 +# Allow 1 or more licenses on a per-crate basis, so that particular licenses +# aren't accepted for every possible crate as with the normal allow list +exceptions = [ + { allow = ["CDLA-Permissive-2.0"], crate = "webpki-root-certs" }, + { allow = ["MPL-2.0"], crate = "option-ext" }, + { allow = ["Zlib"], crate = "zlib-rs" }, +] + +# Some crates don't have (easily) machine readable licensing information, +# adding a clarification entry for it allows you to manually specify the +# licensing information +#[[licenses.clarify]] +# The package spec the clarification applies to +#crate = "ring" +# The SPDX expression for the license requirements of the crate +#expression = "MIT AND ISC AND OpenSSL" +# One or more files in the crate's source used as the "source of truth" for +# the license expression. If the contents match, the clarification will be used +# when running the license check, otherwise the clarification will be ignored +# and the crate will be checked normally, which may produce warnings or errors +# depending on the rest of your configuration +#license-files = [ +# Each entry is a crate relative path, and the (opaque) hash of its contents +#{ path = "LICENSE", hash = 0xbd0eed23 } +#] + +[licenses.private] +# If true, ignores workspace crates that aren't published, or are only +# published to private registries. +# To see how to mark a crate as unpublished (to the official registry), +# visit https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field. +ignore = false +# One or more private registries that you might publish crates to, if a crate +# is only published to private registries, and ignore is true, the crate will +# not have its license(s) checked +registries = [ + #"https://sekretz.com/registry +] + +# This section is considered when running `cargo deny check bans`. +# More documentation about the 'bans' section can be found here: +# https://embarkstudios.github.io/cargo-deny/checks/bans/cfg.html +[bans] +# Lint level for when multiple versions of the same crate are detected +multiple-versions = "warn" +# Lint level for when a crate version requirement is `*` +wildcards = "allow" +# The graph highlighting used when creating dotgraphs for crates +# with multiple versions +# * lowest-version - The path to the lowest versioned duplicate is highlighted +# * simplest-path - The path to the version with the fewest edges is highlighted +# * all - Both lowest-version and simplest-path are used +highlight = "all" +# The default lint level for `default` features for crates that are members of +# the workspace that is being checked. This can be overridden by allowing/denying +# `default` on a crate-by-crate basis if desired. +workspace-default-features = "allow" +# The default lint level for `default` features for external crates that are not +# members of the workspace. This can be overridden by allowing/denying `default` +# on a crate-by-crate basis if desired. +external-default-features = "allow" +# List of crates that are allowed. Use with care! +allow = [ + #"ansi_term@0.11.0", + #{ crate = "ansi_term@0.11.0", reason = "you can specify a reason it is allowed" }, +] +# If true, workspace members are automatically allowed even when using deny-by-default +# This is useful for organizations that want to deny all external dependencies by default +# but allow their own workspace crates without having to explicitly list them +allow-workspace = false +# List of crates to deny +deny = [ + #"ansi_term@0.11.0", + #{ crate = "ansi_term@0.11.0", reason = "you can specify a reason it is banned" }, + # Wrapper crates can optionally be specified to allow the crate when it + # is a direct dependency of the otherwise banned crate + #{ crate = "ansi_term@0.11.0", wrappers = ["this-crate-directly-depends-on-ansi_term"] }, +] + +# List of features to allow/deny +# Each entry the name of a crate and a version range. If version is +# not specified, all versions will be matched. +#[[bans.features]] +#crate = "reqwest" +# Features to not allow +#deny = ["json"] +# Features to allow +#allow = [ +# "rustls", +# "__rustls", +# "__tls", +# "hyper-rustls", +# "rustls", +# "rustls-pemfile", +# "rustls-tls-webpki-roots", +# "tokio-rustls", +# "webpki-roots", +#] +# If true, the allowed features must exactly match the enabled feature set. If +# this is set there is no point setting `deny` +#exact = true + +# Certain crates/versions that will be skipped when doing duplicate detection. +skip = [ + #"ansi_term@0.11.0", + #{ crate = "ansi_term@0.11.0", reason = "you can specify a reason why it can't be updated/removed" }, +] +# Similarly to `skip` allows you to skip certain crates during duplicate +# detection. Unlike skip, it also includes the entire tree of transitive +# dependencies starting at the specified crate, up to a certain depth, which is +# by default infinite. +skip-tree = [ + #"ansi_term@0.11.0", # will be skipped along with _all_ of its direct and transitive dependencies + #{ crate = "ansi_term@0.11.0", depth = 20 }, +] + +# This section is considered when running `cargo deny check sources`. +# More documentation about the 'sources' section can be found here: +# https://embarkstudios.github.io/cargo-deny/checks/sources/cfg.html +[sources] +# Lint level for what to happen when a crate from a crate registry that is not +# in the allow list is encountered +unknown-registry = "deny" +# Lint level for what to happen when a crate from a git repository that is not +# in the allow list is encountered +unknown-git = "deny" +# List of URLs for allowed crate registries. Defaults to the crates.io index +# if not specified. If it is specified but empty, no registries are allowed. +allow-registry = ["https://github.com/rust-lang/crates.io-index"] +# List of URLs for allowed Git repositories +allow-git = [] + +[sources.allow-org] +# github.com organizations to allow git sources for +github = [] +# gitlab.com organizations to allow git sources for +gitlab = [] +# bitbucket.org organizations to allow git sources for +bitbucket = []