mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2024-11-13 17:06:33 +00:00
b0faaf2527
- Removed all `thread::sleep` and use `tokio::time::sleep` now. This solves an issue with updating to Bullseye ( Resolves #1998 ) - Updated all Debian images to Bullseye - Added MiMalloc feature and enabled it by default for Alpine based images This increases performance for the Alpine images because the default memory allocator for MUSL based binaries isn't that fast - Updated `dotenv` to `dotenvy` a maintained and updated fork - Fixed an issue with a newer jslib (not fully released yet) That version uses a different endpoint for `prelogin` Resolves #2378 )
148 lines
5.7 KiB
YAML
148 lines
5.7 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- ".github/workflows/build.yml"
|
|
- "src/**"
|
|
- "migrations/**"
|
|
- "Cargo.*"
|
|
- "build.rs"
|
|
- "diesel.toml"
|
|
- "rust-toolchain"
|
|
pull_request:
|
|
paths:
|
|
- ".github/workflows/build.yml"
|
|
- "src/**"
|
|
- "migrations/**"
|
|
- "Cargo.*"
|
|
- "build.rs"
|
|
- "diesel.toml"
|
|
- "rust-toolchain"
|
|
|
|
jobs:
|
|
build:
|
|
# Make warnings errors, this is to prevent warnings slipping through.
|
|
# This is done globally to prevent rebuilds when the RUSTFLAGS env variable changes.
|
|
env:
|
|
RUSTFLAGS: "-D warnings"
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
channel:
|
|
- stable
|
|
target-triple:
|
|
- x86_64-unknown-linux-gnu
|
|
include:
|
|
- target-triple: x86_64-unknown-linux-gnu
|
|
host-triple: x86_64-unknown-linux-gnu
|
|
features: [sqlite,mysql,postgresql,enable_mimalloc] # Remember to update the `cargo test` to match the amount of features
|
|
channel: stable
|
|
os: ubuntu-20.04
|
|
ext: ""
|
|
|
|
name: Building ${{ matrix.channel }}-${{ matrix.target-triple }}
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
# Checkout the repo
|
|
- name: Checkout
|
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
|
|
# End Checkout the repo
|
|
|
|
|
|
# Install musl-tools when needed
|
|
- name: Install musl tools
|
|
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends musl-dev musl-tools cmake
|
|
if: matrix.target-triple == 'x86_64-unknown-linux-musl'
|
|
# End Install musl-tools when needed
|
|
|
|
|
|
# Install dependencies
|
|
- name: Install dependencies Ubuntu
|
|
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends openssl sqlite build-essential libmariadb-dev-compat libpq-dev libssl-dev pkgconf
|
|
if: startsWith( matrix.os, 'ubuntu' )
|
|
# End Install dependencies
|
|
|
|
|
|
# Enable Rust Caching
|
|
- uses: Swatinem/rust-cache@842ef286fff290e445b90b4002cc9807c3669641 # v1.3.0
|
|
# End Enable Rust Caching
|
|
|
|
|
|
# Uses the rust-toolchain file to determine version
|
|
- name: 'Install ${{ matrix.channel }}-${{ matrix.host-triple }} for target: ${{ matrix.target-triple }}'
|
|
uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # v1.0.6
|
|
with:
|
|
profile: minimal
|
|
target: ${{ matrix.target-triple }}
|
|
components: clippy, rustfmt
|
|
# End Uses the rust-toolchain file to determine version
|
|
|
|
|
|
# Run cargo tests (In release mode to speed up future builds)
|
|
# First test all features together, afterwards test them separately.
|
|
- name: "`cargo test --release --features ${{ join(matrix.features, ',') }} --target ${{ matrix.target-triple }}`"
|
|
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
|
|
with:
|
|
command: test
|
|
args: --release --features ${{ join(matrix.features, ',') }} --target ${{ matrix.target-triple }}
|
|
# Test single features
|
|
# 0: sqlite
|
|
- name: "`cargo test --release --features ${{ matrix.features[0] }} --target ${{ matrix.target-triple }}`"
|
|
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
|
|
with:
|
|
command: test
|
|
args: --release --features ${{ matrix.features[0] }} --target ${{ matrix.target-triple }}
|
|
if: ${{ matrix.features[0] != '' }}
|
|
# 1: mysql
|
|
- name: "`cargo test --release --features ${{ matrix.features[1] }} --target ${{ matrix.target-triple }}`"
|
|
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
|
|
with:
|
|
command: test
|
|
args: --release --features ${{ matrix.features[1] }} --target ${{ matrix.target-triple }}
|
|
if: ${{ matrix.features[1] != '' }}
|
|
# 2: postgresql
|
|
- name: "`cargo test --release --features ${{ matrix.features[2] }} --target ${{ matrix.target-triple }}`"
|
|
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
|
|
with:
|
|
command: test
|
|
args: --release --features ${{ matrix.features[2] }} --target ${{ matrix.target-triple }}
|
|
if: ${{ matrix.features[2] != '' }}
|
|
# End Run cargo tests
|
|
|
|
|
|
# Run cargo clippy, and fail on warnings (In release mode to speed up future builds)
|
|
- name: "`cargo clippy --release --features ${{ join(matrix.features, ',') }} --target ${{ matrix.target-triple }}`"
|
|
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
|
|
with:
|
|
command: clippy
|
|
args: --release --features ${{ join(matrix.features, ',') }} --target ${{ matrix.target-triple }} -- -D warnings
|
|
# End Run cargo clippy
|
|
|
|
|
|
# Run cargo fmt
|
|
- name: '`cargo fmt`'
|
|
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
|
|
with:
|
|
command: fmt
|
|
args: --all -- --check
|
|
# End Run cargo fmt
|
|
|
|
|
|
# Build the binary
|
|
- name: "`cargo build --release --features ${{ join(matrix.features, ',') }} --target ${{ matrix.target-triple }}`"
|
|
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
|
|
with:
|
|
command: build
|
|
args: --release --features ${{ join(matrix.features, ',') }} --target ${{ matrix.target-triple }}
|
|
# End Build the binary
|
|
|
|
|
|
# Upload artifact to Github Actions
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2.3.1
|
|
with:
|
|
name: vaultwarden-${{ matrix.target-triple }}${{ matrix.ext }}
|
|
path: target/${{ matrix.target-triple }}/release/vaultwarden${{ matrix.ext }}
|
|
# End Upload artifact to Github Actions
|