2019-12-22 02:50:05 -05:00
|
|
|
name: build-linux
|
|
|
|
|
2019-12-24 18:20:00 -05:00
|
|
|
on: [push, pull_request]
|
2019-12-22 02:50:05 -05:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2019-12-24 18:20:00 -05:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
db-backend: [sqlite, mysql, postgresql]
|
|
|
|
|
2019-12-22 02:50:05 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2019-12-24 18:20:00 -05:00
|
|
|
- name: Install dependencies
|
|
|
|
run: sudo apt update && sudo apt install --no-install-recommends openssl sqlite3 libmysql++-dev
|
|
|
|
|
|
|
|
- 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
|
2019-12-22 02:50:05 -05:00
|
|
|
uses: actions/cache@v1.0.3
|
|
|
|
with:
|
|
|
|
path: target
|
2019-12-24 18:20:00 -05:00
|
|
|
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
|
2019-12-22 02:50:05 -05:00
|
|
|
- name: Install latest nightly
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: nightly
|
|
|
|
override: true
|
|
|
|
profile: minimal
|
|
|
|
target: x86_64-unknown-linux-gnu
|
2019-12-24 18:20:00 -05:00
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: cargo build --verbose --features ${{ matrix.db-backend }} --release --target x86_64-unknown-linux-gnu
|
|
|
|
|
2019-12-22 02:50:05 -05:00
|
|
|
- name: Run tests
|
2019-12-24 18:20:00 -05:00
|
|
|
run: cargo test --features ${{ matrix.db-backend }}
|
|
|
|
|
2019-12-22 02:50:05 -05:00
|
|
|
- name: Upload linux artifact
|
|
|
|
uses: actions/upload-artifact@v1.0.0
|
|
|
|
with:
|
2019-12-24 18:20:00 -05:00
|
|
|
name: x86_64-unknown-linux-gnu-${{ matrix.db-backend }}-bitwarden_rs
|
2019-12-22 02:50:05 -05:00
|
|
|
path: target/x86_64-unknown-linux-gnu/release/bitwarden_rs
|
2019-12-24 18:20:00 -05:00
|
|
|
|
|
|
|
- name: Release
|
2019-12-24 18:23:02 -05:00
|
|
|
uses: Shopify/upload-to-release@v1
|
2019-12-24 18:20:00 -05:00
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
with:
|
|
|
|
name: x86_64-unknown-linux-gnu-${{ matrix.db-backend }}-bitwarden_rs
|
|
|
|
path: target/x86_64-apple-darwin/release/bitwarden_rs
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|