From 4deae76347d7e3f7ee421c4d31cb26ea283f5c1e Mon Sep 17 00:00:00 2001
From: Sebastian Schmidt <publicarray@users.noreply.github.com>
Date: Sat, 28 Dec 2019 18:55:54 +1100
Subject: [PATCH 1/3] Update build workflow

---
 .github/workflows/rust-linux.yml |  62 -------------
 .github/workflows/rust-mac.yml   |  61 -------------
 .github/workflows/rust-win.yml   |  70 ---------------
 .github/workflows/workspace.yml  | 145 +++++++++++++++++++++++++++++++
 4 files changed, 145 insertions(+), 193 deletions(-)
 delete mode 100644 .github/workflows/rust-linux.yml
 delete mode 100644 .github/workflows/rust-mac.yml
 delete mode 100644 .github/workflows/rust-win.yml
 create mode 100644 .github/workflows/workspace.yml

diff --git a/.github/workflows/rust-linux.yml b/.github/workflows/rust-linux.yml
deleted file mode 100644
index c5a65a11..00000000
--- a/.github/workflows/rust-linux.yml
+++ /dev/null
@@ -1,62 +0,0 @@
-name: build-linux
-
-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 sqlite3 libmysql++-dev libpq-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 }}-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-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 ${{ matrix.db-backend }}
-
-    - name: Upload linux artifact
-      uses: actions/upload-artifact@v1.0.0
-      with:
-        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@1.0.0
-      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
deleted file mode 100644
index 87fafc9b..00000000
--- a/.github/workflows/rust-mac.yml
+++ /dev/null
@@ -1,61 +0,0 @@
-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 }}
diff --git a/.github/workflows/rust-win.yml b/.github/workflows/rust-win.yml
deleted file mode 100644
index 23bc8bcb..00000000
--- a/.github/workflows/rust-win.yml
+++ /dev/null
@@ -1,70 +0,0 @@
-name: build-windows
-
-on: [push, pull_request]
-
-jobs:
-  build:
-
-    runs-on: windows-latest
-
-    strategy:
-      matrix:
-        db-backend: [sqlite, mysql, postgresql]
-
-    steps:
-    - uses: actions/checkout@v1
-
-    - name: Cache choco cache
-      uses: actions/cache@v1.0.3
-      with:
-        path: ~\AppData\Local\Temp\chocolatey
-        key: ${{ runner.os }}-choco-cache
-
-    - name: Install dependencies
-      run: choco install openssl sqlite postgresql12 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-pc-windows-msvc
-
-    - name: Build
-      run: cargo.exe build --verbose --features ${{ matrix.db-backend }} --release --target x86_64-pc-windows-msvc
-      env:
-        OPENSSL_DIR: C:\Program Files\OpenSSL-Win64\
-
-    - 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-msvc-${{ matrix.db-backend }}-bitwarden_rs
-        path: target/release/bitwarden_rs.exe
-
-    - name: Release
-      uses: Shopify/upload-to-release@1.0.0
-      if: startsWith(github.ref, 'refs/tags/')
-      with:
-        name: x86_64-pc-windows-msvc-${{ matrix.db-backend }}-bitwarden_rs
-        path: target/release/bitwarden_rs.exe
-        repo-token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/workspace.yml b/.github/workflows/workspace.yml
new file mode 100644
index 00000000..3343ca63
--- /dev/null
+++ b/.github/workflows/workspace.yml
@@ -0,0 +1,145 @@
+name: Workflow
+
+on:
+  push:
+    paths-ignore:
+      - "**.md"
+  pull_request:
+    paths-ignore:
+      - "**.md"
+
+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
+          - x86_64-pc-windows-msvc
+        include:
+          - target: x86_64-unknown-linux-gnu
+            os: ubuntu-latest
+            ext: ''
+          # - target: x86_64-unknown-linux-musl
+          #   os: ubuntu-latest
+          #   ext: ''
+          - target: x86_64-apple-darwin
+            os: macOS-latest
+            ext: ''
+          - target: x86_64-pc-windows-msvc
+            os: windows-latest
+            ext: .exe
+    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:
+        path: $VCPKG_DIR/installed
+        key: ${{ runner.os }}-vcpkg-cache-${{ matrix.db-backend }}
+
+    - name: Cache vcpkg downloads
+      uses: actions/cache@v1.0.3
+      if: matrix.os == 'windows-latest'
+      with:
+        path: $VCPKG_DIR/downloads
+        key: ${{ runner.os }}-vcpkg-cache-${{ matrix.db-backend }}
+
+    # - 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'
+    # 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
+      with:
+        toolchain: nightly
+        override: true
+        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:
+        OPENSSL_DIR: C:\Program Files\OpenSSL\
+        MYSQLCLIENT_LIB_DIR: C:\Program Files\MySQL\MySQL Server 8.0\lib
+        PQ_LIB_DIR: C:\Program Files\PostgreSQL\12\lib
+        RUSTFLAGS: -Ctarget-feature=+crt-static
+
+    - 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 }}

