mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-11-06 20:33:12 -05:00
* Optimizations and build speedup With this commit I have changed several components to be more efficient. This can be less llvm-lines generated or less `clone()` calls. ### Config - Re-ordered the `make_config` macro to be more efficient - Created a custom Deserializer for `ConfigBuilder` less code and more efficient - Use struct's for the `prepare_json` function instead of generating a custom JSON object. This generates less code and is more efficient. - Updated the `get_support_string` function to handle the masking differently. This generates less code and also was able to remove some sub-macro-calls ### Error - Added an extra new call to prevent duplicate Strings in generated macro code. This generated less llvm-lines and seems to be more efficient. - Created a custom Serializer for `ApiError` and `CompactApiError` This makes that struct smaller in size, so better for memory, but also less llvm-lines. ### General - Removed `once_lock` and replace it all with Rust's std LazyLock - Added and fixed some Clippy lints which reduced `clone()` calls for example. - Updated build profiles for more efficiency Also added a new profile specifically for CI, which should decrease the build check - Updated several GitHub Workflows for better security and use the new `ci` build profile - Updated to Rust v1.90.0 which uses a new linker `rust-lld` which should help in faster building - Updated the Cargo.toml for all crates to better use the `workspace` variables - Added a `typos` Workflow and Pre-Commit, which should help in detecting spell error's. Also fixed a few found by it. Signed-off-by: BlackDex <black.dex@gmail.com> * Fix release profile Signed-off-by: BlackDex <black.dex@gmail.com> * Update typos and remove mimalloc check from pre-commit checks Signed-off-by: BlackDex <black.dex@gmail.com> * Misc fixes and updated typos Signed-off-by: BlackDex <black.dex@gmail.com> * Update crates and workflows Signed-off-by: BlackDex <black.dex@gmail.com> * Fix formating and pre-commit Signed-off-by: BlackDex <black.dex@gmail.com> * Update to Rust v1.91 and update crates Signed-off-by: BlackDex <black.dex@gmail.com> * Update web-vault to v2025.10.1 and xx to v1.8.0 Signed-off-by: BlackDex <black.dex@gmail.com> --------- Signed-off-by: BlackDex <black.dex@gmail.com>
59 lines
1.8 KiB
YAML
59 lines
1.8 KiB
YAML
---
|
|
repos:
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0
|
|
hooks:
|
|
- id: check-yaml
|
|
- id: check-json
|
|
- id: check-toml
|
|
- id: mixed-line-ending
|
|
args: ["--fix=no"]
|
|
- id: end-of-file-fixer
|
|
exclude: "(.*js$|.*css$)"
|
|
- id: check-case-conflict
|
|
- id: check-merge-conflict
|
|
- id: detect-private-key
|
|
- id: check-symlinks
|
|
- id: forbid-submodules
|
|
- repo: local
|
|
hooks:
|
|
- id: fmt
|
|
name: fmt
|
|
description: Format files with cargo fmt.
|
|
entry: cargo fmt
|
|
language: system
|
|
always_run: true
|
|
pass_filenames: false
|
|
args: ["--", "--check"]
|
|
- id: cargo-test
|
|
name: cargo test
|
|
description: Test the package for errors.
|
|
entry: cargo test
|
|
language: system
|
|
args: ["--features", "sqlite,mysql,postgresql", "--"]
|
|
types_or: [rust, file]
|
|
files: (Cargo.toml|Cargo.lock|rust-toolchain.toml|rustfmt.toml|.*\.rs$)
|
|
pass_filenames: false
|
|
- id: cargo-clippy
|
|
name: cargo clippy
|
|
description: Lint Rust sources
|
|
entry: cargo clippy
|
|
language: system
|
|
args: ["--features", "sqlite,mysql,postgresql", "--", "-D", "warnings"]
|
|
types_or: [rust, file]
|
|
files: (Cargo.toml|Cargo.lock|rust-toolchain.toml|rustfmt.toml|.*\.rs$)
|
|
pass_filenames: false
|
|
- id: check-docker-templates
|
|
name: check docker templates
|
|
description: Check if the Docker templates are updated
|
|
language: system
|
|
entry: sh
|
|
args:
|
|
- "-c"
|
|
- "cd docker && make"
|
|
# When this version is updated, do not forget to update this in `.github/workflows/typos.yaml` too
|
|
- repo: https://github.com/crate-ci/typos
|
|
rev: 07d900b8fa1097806b8adb6391b0d3e0ac2fdea7 # v1.39.0
|
|
hooks:
|
|
- id: typos
|