Skip to content

Commit dc480f7

Browse files
jplattedavidpdrsn
andauthored
Re-integrate examples into the root workspace (#1466)
Co-authored-by: David Pedersen <[email protected]>
1 parent e7eda0e commit dc480f7

File tree

44 files changed

+60
-78
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+60
-78
lines changed

.github/workflows/CI.yml

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,9 @@ on:
1313
jobs:
1414
check:
1515
runs-on: ubuntu-latest
16-
strategy:
17-
matrix:
18-
pwd:
19-
- .
20-
- examples
2116
steps:
2217
- uses: actions/checkout@master
2318
- uses: arduino/setup-protoc@v1
24-
if: matrix.pwd == 'examples'
2519
with:
2620
repo-token: ${{ secrets.GITHUB_TOKEN }}
2721
- uses: dtolnay/rust-toolchain@stable
@@ -31,17 +25,16 @@ jobs:
3125
profile: minimal
3226
components: clippy, rustfmt
3327
- uses: Swatinem/rust-cache@v2
34-
with:
35-
key: ${{ matrix.pwd }}
36-
workspaces: ${{ matrix.pwd }}
3728
- name: Check
38-
working-directory: ${{ matrix.pwd }}
39-
run: |
40-
cargo clippy --all --all-targets --all-features
29+
uses: actions-rs/cargo@v1
30+
with:
31+
command: clippy
32+
args: --workspace --all-targets --all-features
4133
- name: rustfmt
42-
working-directory: ${{ matrix.pwd }}
43-
run: |
44-
cargo fmt --all -- --check
34+
uses: actions-rs/cargo@v1
35+
with:
36+
command: fmt
37+
args: -- --check
4538

4639
check-docs:
4740
runs-on: ubuntu-latest
@@ -62,6 +55,7 @@ jobs:
6255
runs-on: ubuntu-latest
6356
steps:
6457
- uses: actions/checkout@master
58+
- uses: arduino/setup-protoc@v1
6559
- uses: dtolnay/rust-toolchain@stable
6660
with:
6761
toolchain: stable
@@ -101,6 +95,7 @@ jobs:
10195
rust: [stable, beta]
10296
steps:
10397
- uses: actions/checkout@master
98+
- uses: arduino/setup-protoc@v1
10499
- uses: dtolnay/rust-toolchain@stable
105100
with:
106101
toolchain: ${{ matrix.rust }}
@@ -113,6 +108,7 @@ jobs:
113108
command: test
114109
args: --all --all-features --all-targets
115110

111+
# some examples doesn't support our MSRV so we only test axum itself on our MSRV
116112
test-nightly:
117113
needs: check
118114
runs-on: ubuntu-latest
@@ -269,11 +265,6 @@ jobs:
269265
270266
dependencies-are-sorted:
271267
runs-on: ubuntu-latest
272-
strategy:
273-
matrix:
274-
pwd:
275-
- .
276-
- examples
277268
steps:
278269
- uses: actions/checkout@master
279270
- uses: dtolnay/rust-toolchain@stable
@@ -282,16 +273,12 @@ jobs:
282273
override: true
283274
profile: minimal
284275
- uses: Swatinem/rust-cache@v2
285-
with:
286-
key: ${{ matrix.pwd }}
287-
workspaces: ${{ matrix.pwd }}
288276
- name: Install cargo-sort
289277
run: |
290278
cargo install cargo-sort
279+
# Work around cargo-sort not honoring workspace.exclude
291280
- name: Remove non-crate folder
292-
run: rm -rf async-graphql || true
293-
working-directory: ${{ matrix.pwd }}
281+
run: rm -rf examples/async-graphql
294282
- name: Check dependency tables
295-
working-directory: ${{ matrix.pwd }}
296283
run: |
297284
cargo sort --workspace --grouped --check

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/target
2-
/examples/target
3-
/examples/*/target
1+
target
42
Cargo.lock
53
.DS_Store

Cargo.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
[workspace]
2-
members = [
3-
"axum",
4-
"axum-core",
5-
"axum-extra",
6-
"axum-macros",
7-
]
2+
members = ["axum", "axum-*", "examples/*"]
3+
# Only check / build main crates by default (check all with `--workspace`)
4+
default-members = ["axum", "axum-*"]
5+
# Example has been deleted, but README.md remains
6+
exclude = ["examples/async-graphql"]
87
resolver = "2"

deny.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ skip-tree = [
2121
{ name = "base64" },
2222
# parking_lot pulls in old versions of windows-sys
2323
{ name = "windows-sys" },
24+
# old version pulled in by rustls via ring
25+
{ name = "spin" },
2426
]
2527

2628
[sources]

examples/Cargo.toml

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

examples/anyhow-error-response/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-anyhow-error-response
4+
//! cargo run -p example-anyhow-error-response
55
//! ```
66
77
use axum::{

examples/chat/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Run with
44
//!
55
//! ```not_rust
6-
//! cd examples && cargo run -p example-chat
6+
//! cargo run -p example-chat
77
//! ```
88
99
use axum::{

examples/consume-body-in-extractor-or-middleware/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-consume-body-in-extractor-or-middleware
4+
//! cargo run -p example-consume-body-in-extractor-or-middleware
55
//! ```
66
77
use axum::{

examples/cors/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-cors
4+
//! cargo run -p example-cors
55
//! ```
66
77
use axum::{

examples/customize-extractor-error/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ already existing extractors
1212
Run with
1313

1414
```sh
15-
cd examples && cargo run -p example-customize-extractor-error
15+
cargo run -p example-customize-extractor-error
1616
```

examples/customize-extractor-error/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-customize-extractor-error
4+
//! cargo run -p example-customize-extractor-error
55
//! ```
66
77
mod custom_extractor;

examples/customize-path-rejection/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-customize-path-rejection
4+
//! cargo run -p example-customize-path-rejection
55
//! ```
66
77
use axum::{

examples/error-handling-and-dependency-injection/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! Run with
55
//!
66
//! ```not_rust
7-
//! cd examples && cargo run -p example-error-handling-and-dependency-injection
7+
//! cargo run -p example-error-handling-and-dependency-injection
88
//! ```
99
1010
use axum::{

examples/form/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-form
4+
//! cargo run -p example-form
55
//! ```
66
77
use axum::{extract::Form, response::Html, routing::get, Router};

examples/global-404-handler/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-global-404-handler
4+
//! cargo run -p example-global-404-handler
55
//! ```
66
77
use axum::{

examples/graceful-shutdown/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-graceful-shutdown
4+
//! cargo run -p example-graceful-shutdown
55
//! kill or ctrl-c
66
//! ```
77

examples/handle-head-request/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-handle-head-request
4+
//! cargo run -p example-handle-head-request
55
//! ```
66
77
use axum::response::{IntoResponse, Response};

examples/hello-world/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-hello-world
4+
//! cargo run -p example-hello-world
55
//! ```
66
77
use axum::{response::Html, routing::get, Router};

examples/hyper-1-0/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-hyper-1-0
4+
//! cargo run -p example-hyper-1-0
55
//! ```
66
77
use axum::{routing::get, Router};

examples/key-value-store/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Run with:
44
//!
55
//! ```not_rust
6-
//! cd examples && cargo run -p example-key-value-store
6+
//! cargo run -p example-key-value-store
77
//! ```
88
99
use axum::{

examples/low-level-rustls/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-low-level-rustls
4+
//! cargo run -p example-low-level-rustls
55
//! ```
66
77
use axum::{extract::ConnectInfo, routing::get, Router};

examples/multipart-form/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-multipart-form
4+
//! cargo run -p example-multipart-form
55
//! ```
66
77
use axum::{

examples/parse-body-based-on-content-type/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Run with
44
//!
55
//! ```not_rust
6-
//! cd examples && cargo run -p example-parse-body-based-on-content-type
6+
//! cargo run -p example-parse-body-based-on-content-type
77
//! ```
88
99
use axum::{

examples/print-request-response/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-print-request-response
4+
//! cargo run -p example-print-request-response
55
//! ```
66
77
use axum::{

examples/prometheus-metrics/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! Run with
55
//!
66
//! ```not_rust
7-
//! cd examples && cargo run -p example-prometheus-metrics
7+
//! cargo run -p example-prometheus-metrics
88
//! ```
99
1010
use axum::{

examples/query-params-with-empty-strings/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-query-params-with-empty-strings
4+
//! cargo run -p example-query-params-with-empty-strings
55
//! ```
66
77
use axum::{extract::Query, routing::get, Router};

examples/readme/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-readme
4+
//! cargo run -p example-readme
55
//! ```
66
77
use axum::{

examples/rest-grpc-multiplex/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-rest-grpc-multiplex
4+
//! cargo run -p example-rest-grpc-multiplex
55
//! ```
66
77
use self::multiplex_service::MultiplexService;

examples/reverse-proxy/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! Run with
55
//!
66
//! ```not_rust
7-
//! cd examples && cargo run -p example-reverse-proxy
7+
//! cargo run -p example-reverse-proxy
88
//! ```
99
1010
use axum::{

examples/routes-and-handlers-close-together/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-routes-and-handlers-close-together
4+
//! cargo run -p example-routes-and-handlers-close-together
55
//! ```
66
77
use axum::{

examples/sessions/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-sessions
4+
//! cargo run -p example-sessions
55
//! ```
66
77
use async_session::{MemoryStore, Session, SessionStore as _};

examples/simple-router-wasm/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-simple-router-wasm
4+
//! cargo run -p example-simple-router-wasm
55
//! ```
66
//!
77
//! This example shows what using axum in a wasm context might look like. This example should

examples/sqlx-postgres/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Run with
44
//!
55
//! ```not_rust
6-
//! cd examples && cargo run -p example-sqlx-postgres
6+
//! cargo run -p example-sqlx-postgres
77
//! ```
88
//!
99
//! Test with curl:

examples/sse/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples && cargo run -p example-sse
4+
//! cargo run -p example-sse
55
//! ```
66
77
use axum::{

examples/static-file-server/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Run with
22
//!
33
//! ```not_rust
4-
//! cd examples/static-file-server && cargo run -p example-static-file-server
4+
//! cargo run -p example-static-file-server
55
//! ```
66
77
use axum::{

0 commit comments

Comments
 (0)