Skip to content

Commit a9fbb8e

Browse files
Updates on actions
Signed-off-by: Francesco Guardiani <[email protected]>
1 parent e650033 commit a9fbb8e

File tree

3 files changed

+80
-61
lines changed

3 files changed

+80
-61
lines changed

.github/workflows/pr.yml

Lines changed: 0 additions & 60 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Pull Request checks
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
fmt:
10+
name: Format check
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions-rs/toolchain@v1
15+
with:
16+
profile: minimal
17+
toolchain: stable
18+
override: true
19+
components: clippy, rustfmt
20+
- uses: actions-rs/cargo@v1
21+
with:
22+
command: fmt
23+
args: --all -- --check
24+
- uses: actions-rs/cargo@v1
25+
with:
26+
command: clippy
27+
args: -- -D warnings

.github/workflows/master.yml renamed to .github/workflows/rust_tests.yml

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
name: Master
1+
name: Rust tests
22

33
on:
4+
pull_request:
5+
branches:
6+
- master
47
push:
58
branches:
69
- master
@@ -78,10 +81,59 @@ jobs:
7881
env:
7982
CC: musl-gcc
8083
CXX: g++
84+
8185
# If wasm, then we test only the main module and cloudevents-sdk-reqwest
8286
- uses: actions-rs/cargo@v1
8387
if: matrix.target == 'wasm32-unknown-unknown'
8488
with:
8589
command: build
8690
toolchain: ${{ matrix.toolchain }}
8791
args: --target wasm32-unknown-unknown --package cloudevents-sdk --package cloudevents-sdk-reqwest
92+
93+
build-examples:
94+
name: Build examples
95+
runs-on: ubuntu-latest
96+
needs: build
97+
strategy:
98+
matrix:
99+
target:
100+
- x86_64-unknown-linux-gnu
101+
- wasm32-unknown-unknown
102+
steps:
103+
- uses: actions/checkout@v2
104+
- name: Cache cargo registry
105+
uses: actions/cache@v1
106+
with:
107+
path: ~/.cargo/registry
108+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
109+
- name: Cache cargo index
110+
uses: actions/cache@v1
111+
with:
112+
path: ~/.cargo/git
113+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
114+
- name: Cache cargo build
115+
uses: actions/cache@v1
116+
with:
117+
path: target
118+
key: ${{ runner.os }}-cargo-build-target-${{ matrix.toolchain }}-stable-${{ hashFiles('**/Cargo.lock') }}
119+
- uses: actions-rs/toolchain@v1
120+
with:
121+
toolchain: ${{ matrix.toolchain }}
122+
target: ${{ matrix.target }}
123+
override: true
124+
125+
# Build examples
126+
- name: "Build reqwest-wasm-example"
127+
if: matrix.target == 'wasm32-unknown-unknown'
128+
working-directory: ${GITHUB_WORKSPACE}/example-projects/reqwest-wasm-example
129+
run: cargo build --target ${{ matrix.target }}
130+
131+
- name: "Build rdkafka-example"
132+
if: matrix.target == 'x86_64-unknown-linux-gnu'
133+
working-directory: ${GITHUB_WORKSPACE}/example-projects/rdkafka-example
134+
run: cargo build --target ${{ matrix.target }}
135+
136+
- name: "Build actix-web-example"
137+
if: matrix.target == 'x86_64-unknown-linux-gnu'
138+
working-directory: ${GITHUB_WORKSPACE}/example-projects/actix-web-example
139+
run: cargo build --target ${{ matrix.target }}

0 commit comments

Comments
 (0)