diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..c1d6eade --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,35 @@ +name: Publish + +on: + push: + tags: v* + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Build + run: ./scripts/build + - name: Run tests + run: ./scripts/check + - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master + with: + version: "299.0.0" + service_account_key: ${{ secrets.GCP_SA_KEY }} + - name: Publish Binaries + run: ./cli/publish-binaries + - name: Publish Crates + run: | + cargo login ${{ secrets.CRATES_IO_TOKEN }} + ./scripts/publish diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f94bef39..bd634f59 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -2,21 +2,26 @@ name: Build on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] env: CARGO_TERM_COLOR: always jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Build + run: ./scripts/build + - name: Run tests + run: ./scripts/check diff --git a/check b/check deleted file mode 100755 index 08680fc6..00000000 --- a/check +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -set -ex -cd "$(dirname "$0")" - -cargo fmt -- --check -cargo clippy --all-targets --all-features --locked --offline -- -D warnings -cargo test --offline --locked --all-targets -cargo test --offline --locked --manifest-path cli/Cargo.toml diff --git a/scripts/build b/scripts/build new file mode 100755 index 00000000..2418e7b0 --- /dev/null +++ b/scripts/build @@ -0,0 +1,6 @@ +#!/bin/bash + +set -ex + +cargo check --locked --all-targets +cargo build --locked --all-targets diff --git a/scripts/check b/scripts/check new file mode 100755 index 00000000..3f6eb1a3 --- /dev/null +++ b/scripts/check @@ -0,0 +1,10 @@ +#!/bin/sh + +set -ex + +cd "$(dirname "$0")/.." + +cargo fmt -- --check +cargo clippy --offline --locked --all-targets -- -D warnings +cargo test --offline --locked --all-targets +cargo test --offline --locked --doc diff --git a/scripts/publish b/scripts/publish new file mode 100755 index 00000000..6a1673ca --- /dev/null +++ b/scripts/publish @@ -0,0 +1,12 @@ +#!/bin/bash + +set -ex + +cd "$(dirname "$0")/.." +ROOT="$PWD" + +cd "$ROOT/api" +cargo publish + +cd "$ROOT/cli" +cargo publish