Skip to content

Commit b5d9574

Browse files
authored
Merge pull request #96 from slinkydeveloper/actions_update
CI Improvements
2 parents e650033 + 099200c commit b5d9574

File tree

5 files changed

+72
-68
lines changed

5 files changed

+72
-68
lines changed

.github/workflows/pr.yml

Lines changed: 0 additions & 60 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Lints
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
lint:
10+
name: Rust
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+
name: "Cargo fmt"
22+
with:
23+
command: fmt
24+
args: --all -- --check
25+
- uses: actions-rs/clippy-check@v1
26+
name: "Cargo clippy"
27+
with:
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
args: --all-features

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

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
name: Master
1+
name: Rust Tests
22

33
on:
4+
pull_request:
5+
branches:
6+
- master
47
push:
58
branches:
69
- master
710

811
jobs:
912
build:
10-
name: Run tests on ${{ matrix.toolchain }} ${{ matrix.target }}
13+
name: ${{ matrix.toolchain }} / ${{ matrix.target }}
1114
runs-on: ubuntu-latest
1215
strategy:
16+
fail-fast: false
1317
matrix:
1418
toolchain:
1519
- stable
@@ -20,10 +24,14 @@ jobs:
2024
- wasm32-unknown-unknown
2125
steps:
2226
- uses: actions/checkout@v2
27+
28+
# Setup musl if needed
2329
- run: sudo apt-get update
2430
if: matrix.target == 'x86_64-unknown-linux-musl'
2531
- run: sudo apt-get install -y musl musl-dev musl-tools cmake
2632
if: matrix.target == 'x86_64-unknown-linux-musl'
33+
34+
# Caching stuff
2735
- name: Cache cargo registry
2836
uses: actions/cache@v1
2937
with:
@@ -47,12 +55,14 @@ jobs:
4755

4856
# If glibc, compile and test all
4957
- uses: actions-rs/cargo@v1
58+
name: "Build"
5059
if: matrix.target == 'x86_64-unknown-linux-gnu'
5160
with:
5261
command: build
5362
toolchain: ${{ matrix.toolchain }}
5463
args: --target ${{ matrix.target }} --workspace
5564
- uses: actions-rs/cargo@v1
65+
name: "Test"
5666
if: matrix.target == 'x86_64-unknown-linux-gnu'
5767
with:
5868
command: test
@@ -61,6 +71,7 @@ jobs:
6171

6272
# If musl, compile and test all
6373
- uses: actions-rs/cargo@v1
74+
name: "Build"
6475
if: matrix.target == 'x86_64-unknown-linux-musl'
6576
with:
6677
command: build
@@ -70,6 +81,7 @@ jobs:
7081
CC: musl-gcc
7182
CXX: g++
7283
- uses: actions-rs/cargo@v1
84+
name: "Test"
7385
if: matrix.target == 'x86_64-unknown-linux-musl'
7486
with:
7587
command: test
@@ -78,10 +90,37 @@ jobs:
7890
env:
7991
CC: musl-gcc
8092
CXX: g++
93+
8194
# If wasm, then we test only the main module and cloudevents-sdk-reqwest
8295
- uses: actions-rs/cargo@v1
96+
name: "Build"
8397
if: matrix.target == 'wasm32-unknown-unknown'
8498
with:
8599
command: build
86100
toolchain: ${{ matrix.toolchain }}
87101
args: --target wasm32-unknown-unknown --package cloudevents-sdk --package cloudevents-sdk-reqwest
102+
103+
# Build examples
104+
- uses: actions-rs/cargo@v1
105+
name: "Build reqwest-wasm-example"
106+
if: matrix.target == 'wasm32-unknown-unknown' && matrix.toolchain == 'stable'
107+
with:
108+
command: build
109+
toolchain: ${{ matrix.toolchain }}
110+
args: --target ${{ matrix.target }} --manifest-path ./example-projects/reqwest-wasm-example/Cargo.toml
111+
112+
- uses: actions-rs/cargo@v1
113+
name: "Build rdkafka-example"
114+
if: matrix.target == 'x86_64-unknown-linux-gnu' && matrix.toolchain == 'stable'
115+
with:
116+
command: build
117+
toolchain: ${{ matrix.toolchain }}
118+
args: --target ${{ matrix.target }} --manifest-path ./example-projects/rdkafka-example/Cargo.toml
119+
120+
- uses: actions-rs/cargo@v1
121+
name: "Build actix-web-example"
122+
if: matrix.target == 'x86_64-unknown-linux-gnu' && matrix.toolchain == 'stable'
123+
with:
124+
command: build
125+
toolchain: ${{ matrix.toolchain }}
126+
args: --target ${{ matrix.target }} --manifest-path ./example-projects/actix-web-example/Cargo.toml

cloudevents-sdk-rdkafka/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ categories = ["web-programming", "encoding"]
1616
bytes = "^0.5"
1717
cloudevents-sdk = { version = "0.2.0", path = ".." }
1818
lazy_static = "1.4.0"
19-
rdkafka = { version = "^0.24", default-features = false }
19+
rdkafka = { version = "^0.24", features = ["cmake-build"] }
2020

2121
[dev-dependencies]
2222
url = { version = "^2.1" }
2323
serde_json = "^1.0"
2424
chrono = { version = "^0.4", features = ["serde"] }
2525
futures = "0.3.5"
26-
rdkafka = { version = "^0.24" }
2726
version-sync = "^0.9"

example-projects/rdkafka-example/Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ serde_json = "^1.0"
1717
futures = "^0.3"
1818
tokio = { version = "^0.2", features = ["full"] }
1919
clap = "2.33.1"
20-
21-
[dependencies.rdkafka]
22-
version = "^0.24"
23-
features = ["cmake-build"]
20+
rdkafka = { version = "^0.24", features = ["cmake-build"] }
2421

2522
[workspace]

0 commit comments

Comments
 (0)