Skip to content

Commit

Permalink
Update Rust version, deps and workflow
Browse files Browse the repository at this point in the history
- Update Rust to v1.65.0
- Update dependencies
- Updated workflow files
- Added some extra clippy checks
- Fixed some clippy checks
  • Loading branch information
BlackDex committed Nov 4, 2022
1 parent f60a692 commit 529c093
Show file tree
Hide file tree
Showing 30 changed files with 108 additions and 115 deletions.
69 changes: 30 additions & 39 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,37 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends openssl sqlite build-essential libmariadb-dev-compat libpq-dev libssl-dev pkg-config
# End Install dependencies

# Determine rust-toolchain version
- name: Init Variables
id: toolchain
shell: bash
if: ${{ matrix.channel == 'rust-toolchain' }}
run: |
RUST_TOOLCHAIN="$(cat rust-toolchain)"
echo "RUST_TOOLCHAIN=${RUST_TOOLCHAIN}" | tee -a "${GITHUB_OUTPUT}"
# End Determine rust-toolchain version

# Uses the rust-toolchain file to determine version
- name: "Install rust-toolchain version"
uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # v1.0.6
uses: dtolnay/rust-toolchain@55c7845fad90d0ae8b2e83715cb900e5e861e8cb # master @ 2022-10-25 - 21:40 GMT+2
if: ${{ matrix.channel == 'rust-toolchain' }}
with:
profile: minimal
toolchain: "${{steps.toolchain.outputs.RUST_TOOLCHAIN}}"
components: clippy, rustfmt
# End Uses the rust-toolchain file to determine version


# Install the MSRV channel to be used
- name: "Install MSRV version"
uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # v1.0.6
uses: dtolnay/rust-toolchain@55c7845fad90d0ae8b2e83715cb900e5e861e8cb # master @ 2022-10-25 - 21:40 GMT+2
if: ${{ matrix.channel != 'rust-toolchain' }}
with:
profile: minimal
override: true
toolchain: ${{ matrix.version }}
# End Install the MSRV channel to be used


# Enable Rust Caching
- uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1
- uses: Swatinem/rust-cache@b5ec9edd911d3bf82c74038b0a28791e0aa24d6f # v2.0.2
# End Enable Rust Caching


Expand All @@ -87,65 +94,51 @@ jobs:
# First test all features together, afterwards test them separately.
- name: "test features: sqlite,mysql,postgresql,enable_mimalloc"
id: test_sqlite_mysql_postgresql_mimalloc
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
if: $${{ always() }}
with:
command: test
args: --release --features sqlite,mysql,postgresql,enable_mimalloc
run: |
cargo test --release --features sqlite,mysql,postgresql,enable_mimalloc
- name: "test features: sqlite,mysql,postgresql"
id: test_sqlite_mysql_postgresql
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
if: $${{ always() }}
with:
command: test
args: --release --features sqlite,mysql,postgresql
run: |
cargo test --release --features sqlite,mysql,postgresql
- name: "test features: sqlite"
id: test_sqlite
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
if: $${{ always() }}
with:
command: test
args: --release --features sqlite
run: |
cargo test --release --features sqlite
- name: "test features: mysql"
id: test_mysql
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
if: $${{ always() }}
with:
command: test
args: --release --features mysql
run: |
cargo test --release --features mysql
- name: "test features: postgresql"
id: test_postgresql
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
if: $${{ always() }}
with:
command: test
args: --release --features postgresql
run: |
cargo test --release --features postgresql
# End Run cargo tests


# Run cargo clippy, and fail on warnings (In release mode to speed up future builds)
- name: "clippy features: sqlite,mysql,postgresql,enable_mimalloc"
id: clippy
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
if: ${{ always() && matrix.channel == 'rust-toolchain' }}
with:
command: clippy
args: --release --features sqlite,mysql,postgresql,enable_mimalloc -- -D warnings
run: |
cargo clippy --release --features sqlite,mysql,postgresql,enable_mimalloc -- -D warnings
# End Run cargo clippy


# Run cargo fmt (Only run on rust-toolchain defined version)
- name: "check formatting"
id: formatting
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
if: ${{ always() && matrix.channel == 'rust-toolchain' }}
with:
command: fmt
args: --all -- --check
run: |
cargo fmt --all -- --check
# End Run cargo fmt


Expand Down Expand Up @@ -182,17 +175,15 @@ jobs:
# Build the binary to upload to the artifacts
- name: "build features: sqlite,mysql,postgresql"
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
if: ${{ matrix.channel == 'rust-toolchain' }}
with:
command: build
args: --release --features sqlite,mysql,postgresql
run: |
cargo build --release --features sqlite,mysql,postgresql
# End Build the binary


