Skip to content

Commit 8060ae1

Browse files
committed
ci: update github actions, add publish workflow for version tags
1 parent a3108bd commit 8060ae1

File tree

6 files changed

+77
-17
lines changed

6 files changed

+77
-17
lines changed

.github/workflows/publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags: v*
6+
7+
env:
8+
CARGO_TERM_COLOR: always
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/cache@v2
16+
with:
17+
path: |
18+
~/.cargo/registry
19+
~/.cargo/git
20+
target
21+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
22+
- name: Build
23+
run: ./scripts/build
24+
- name: Run tests
25+
run: ./scripts/check
26+
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
27+
with:
28+
version: "299.0.0"
29+
service_account_key: ${{ secrets.GCP_SA_KEY }}
30+
- name: Publish Binaries
31+
run: ./cli/publish-binaries
32+
- name: Publish Crates
33+
run: |
34+
cargo login ${{ secrets.CRATES_IO_TOKEN }}
35+
./scripts/publish

.github/workflows/rust.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,26 @@ name: Build
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66
pull_request:
7-
branches: [ master ]
7+
branches: [master]
88

99
env:
1010
CARGO_TERM_COLOR: always
1111

1212
jobs:
1313
build:
14-
1514
runs-on: ubuntu-latest
16-
1715
steps:
18-
- uses: actions/checkout@v2
19-
- name: Build
20-
run: cargo build --verbose
21-
- name: Run tests
22-
run: cargo test --verbose
16+
- uses: actions/checkout@v2
17+
- uses: actions/cache@v2
18+
with:
19+
path: |
20+
~/.cargo/registry
21+
~/.cargo/git
22+
target
23+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
24+
- name: Build
25+
run: ./scripts/build
26+
- name: Run tests
27+
run: ./scripts/check

check

Lines changed: 0 additions & 8 deletions
This file was deleted.

scripts/build

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
cargo check --locked --all-targets
6+
cargo build --locked --all-targets

scripts/check

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
set -ex
4+
5+
cd "$(dirname "$0")/.."
6+
7+
cargo fmt -- --check
8+
cargo clippy --offline --locked --all-targets -- -D warnings
9+
cargo test --offline --locked --all-targets
10+
cargo test --offline --locked --doc

scripts/publish

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
cd "$(dirname "$0")/.."
6+
ROOT="$PWD"
7+
8+
cd "$ROOT/api"
9+
cargo publish
10+
11+
cd "$ROOT/cli"
12+
cargo publish

0 commit comments

Comments
 (0)