Skip to content

Commit 87da038

Browse files
committed
add ci for example
1 parent 320c207 commit 87da038

File tree

1 file changed

+48
-13
lines changed

1 file changed

+48
-13
lines changed

.github/workflows/github-actions.yml

+48-13
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ name: CI
44

55
on:
66
push:
7-
branches: [ main ]
7+
branches: ["*"]
88
pull_request:
9-
branches: [ main ]
9+
branches: ["*"]
1010

1111
workflow_dispatch:
1212

1313
jobs:
14-
check:
14+
check:
1515
name: check dubbo-rust project
1616
runs-on: ${{ matrix.os }}
1717
strategy:
@@ -21,28 +21,63 @@ jobs:
2121

2222
env:
2323
RUSTFLAGS: "-D warnings"
24-
24+
2525
steps:
26-
- uses: actions/checkout@main
27-
- uses: actions-rs/toolchain@v1
28-
with:
26+
- uses: actions/checkout@main
27+
- uses: actions-rs/toolchain@v1
28+
with:
2929
toolchain: ${{ matrix.rust }}
30-
- name: Install Protoc
31-
uses: arduino/setup-protoc@v1
32-
- run: cargo check
33-
34-
fmt:
30+
- name: Install Protoc
31+
uses: arduino/setup-protoc@v1
32+
with:
33+
repo-token: ${{ secrets.GITHUB_TOKEN }}
34+
- run: cargo check
35+
36+
fmt:
3537
name: Rustfmt
3638
runs-on: ${{ matrix.os }}
3739
strategy:
3840
matrix:
3941
os: [ubuntu-latest, macOS-latest, windows-latest]
4042
rust: [stable]
41-
43+
4244
steps:
4345
- uses: actions/checkout@main
4446
- uses: actions-rs/toolchain@v1
4547
with:
4648
toolchain: ${{ matrix.rust }}
4749
- run: rustup component add rustfmt
4850
- run: cargo fmt --all -- --check
51+
52+
example-greeter:
53+
name: example/greeter
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@main
57+
- uses: actions-rs/toolchain@v1
58+
with:
59+
toolchain: stable
60+
- name: Install Protoc
61+
uses: arduino/setup-protoc@v1
62+
with:
63+
repo-token: ${{ secrets.GITHUB_TOKEN }}
64+
- name: Set up cargo cache
65+
uses: actions/cache@v3
66+
continue-on-error: false
67+
with:
68+
path: |
69+
~/.cargo/bin/
70+
~/.cargo/registry/index/
71+
~/.cargo/registry/cache/
72+
~/.cargo/git/db/
73+
target/
74+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
75+
restore-keys: ${{ runner.os }}-cargo-
76+
- run: cargo build
77+
working-directory: examples/greeter
78+
- name: example greeter
79+
run: |
80+
../../target/debug/greeter-server &
81+
sleep 1s ;
82+
../../target/debug/greeter-client
83+
working-directory: examples/greeter

0 commit comments

Comments
 (0)