Skip to content

Commit 70cd9d9

Browse files
committed
add workflow to test rust clients
1 parent d8593ef commit 70cd9d9

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Samples Rust Clients
2+
3+
on:
4+
push:
5+
paths:
6+
- "samples/client/others/rust/**"
7+
- "samples/client/petstore/rust-server/**"
8+
pull_request:
9+
paths:
10+
- "samples/client/others/rust/**"
11+
- "samples/client/petstore/rust/**"
12+
13+
jobs:
14+
build:
15+
name: Build Rust
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
sample:
21+
# these folders contain sub-projects of rust clients, servers
22+
- samples/client/others/rust/
23+
- samples/client/petstore/rust/
24+
steps:
25+
- uses: actions/checkout@v5
26+
- uses: actions-rs/toolchain@v1
27+
with:
28+
toolchain: stable
29+
30+
- name: Rust cache
31+
uses: Swatinem/rust-cache@v2
32+
with:
33+
cache-targets: false # Don't cache workspace target directories as they don't exist
34+
cache-directories:
35+
${{ matrix.sample }}/target
36+
workspaces: |
37+
${{ matrix.sample }}/output/*
38+
39+
- name: Build
40+
working-directory: ${{ matrix.sample }}
41+
run: cargo build --all-targets --all-features
42+
- name: Tests
43+
working-directory: ${{ matrix.sample }}
44+
run: |
45+
set -e
46+
47+
# Iterate through each example and test various features
48+
for package in $(find . -maxdepth 1 -mindepth 1 -type d)
49+
do
50+
# Not all versions have a client example
51+
if test -f examples/client/main.rs; then
52+
cargo build --example client --features="client"
53+
fi
54+
55+
# Test the CLI works if present
56+
if test -f bin/cli.rs; then
57+
cargo build --bin ${package##*/} --features cli
58+
target/debug/${package##*/} --help
59+
fi
60+
cargo fmt
61+
cargo test
62+
cargo clippy
63+
cargo doc
64+
done

samples/client/others/rust/hyper/oneOf/.openapi-generator-ignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@
2121
#docs/*.md
2222
# Then explicitly reverse the ignore rule for a single file:
2323
#!docs/README.md
24+
#
25+
#
26+
#

0 commit comments

Comments
 (0)