1
0
Fork 1
Spiegel von https://github.com/dani-garcia/vaultwarden.git synchronisiert 2024-11-10 03:12:53 +01:00
vaultwarden/.github/workflows/workspace.yml

149 Zeilen
4,6 KiB
YAML

2019-12-28 08:55:54 +01:00
name: Workflow
on:
push:
paths-ignore:
- "**.md"
#pull_request:
# paths-ignore:
# - "**.md"
2019-12-28 08:55:54 +01:00
jobs:
build:
name: Build
strategy:
fail-fast: false
matrix:
db-backend: [sqlite, mysql, postgresql]
target:
- x86_64-unknown-linux-gnu
# - x86_64-unknown-linux-musl
# - x86_64-apple-darwin
2020-01-05 10:45:03 +01:00
# - x86_64-pc-windows-msvc
2019-12-28 08:55:54 +01:00
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
2019-12-29 07:21:59 +01:00
ext:
2019-12-28 08:55:54 +01:00
# - target: x86_64-unknown-linux-musl
# os: ubuntu-latest
2019-12-29 07:21:59 +01:00
# ext:
# - target: x86_64-apple-darwin
# os: macOS-latest
# ext:
2020-01-05 10:45:03 +01:00
# - target: x86_64-pc-windows-msvc
# os: windows-latest
# ext: .exe
2019-12-28 08:55:54 +01:00
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
# - name: Cache choco cache
# uses: actions/cache@v1.0.3
# if: matrix.os == 'windows-latest'
# with:
# path: ~\AppData\Local\Temp\chocolatey
# key: ${{ runner.os }}-choco-cache-${{ matrix.db-backend }}
- name: Cache vcpkg installed
uses: actions/cache@v1.0.3
if: matrix.os == 'windows-latest'
with:
2019-12-29 07:21:59 +01:00
path: $VCPKG_ROOT/installed
2019-12-28 08:55:54 +01:00
key: ${{ runner.os }}-vcpkg-cache-${{ matrix.db-backend }}
2019-12-29 07:21:59 +01:00
env:
VCPKG_ROOT: 'C:\vcpkg'
2019-12-28 08:55:54 +01:00
- name: Cache vcpkg downloads
uses: actions/cache@v1.0.3
if: matrix.os == 'windows-latest'
with:
2019-12-29 07:21:59 +01:00
path: $VCPKG_ROOT/downloads
2019-12-28 08:55:54 +01:00
key: ${{ runner.os }}-vcpkg-cache-${{ matrix.db-backend }}
2019-12-29 07:21:59 +01:00
env:
VCPKG_ROOT: 'C:\vcpkg'
2019-12-28 08:55:54 +01:00
# - name: Cache homebrew
# uses: actions/cache@v1.0.3
# if: matrix.os == 'macOS-latest'
# with:
# path: ~/Library/Caches/Homebrew
# key: ${{ runner.os }}-brew-cache
# - name: Cache apt
# uses: actions/cache@v1.0.3
# if: matrix.os == 'ubuntu-latest'
# with:
# path: /var/cache/apt/archives
# key: ${{ runner.os }}-apt-cache
# Install dependencies
- name: Install dependencies macOS
run: brew update; brew install openssl sqlite libpq mysql
if: matrix.os == 'macOS-latest'
- name: Install dependencies Ubuntu
run: sudo apt-get update && sudo apt-get install --no-install-recommends openssl sqlite libpq-dev libmysql++-dev
if: matrix.os == 'ubuntu-latest'
- name: Install dependencies Windows
run: vcpkg integrate install; vcpkg install sqlite3:x64-windows openssl:x64-windows libpq:x64-windows libmysql:x64-windows
if: matrix.os == 'windows-latest'
2019-12-29 07:21:59 +01:00
env:
VCPKG_ROOT: 'C:\vcpkg'
2019-12-28 08:55:54 +01:00
# End Install dependencies
# Install rust nightly toolchain
- name: Cache cargo registry
uses: actions/cache@v1.0.3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-${{matrix.db-backend}}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1.0.3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-${{matrix.db-backend}}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1.0.3
with:
path: target
key: ${{ runner.os }}-${{matrix.db-backend}}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Install latest nightly
uses: actions-rs/toolchain@v1.0.5
2019-12-28 08:55:54 +01:00
with:
# Uses rust-toolchain to determine version
2019-12-28 08:55:54 +01:00
profile: minimal
target: ${{ matrix.target }}
# Build
- name: Build Win
if: matrix.os == 'windows-latest'
run: cargo.exe build --features ${{ matrix.db-backend }} --release --target ${{ matrix.target }}
env:
RUSTFLAGS: -Ctarget-feature=+crt-static
2019-12-29 07:21:59 +01:00
VCPKG_ROOT: 'C:\vcpkg'
2019-12-28 08:55:54 +01:00
- name: Build macOS / Ubuntu
if: matrix.os == 'macOS-latest' || matrix.os == 'ubuntu-latest'
run: cargo build --verbose --features ${{ matrix.db-backend }} --release --target ${{ matrix.target }}
# Test
- name: Run tests
run: cargo test --features ${{ matrix.db-backend }}
# Upload & Release
- name: Upload artifact
uses: actions/upload-artifact@v1.0.0
with:
name: bitwarden_rs-${{ matrix.db-backend }}-${{ matrix.target }}${{ matrix.ext }}
path: target/${{ matrix.target }}/release/bitwarden_rs${{ matrix.ext }}
- name: Release
uses: Shopify/upload-to-release@1.0.0
if: startsWith(github.ref, 'refs/tags/')
with:
name: bitwarden_rs-${{ matrix.db-backend }}-${{ matrix.target }}${{ matrix.ext }}
path: target/${{ matrix.target }}/release/bitwarden_rs${{ matrix.ext }}
repo-token: ${{ secrets.GITHUB_TOKEN }}