# Upload artifact to Github Actions
- name: "Upload artifact"
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: ${{ matrix.channel == 'rust-toolchain' }}
with:
name: vaultwarden
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@ jobs:
run: |
# Check which main tag we are going to build determined by github.ref
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
echo "set-output name=DOCKER_TAG::${GITHUB_REF#refs/*/}"
echo "::set-output name=DOCKER_TAG::${GITHUB_REF#refs/*/}"
echo "DOCKER_TAG=${GITHUB_REF#refs/*/}" | tee -a "${GITHUB_OUTPUT}"
elif [[ "${{ github.ref }}" == refs/heads/* ]]; then
echo "set-output name=DOCKER_TAG::testing"
echo "::set-output name=DOCKER_TAG::testing"
echo "DOCKER_TAG=testing" | tee -a "${GITHUB_OUTPUT}"
fi
# End Determine Docker Tag

Expand Down
56 changes: 28 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ backtrace = "0.3.66" # Logging panics to logfile instead stderr only
dotenvy = { version = "0.15.6", default-features = false }

# Lazy initialization
once_cell = "1.15.0"
once_cell = "1.16.0"

# Numerical libraries
num-traits = "0.2.15"
Expand All @@ -72,7 +72,7 @@ diesel = { version = "2.0.2", features = ["chrono", "r2d2"] }
diesel_migrations = "2.0.0"

# Bundled SQLite
libsqlite3-sys = { version = "0.25.1", features = ["bundled"], optional = true }
libsqlite3-sys = { version = "0.25.2", features = ["bundled"], optional = true }

# Crypto-related libraries
rand = { version = "0.8.5", features = ["small_rng"] }
Expand All @@ -83,7 +83,7 @@ uuid = { version = "1.2.1", features = ["v4"] }

# Date and time libraries
chrono = { version = "0.4.22", features = ["clock", "serde"], default-features = false }
chrono-tz = "0.7.0"
chrono-tz = "0.8.0"
time = "0.3.16"

# Job scheduler
Expand All @@ -110,7 +110,7 @@ url = "2.3.1"
# Email librariese-Base, Update crates and small change.
lettre = { version = "0.10.1", features = ["smtp-transport", "builder", "serde", "tokio1-native-tls", "hostname", "tracing", "tokio1"], default-features = false }
percent-encoding = "2.2.0" # URL encoding library used for URL's in the emails
email_address = "0.2.3"
email_address = "0.2.4"

# Template library
handlebars = { version = "4.3.5", features = ["dir_source"] }
Expand Down
10 changes: 5 additions & 5 deletions docker/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
# This file was generated using a Jinja2 template.
# Please make your changes in `Dockerfile.j2` and then `make` the individual Dockerfiles.

{% set build_stage_base_image = "rust:1.64-bullseye" %}
{% set build_stage_base_image = "rust:1.65-bullseye" %}
{% if "alpine" in target_file %}
{% if "amd64" in target_file %}
{% set build_stage_base_image = "blackdex/rust-musl:x86_64-musl-stable-1.64.0" %}
{% set build_stage_base_image = "blackdex/rust-musl:x86_64-musl-stable-1.65.0" %}
{% set runtime_stage_base_image = "alpine:3.16" %}
{% set package_arch_target = "x86_64-unknown-linux-musl" %}
{% elif "armv7" in target_file %}
{% set build_stage_base_image = "blackdex/rust-musl:armv7-musleabihf-stable-1.64.0" %}
{% set build_stage_base_image = "blackdex/rust-musl:armv7-musleabihf-stable-1.65.0" %}
{% set runtime_stage_base_image = "balenalib/armv7hf-alpine:3.16" %}
{% set package_arch_target = "armv7-unknown-linux-musleabihf" %}
{% elif "armv6" in target_file %}
{% set build_stage_base_image = "blackdex/rust-musl:arm-musleabi-stable-1.64.0" %}
{% set build_stage_base_image = "blackdex/rust-musl:arm-musleabi-stable-1.65.0" %}
{% set runtime_stage_base_image = "balenalib/rpi-alpine:3.16" %}
{% set package_arch_target = "arm-unknown-linux-musleabi" %}
{% elif "arm64" in target_file %}
{% set build_stage_base_image = "blackdex/rust-musl:aarch64-musl-stable-1.64.0" %}
{% set build_stage_base_image = "blackdex/rust-musl:aarch64-musl-stable-1.65.0" %}
{% set runtime_stage_base_image = "balenalib/aarch64-alpine:3.16" %}
{% set package_arch_target = "aarch64-unknown-linux-musl" %}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion docker/amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
FROM vaultwarden/web-vault@sha256:85f5e0eaea73dfa14cfbdc64676ebbdd7aba5483ee5c1735e5eb82bd55b105f8 as vault

########################## BUILD IMAGE ##########################
FROM rust:1.64-bullseye as build
FROM rust:1.65-bullseye as build



Expand Down
Loading

0 comments on commit 529c093

Please sign in to comment.