check-cargo.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/env bash
  2. # Copyright Materialize, Inc. and contributors. All rights reserved.
  3. #
  4. # Use of this software is governed by the Business Source License
  5. # included in the LICENSE file at the root of this repository.
  6. #
  7. # As of the Change Date specified in that file, in accordance with
  8. # the Business Source License, use of this software will be governed
  9. # by the Apache License, Version 2.0.
  10. #
  11. # check-cargo.sh — check for cargo issues (e.g., ensure that all crates use the same rust version).
  12. set -euo pipefail
  13. cd "$(dirname "$0")/../../../.."
  14. . misc/shlib/shlib.bash
  15. if ! cargo about --version > /dev/null 2>&1; then
  16. echo "lint: cargo-about is not installed"
  17. echo "hint: install it with: cargo install cargo-about"
  18. fi
  19. if ! cargo hakari --version > /dev/null 2>&1; then
  20. echo "lint: cargo-hakari is not installed"
  21. echo "hint: install it with: cargo install cargo-hakari"
  22. fi
  23. if ! cargo --list | grep --quiet deplint; then
  24. echo "lint: cargo-deplint is not installed"
  25. echo "hint: install it with: cargo install cargo-deplint"
  26. fi
  27. try bin/lint-cargo
  28. try cargo --locked fmt -- --check
  29. try cargo --locked deny check licenses bans sources
  30. try cargo hakari generate --diff
  31. try cargo hakari manage-deps --dry-run
  32. try cargo deplint Cargo.lock ci/test/lint-deps.toml
  33. try_status_report