commit c1e39b182fc8a9c66bbc1406ada753b35b86f5c5
parent 13eb276085435f60433a9b525b52caf0a7eb3537
Author: Sebastian Schmidt <publicarray@users.noreply.github.com>
Date: Wed, 25 Dec 2019 10:20:00 +1100
update build actions
Diffstat:
3 files changed, 119 insertions(+), 31 deletions(-)
diff --git a/.github/workflows/rust-linux.yml b/.github/workflows/rust-linux.yml
@@ -1,21 +1,37 @@
name: build-linux
-on: [push]
+on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ db-backend: [sqlite, mysql, postgresql]
+
steps:
- uses: actions/checkout@v1
- - name: install dependencies
- run: sudo apt update && sudo apt install --no-install-recommends openssl ca-certificates curl sqlite3
- - name: Cache
+ - 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
uses: actions/cache@v1.0.3
with:
path: target
- key: ${{ runner.os }}
+ key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
+
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
@@ -23,12 +39,24 @@ jobs:
override: true
profile: minimal
target: x86_64-unknown-linux-gnu
- - name: Build x86_64-unknown-linux-gnu
- run: cargo build --verbose --features sqlite --release --target x86_64-unknown-linux-gnu
+
+ - name: Build
+ run: cargo build --verbose --features ${{ matrix.db-backend }} --release --target x86_64-unknown-linux-gnu
+
- name: Run tests
- run: cargo test --features sqlite
+ run: cargo test --features ${{ matrix.db-backend }}
+
- name: Upload linux artifact
uses: actions/upload-artifact@v1.0.0
with:
- name: x86_64-unknown-linux-gnu-bitwarden_rs
+ name: x86_64-unknown-linux-gnu-${{ matrix.db-backend }}-bitwarden_rs
path: target/x86_64-unknown-linux-gnu/release/bitwarden_rs
+
+ - name: Release
+ uses: Shopify/upload-to-release
+ 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 }}
+
diff --git a/.github/workflows/rust-mac.yml b/.github/workflows/rust-mac.yml
@@ -1,30 +1,61 @@
name: build-mac
-on: [push]
+on: [push, pull_request]
jobs:
build:
runs-on: macos-latest
+ strategy:
+ matrix:
+ db-backend: [sqlite, mysql, postgresql]
+
steps:
- uses: actions/checkout@v1
- - name: Cache
+ - name: Install dependencies
+ run: brew install openssl sqlite 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 }}
+ 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 x86_64-apple-darwin
- run: cargo build --verbose --features sqlite --release --target x86_64-apple-darwin
+ 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-bitwarden_rs
+ 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
+ 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 }}
diff --git a/.github/workflows/rust-win.yml b/.github/workflows/rust-win.yml
@@ -1,31 +1,60 @@
name: build-windows
-on: [push]
+on: [push, pull_request]
jobs:
build:
runs-on: windows-latest
+ strategy:
+ matrix:
+ db-backend: [sqlite, mysql, postgresql]
+
steps:
- uses: actions/checkout@v1
- - name: install dependencies
- run: choco install sqlite openssl
- - name: Install latest nightly
- uses: actions-rs/toolchain@v1
+ - name: Install dependencies
+ run: choco install openssl sqlite
+
+ - name: Cache cargo registry
+ uses: actions/cache@v1.0.3
with:
- toolchain: nightly
- override: true
- profile: minimal
- - name: Cache
+ 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 }}
+ 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
+
- name: Build
- run: cargo.exe build --verbose --features sqlite --release
+ run: cargo.exe build --verbose --features ${{ matrix.db-backend }} --release
+
+ - name: Run tests
+ run: cargo test --features ${{ matrix.db-backend }}
+
- name: Upload windows artifact
uses: actions/upload-artifact@v1.0.0
with:
- name: x86_64-pc-windows-bitwarden_rs
+ name: x86_64-pc-windows-${{ matrix.db-backend }}-bitwarden_rs
+ path: target/release/bitwarden_rs.exe
+
+ - name: Release
+ uses: Shopify/upload-to-release
+ if: startsWith(github.ref, 'refs/tags/')
+ with:
+ name: x86_64-pc-windows-${{ matrix.db-backend }}-bitwarden_rs
path: target/release/bitwarden_rs.exe
+ repo-token: ${{ secrets.GITHUB_TOKEN }}