Skip to content

Commit

Permalink
feat: basic project maintenance, bumps and refas (#124)
Browse files Browse the repository at this point in the history
* bumps: bumping crate versions
feat: adding no-default-features to crates

* bump: flake update
feat: adding cargo-watch and cargo-expand

* feat: moving clippy lints to cargo toml

* bump: pre-commit and hooks

* sec: ignoring vulns that we are blocked on due to Shuttle

* fix: mods after crates update

* refa: changing from crate once_cell to std OnceLock

* feat: using LazyLock instead of OnceLock

* bump: rust ci toolchain to 1.80.1 stable
  • Loading branch information
nicolasauler authored Aug 26, 2024
1 parent e61c174 commit 1f77a78
Show file tree
Hide file tree
Showing 12 changed files with 566 additions and 597 deletions.
2 changes: 2 additions & 0 deletions .cargo/audit.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[advisories]
ignore = [
"RUSTSEC-2023-0071", # rsa marvin attack
"RUSTSEC-2024-0363", # sqlx -> depends on shuttle upgrade
"RUSTSEC-2024-0365", # diesel -> depends on shuttle upgrade
]

[output]
Expand Down
53 changes: 28 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/configuration-reference
version: 2.1
Expand All @@ -10,7 +11,7 @@ orbs:
jobs:
build-and-test:
docker:
- image: cimg/rust:1.79.0
- image: cimg/rust:1.80.1
environment:
# Fail the build if there are warnings
RUSTFLAGS: "-D warnings"
Expand All @@ -36,17 +37,20 @@ jobs:
key: v1-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
- run:
name: Install nextest
command: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
command: |
curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- run:
name: Build and archive tests
command: cargo nextest archive --workspace --archive-file nextest-archive.tar.zst
command: |
cargo nextest archive --workspace --archive-file nextest-archive.tar.zst
- run:
name: Run tests
command: cargo nextest run --no-fail-fast --archive-file nextest-archive.tar.zst
command: |
cargo nextest run --no-fail-fast --archive-file nextest-archive.tar.zst
security:
docker:
- image: cimg/rust:1.79.0
- image: cimg/rust:1.80.1
steps:
- checkout
- run:
Expand All @@ -72,7 +76,7 @@ jobs:

format:
docker:
- image: cimg/rust:1.79.0
- image: cimg/rust:1.80.1
steps:
- checkout
- run:
Expand All @@ -86,10 +90,12 @@ jobs:
command: cargo fmt --all -- --check

lint:
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
# Specify the execution environment.
# You can specify an image from Docker Hub or use one of our convenience
# images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/configuration-reference/#executor-job
docker:
- image: cimg/rust:1.79.0
- image: cimg/rust:1.80.1
# Add steps to the job
# See: https://circleci.com/docs/configuration-reference/#steps
steps:
Expand All @@ -102,15 +108,12 @@ jobs:
command: rustup component add clippy
- run:
name: Linting
command: cargo clippy --locked --all-targets -- -D warnings -D dead-code
command: |
cargo clippy --locked --all-targets -- -D warnings -D dead-code
doc:
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/configuration-reference/#executor-job
docker:
- image: cimg/rust:1.79.0
# Add steps to the job
# See: https://circleci.com/docs/configuration-reference/#steps
- image: cimg/rust:1.80.1
steps:
- checkout
- run:
Expand All @@ -124,12 +127,8 @@ jobs:
command: rustup run nightly cargo doc --no-deps --all-features

coverage:
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/configuration-reference/#executor-job
docker:
- image: cimg/rust:1.79.0
# Add steps to the job
# See: https://circleci.com/docs/configuration-reference/#steps
- image: cimg/rust:1.80.1
steps:
- checkout
- run:
Expand All @@ -140,28 +139,32 @@ jobs:
command: rustup install nightly
- run:
name: Install llvm-tools-preview
command: rustup component add llvm-tools-preview --toolchain nightly-x86_64-unknown-linux-gnu
command: |
rustup component add llvm-tools-preview --toolchain nightly-x86_64-unknown-linux-gnu
- run:
name: Install codecov tool
command: cargo install cargo-llvm-cov
- run:
name: Install nextest
command: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
command: |
curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- run:
name: Running code coverage
command: rustup run nightly cargo llvm-cov nextest --locked --all-features --lcov --output-path lcov.info
command: |
rustup run nightly cargo llvm-cov nextest --locked --all-features --lcov --output-path lcov.info
- codecov/upload:
file: "./lcov.info"
#token: $CODECOV_TOKEN already default
# token: $CODECOV_TOKEN already default

shuttle-deploy:
docker:
- image: cimg/rust:1.79.0
- image: cimg/rust:1.80.1
steps:
- checkout
- run:
name: Install cargo-binstall
command: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
command: |
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
- run:
name: Install cargo-shuttle
command: cargo binstall -y --locked cargo-shuttle
Expand Down
11 changes: 8 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
Expand All @@ -7,21 +8,25 @@ repos:
- id: trailing-whitespace
- id: detect-private-key
- repo: https://github.com/crate-ci/typos
rev: v1.23.1
rev: v1.24.1
hooks:
- id: typos
- repo: local
hooks:
- id: rust-formatting
name: Rust formatting
description: Run cargo fmt on files included in the commit. rustfmt should be installed before-hand.
description: |
Run cargo fmt on files included in the commit.
rustfmt should be installed before-hand.
entry: cargo fmt --all --
pass_filenames: true
types: [file, rust]
language: system
- id: rust-clippy
name: Rust clippy
description: Run cargo clippy on files included in the commit. clippy should be installed before-hand.
description: |
Run cargo clippy on files included in the commit.
clippy should be installed before-hand.
entry: cargo clippy --all -- -D warnings -D dead-code
pass_filenames: false
types: [file, rust]
Expand Down
Loading

0 comments on commit 1f77a78

Please sign in to comment.