From 13eb276085435f60433a9b525b52caf0a7eb3537 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Sun, 22 Dec 2019 18:50:05 +1100 Subject: [PATCH 1/7] Create Github build Actions --- .github/workflows/rust-linux.yml | 34 ++++++++++++++++++++++++++++++++ .github/workflows/rust-mac.yml | 30 ++++++++++++++++++++++++++++ .github/workflows/rust-win.yml | 31 +++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 .github/workflows/rust-linux.yml create mode 100644 .github/workflows/rust-mac.yml create mode 100644 .github/workflows/rust-win.yml diff --git a/.github/workflows/rust-linux.yml b/.github/workflows/rust-linux.yml new file mode 100644 index 0000000..a3ff1ae --- /dev/null +++ b/.github/workflows/rust-linux.yml @@ -0,0 +1,34 @@ +name: build-linux + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + 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 + uses: actions/cache@v1.0.3 + with: + path: target + key: ${{ runner.os }} + - name: Install latest nightly + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + 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: Run tests + run: cargo test --features sqlite + - name: Upload linux artifact + uses: actions/upload-artifact@v1.0.0 + with: + name: x86_64-unknown-linux-gnu-bitwarden_rs + path: target/x86_64-unknown-linux-gnu/release/bitwarden_rs diff --git a/.github/workflows/rust-mac.yml b/.github/workflows/rust-mac.yml new file mode 100644 index 0000000..d4e2e68 --- /dev/null +++ b/.github/workflows/rust-mac.yml @@ -0,0 +1,30 @@ +name: build-mac + +on: [push] + +jobs: + build: + + runs-on: macos-latest + + steps: + - uses: actions/checkout@v1 + - name: Cache + uses: actions/cache@v1.0.3 + with: + path: target + key: ${{ runner.os }} + - 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 + - name: Upload macOS artifact + uses: actions/upload-artifact@v1.0.0 + with: + name: x86_64-apple-darwin-bitwarden_rs + path: target/x86_64-apple-darwin/release/bitwarden_rs diff --git a/.github/workflows/rust-win.yml b/.github/workflows/rust-win.yml new file mode 100644 index 0000000..d34ebf3 --- /dev/null +++ b/.github/workflows/rust-win.yml @@ -0,0 +1,31 @@ +name: build-windows + +on: [push] + +jobs: + build: + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v1 + - name: install dependencies + run: choco install sqlite openssl + - name: Install latest nightly + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + profile: minimal + - name: Cache + uses: actions/cache@v1.0.3 + with: + path: target + key: ${{ runner.os }} + - name: Build + run: cargo.exe build --verbose --features sqlite --release + - name: Upload windows artifact + uses: actions/upload-artifact@v1.0.0 + with: + name: x86_64-pc-windows-bitwarden_rs + path: target/release/bitwarden_rs.exe From c1e39b182fc8a9c66bbc1406ada753b35b86f5c5 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 25 Dec 2019 10:20:00 +1100 Subject: [PATCH 2/7] update build actions --- .github/workflows/rust-linux.yml | 46 +++++++++++++++++++++------ .github/workflows/rust-mac.yml | 51 ++++++++++++++++++++++++------ .github/workflows/rust-win.yml | 53 ++++++++++++++++++++++++-------- 3 files changed, 119 insertions(+), 31 deletions(-) diff --git a/.github/workflows/rust-linux.yml b/.github/workflows/rust-linux.yml index a3ff1ae..85bc0b9 100644 --- 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 index d4e2e68..0d1ad32 100644 --- 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 index d34ebf3..73d95c7 100644 --- 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 }} From 8e79366076072cd7f4b76c852999020c0bd00da7 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 25 Dec 2019 10:23:02 +1100 Subject: [PATCH 3/7] fix action --- .github/workflows/rust-linux.yml | 2 +- .github/workflows/rust-mac.yml | 2 +- .github/workflows/rust-win.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust-linux.yml b/.github/workflows/rust-linux.yml index 85bc0b9..99be791 100644 --- a/.github/workflows/rust-linux.yml +++ b/.github/workflows/rust-linux.yml @@ -53,7 +53,7 @@ jobs: path: target/x86_64-unknown-linux-gnu/release/bitwarden_rs - name: Release - uses: Shopify/upload-to-release + uses: Shopify/upload-to-release@v1 if: startsWith(github.ref, 'refs/tags/') with: name: x86_64-unknown-linux-gnu-${{ matrix.db-backend }}-bitwarden_rs diff --git a/.github/workflows/rust-mac.yml b/.github/workflows/rust-mac.yml index 0d1ad32..594ba0e 100644 --- a/.github/workflows/rust-mac.yml +++ b/.github/workflows/rust-mac.yml @@ -53,7 +53,7 @@ jobs: path: target/x86_64-apple-darwin/release/bitwarden_rs - name: Release - uses: Shopify/upload-to-release + uses: Shopify/upload-to-release@v1 if: startsWith(github.ref, 'refs/tags/') with: name: x86_64-apple-darwin-${{ matrix.db-backend }}-bitwarden_rs diff --git a/.github/workflows/rust-win.yml b/.github/workflows/rust-win.yml index 73d95c7..460776e 100644 --- a/.github/workflows/rust-win.yml +++ b/.github/workflows/rust-win.yml @@ -52,7 +52,7 @@ jobs: path: target/release/bitwarden_rs.exe - name: Release - uses: Shopify/upload-to-release + uses: Shopify/upload-to-release@v1 if: startsWith(github.ref, 'refs/tags/') with: name: x86_64-pc-windows-${{ matrix.db-backend }}-bitwarden_rs From 2edc699eace98fc5bdb5c282be4ecf91aa1b447e Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 25 Dec 2019 10:25:35 +1100 Subject: [PATCH 4/7] fix --- .github/workflows/rust-linux.yml | 2 +- .github/workflows/rust-mac.yml | 2 +- .github/workflows/rust-win.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust-linux.yml b/.github/workflows/rust-linux.yml index 99be791..369c53b 100644 --- a/.github/workflows/rust-linux.yml +++ b/.github/workflows/rust-linux.yml @@ -53,7 +53,7 @@ jobs: path: target/x86_64-unknown-linux-gnu/release/bitwarden_rs - name: Release - uses: Shopify/upload-to-release@v1 + 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 diff --git a/.github/workflows/rust-mac.yml b/.github/workflows/rust-mac.yml index 594ba0e..8c26efa 100644 --- a/.github/workflows/rust-mac.yml +++ b/.github/workflows/rust-mac.yml @@ -53,7 +53,7 @@ jobs: path: target/x86_64-apple-darwin/release/bitwarden_rs - name: Release - uses: Shopify/upload-to-release@v1 + 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 diff --git a/.github/workflows/rust-win.yml b/.github/workflows/rust-win.yml index 460776e..b9c4d88 100644 --- a/.github/workflows/rust-win.yml +++ b/.github/workflows/rust-win.yml @@ -52,7 +52,7 @@ jobs: path: target/release/bitwarden_rs.exe - name: Release - uses: Shopify/upload-to-release@v1 + uses: Shopify/upload-to-release@1.0.0 if: startsWith(github.ref, 'refs/tags/') with: name: x86_64-pc-windows-${{ matrix.db-backend }}-bitwarden_rs From 824137a02c095b315054fffe18b718793831be7b Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 25 Dec 2019 11:16:35 +1100 Subject: [PATCH 5/7] update dependencies to build workflows --- .github/workflows/rust-linux.yml | 2 +- .github/workflows/rust-mac.yml | 2 +- .github/workflows/rust-win.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust-linux.yml b/.github/workflows/rust-linux.yml index 369c53b..c5a65a1 100644 --- a/.github/workflows/rust-linux.yml +++ b/.github/workflows/rust-linux.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: Install dependencies - run: sudo apt update && sudo apt install --no-install-recommends openssl sqlite3 libmysql++-dev + 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 diff --git a/.github/workflows/rust-mac.yml b/.github/workflows/rust-mac.yml index 8c26efa..87fafc9 100644 --- a/.github/workflows/rust-mac.yml +++ b/.github/workflows/rust-mac.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: Install dependencies - run: brew install openssl sqlite mysql++ + run: brew install openssl sqlite libpq mysql - name: Cache cargo registry uses: actions/cache@v1.0.3 diff --git a/.github/workflows/rust-win.yml b/.github/workflows/rust-win.yml index b9c4d88..eb5bd16 100644 --- a/.github/workflows/rust-win.yml +++ b/.github/workflows/rust-win.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: Install dependencies - run: choco install openssl sqlite + run: choco install openssl sqlite postgres mysql - name: Cache cargo registry uses: actions/cache@v1.0.3 From bdb90460c4f4bf6c7e2e483b8b086cf888d704dc Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 25 Dec 2019 11:59:07 +1100 Subject: [PATCH 6/7] Update rust-win.yml --- .github/workflows/rust-win.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust-win.yml b/.github/workflows/rust-win.yml index eb5bd16..f9ce14a 100644 --- a/.github/workflows/rust-win.yml +++ b/.github/workflows/rust-win.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v1 - name: Install dependencies - run: choco install openssl sqlite postgres mysql + run: choco install openssl sqlite postgresql12 mysql - name: Cache cargo registry uses: actions/cache@v1.0.3 From 0bcc2ae7ab666eb473f5fc94f532baa2e4d507ff Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Wed, 25 Dec 2019 12:50:57 +1100 Subject: [PATCH 7/7] Update rust-win.yml --- .github/workflows/rust-win.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust-win.yml b/.github/workflows/rust-win.yml index f9ce14a..23bc8bc 100644 --- a/.github/workflows/rust-win.yml +++ b/.github/workflows/rust-win.yml @@ -13,6 +13,13 @@ jobs: 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 @@ -38,9 +45,12 @@ jobs: toolchain: nightly override: true profile: minimal + target: x86_64-pc-windows-msvc - name: Build - run: cargo.exe build --verbose --features ${{ matrix.db-backend }} --release + 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 }} @@ -48,13 +58,13 @@ jobs: - name: Upload windows artifact uses: actions/upload-artifact@v1.0.0 with: - name: x86_64-pc-windows-${{ matrix.db-backend }}-bitwarden_rs + 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-${{ matrix.db-backend }}-bitwarden_rs + name: x86_64-pc-windows-msvc-${{ matrix.db-backend }}-bitwarden_rs path: target/release/bitwarden_rs.exe repo-token: ${{ secrets.GITHUB_TOKEN }}