From 24edc94f9df10940be0f20c324da3b2fe9d1bbc5 Mon Sep 17 00:00:00 2001
From: Sebastian Schmidt <publicarray@users.noreply.github.com>
Date: Sun, 29 Dec 2019 17:21:59 +1100
Subject: [PATCH 2/3] try setting VCPKG_ROOT

---
 .github/workflows/workspace.yml | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/workspace.yml b/.github/workflows/workspace.yml
index 3343ca63..c99eaf66 100644
--- a/.github/workflows/workspace.yml
+++ b/.github/workflows/workspace.yml
@@ -23,13 +23,13 @@ jobs:
         include:
           - target: x86_64-unknown-linux-gnu
             os: ubuntu-latest
-            ext: ''
+            ext:
           # - target: x86_64-unknown-linux-musl
           #   os: ubuntu-latest
-          #   ext: ''
+          #   ext:
           - target: x86_64-apple-darwin
             os: macOS-latest
-            ext: ''
+            ext:
           - target: x86_64-pc-windows-msvc
             os: windows-latest
             ext: .exe
@@ -48,15 +48,19 @@ jobs:
       uses: actions/cache@v1.0.3
       if: matrix.os == 'windows-latest'
       with:
-        path: $VCPKG_DIR/installed
+        path: $VCPKG_ROOT/installed
         key: ${{ runner.os }}-vcpkg-cache-${{ matrix.db-backend }}
+      env:
+        VCPKG_ROOT: 'C:\vcpkg'
 
     - name: Cache vcpkg downloads
       uses: actions/cache@v1.0.3
       if: matrix.os == 'windows-latest'
       with:
-        path: $VCPKG_DIR/downloads
+        path: $VCPKG_ROOT/downloads
         key: ${{ runner.os }}-vcpkg-cache-${{ matrix.db-backend }}
+      env:
+        VCPKG_ROOT: 'C:\vcpkg'
 
     # - name: Cache homebrew
     #   uses: actions/cache@v1.0.3
@@ -84,6 +88,8 @@ jobs:
     - 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'
+      env:
+        VCPKG_ROOT: 'C:\vcpkg'
     # End Install dependencies
 
     # Install rust nightly toolchain
@@ -116,10 +122,8 @@ jobs:
       if: matrix.os == 'windows-latest'
       run: cargo.exe build --features ${{ matrix.db-backend }} --release --target ${{ matrix.target }}
       env:
-        OPENSSL_DIR: C:\Program Files\OpenSSL\
-        MYSQLCLIENT_LIB_DIR: C:\Program Files\MySQL\MySQL Server 8.0\lib
-        PQ_LIB_DIR: C:\Program Files\PostgreSQL\12\lib
         RUSTFLAGS: -Ctarget-feature=+crt-static
+        VCPKG_ROOT: 'C:\vcpkg'
 
     - name: Build macOS / Ubuntu
       if: matrix.os == 'macOS-latest' || matrix.os == 'ubuntu-latest'

From 0a88f020e1ca33a8ab80029d96bfe6ea3d66aa2e Mon Sep 17 00:00:00 2001
From: Sebastian Schmidt <publicarray@users.noreply.github.com>
Date: Sun, 5 Jan 2020 20:45:03 +1100
Subject: [PATCH 3/3] Disable Windows workflow

---
 .github/workflows/workspace.yml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/workspace.yml b/.github/workflows/workspace.yml
index c99eaf66..222b66c3 100644
--- a/.github/workflows/workspace.yml
+++ b/.github/workflows/workspace.yml
@@ -19,7 +19,7 @@ jobs:
           - x86_64-unknown-linux-gnu
           # - x86_64-unknown-linux-musl
           - x86_64-apple-darwin
-          - x86_64-pc-windows-msvc
+          # - x86_64-pc-windows-msvc
         include:
           - target: x86_64-unknown-linux-gnu
             os: ubuntu-latest
@@ -30,9 +30,9 @@ jobs:
           - target: x86_64-apple-darwin
             os: macOS-latest
             ext:
-          - target: x86_64-pc-windows-msvc
-            os: windows-latest
-            ext: .exe
+          # - target: x86_64-pc-windows-msvc
+          #   os: windows-latest
+          #   ext: .exe
     runs-on: ${{ matrix.os }}
     steps:
     - uses: actions/checkout@v1