vaultwarden/.github/workflows/rust-mac.yml
2019-12-25 11:16:35 +11:00

61 lines
1.7 KiB
YAML

name: build-mac
on: [push, pull_request]
jobs:
build:
runs-on: macos-latest
strategy:
matrix:
db-backend: [sqlite, mysql, postgresql]
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: brew install openssl sqlite libpq mysql
- name: Cache cargo registry
uses: actions/cache@v1.0.3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1.0.3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1.0.3
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
profile: minimal
target: x86_64-apple-darwin
- name: Build
run: cargo build --verbose --features ${{ matrix.db-backend }} --release --target x86_64-apple-darwin
- name: Run tests
run: cargo test --features ${{ matrix.db-backend }}
- name: Upload macOS artifact
uses: actions/upload-artifact@v1.0.0
with:
name: x86_64-apple-darwin-${{ matrix.db-backend }}-bitwarden_rs
path: target/x86_64-apple-darwin/release/bitwarden_rs
- name: Release
uses: Shopify/upload-to-release@1.0.0
if: startsWith(github.ref, 'refs/tags/')
with:
name: x86_64-apple-darwin-${{ matrix.db-backend }}-bitwarden_rs
path: target/x86_64-apple-darwin/release/bitwarden_rs
repo-token: ${{ secrets.GITHUB_TOKEN }}