Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-integrate examples into the root workspace #1466

Merged
merged 8 commits into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 13 additions & 26 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,9 @@ on:
jobs:
check:
runs-on: ubuntu-latest
strategy:
matrix:
pwd:
- .
- examples
steps:
- uses: actions/checkout@master
- uses: arduino/setup-protoc@v1
if: matrix.pwd == 'examples'
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: dtolnay/rust-toolchain@stable
Expand All @@ -31,17 +25,16 @@ jobs:
profile: minimal
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.pwd }}
workspaces: ${{ matrix.pwd }}
- name: Check
working-directory: ${{ matrix.pwd }}
run: |
cargo clippy --all --all-targets --all-features
uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace --all-targets --all-features
- name: rustfmt
working-directory: ${{ matrix.pwd }}
run: |
cargo fmt --all -- --check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check

check-docs:
runs-on: ubuntu-latest
Expand All @@ -62,6 +55,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: arduino/setup-protoc@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
Expand Down Expand Up @@ -101,6 +95,7 @@ jobs:
rust: [stable, beta]
steps:
- uses: actions/checkout@master
- uses: arduino/setup-protoc@v1
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
Expand All @@ -113,6 +108,7 @@ jobs:
command: test
args: --all --all-features --all-targets

# some examples doesn't support our MSRV so we only test axum itself on our MSRV
test-nightly:
needs: check
runs-on: ubuntu-latest
Expand Down Expand Up @@ -269,11 +265,6 @@ jobs:

dependencies-are-sorted:
runs-on: ubuntu-latest
strategy:
matrix:
pwd:
- .
- examples
steps:
- uses: actions/checkout@master
- uses: dtolnay/rust-toolchain@stable
Expand All @@ -282,16 +273,12 @@ jobs:
override: true
profile: minimal
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.pwd }}
workspaces: ${{ matrix.pwd }}
- name: Install cargo-sort
run: |
cargo install cargo-sort
# Work around cargo-sort not honoring workspace.exclude
- name: Remove non-crate folder
run: rm -rf async-graphql || true
working-directory: ${{ matrix.pwd }}
run: rm -rf examples/async-graphql
- name: Check dependency tables
working-directory: ${{ matrix.pwd }}
run: |
cargo sort --workspace --grouped --check
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/target
/examples/target
/examples/*/target
target
Cargo.lock
.DS_Store
11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[workspace]
members = [
"axum",
"axum-core",
"axum-extra",
"axum-macros",
]
members = ["axum", "axum-*", "examples/*"]
# Only check / build main crates by default (check all with `--workspace`)
default-members = ["axum", "axum-*"]
# Example has been deleted, but README.md remains
exclude = ["examples/async-graphql"]
resolver = "2"
2 changes: 2 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ skip-tree = [
{ name = "base64" },
# parking_lot pulls in old versions of windows-sys
{ name = "windows-sys" },
# old version pulled in by rustls via ring
{ name = "spin" },
]

[sources]
Expand Down
4 changes: 0 additions & 4 deletions examples/Cargo.toml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/anyhow-error-response/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-anyhow-error-response
//! cargo run -p example-anyhow-error-response
//! ```

use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/chat/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-chat
//! cargo run -p example-chat
//! ```

use axum::{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-consume-body-in-extractor-or-middleware
//! cargo run -p example-consume-body-in-extractor-or-middleware
//! ```

use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/cors/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-cors
//! cargo run -p example-cors
//! ```

use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/customize-extractor-error/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ already existing extractors
Run with

```sh
cd examples && cargo run -p example-customize-extractor-error
cargo run -p example-customize-extractor-error
```
2 changes: 1 addition & 1 deletion examples/customize-extractor-error/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-customize-extractor-error
//! cargo run -p example-customize-extractor-error
//! ```

mod custom_extractor;
Expand Down
2 changes: 1 addition & 1 deletion examples/customize-path-rejection/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-customize-path-rejection
//! cargo run -p example-customize-path-rejection
//! ```

use axum::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-error-handling-and-dependency-injection
//! cargo run -p example-error-handling-and-dependency-injection
//! ```

use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/form/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-form
//! cargo run -p example-form
//! ```

use axum::{extract::Form, response::Html, routing::get, Router};
Expand Down
2 changes: 1 addition & 1 deletion examples/global-404-handler/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-global-404-handler
//! cargo run -p example-global-404-handler
//! ```

use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/graceful-shutdown/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-graceful-shutdown
//! cargo run -p example-graceful-shutdown
//! kill or ctrl-c
//! ```

Expand Down
2 changes: 1 addition & 1 deletion examples/handle-head-request/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-handle-head-request
//! cargo run -p example-handle-head-request
//! ```

use axum::response::{IntoResponse, Response};
Expand Down
2 changes: 1 addition & 1 deletion examples/hello-world/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-hello-world
//! cargo run -p example-hello-world
//! ```

use axum::{response::Html, routing::get, Router};
Expand Down
2 changes: 1 addition & 1 deletion examples/hyper-1-0/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-hyper-1-0
//! cargo run -p example-hyper-1-0
//! ```

use axum::{routing::get, Router};
Expand Down
2 changes: 1 addition & 1 deletion examples/key-value-store/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Run with:
//!
//! ```not_rust
//! cd examples && cargo run -p example-key-value-store
//! cargo run -p example-key-value-store
//! ```

use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/low-level-rustls/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-low-level-rustls
//! cargo run -p example-low-level-rustls
//! ```

use axum::{extract::ConnectInfo, routing::get, Router};
Expand Down
2 changes: 1 addition & 1 deletion examples/multipart-form/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-multipart-form
//! cargo run -p example-multipart-form
//! ```

use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/parse-body-based-on-content-type/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-parse-body-based-on-content-type
//! cargo run -p example-parse-body-based-on-content-type
//! ```

use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/print-request-response/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-print-request-response
//! cargo run -p example-print-request-response
//! ```

use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/prometheus-metrics/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-prometheus-metrics
//! cargo run -p example-prometheus-metrics
//! ```

use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/query-params-with-empty-strings/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-query-params-with-empty-strings
//! cargo run -p example-query-params-with-empty-strings
//! ```

use axum::{extract::Query, routing::get, Router};
Expand Down
2 changes: 1 addition & 1 deletion examples/readme/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-readme
//! cargo run -p example-readme
//! ```

use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/rest-grpc-multiplex/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-rest-grpc-multiplex
//! cargo run -p example-rest-grpc-multiplex
//! ```

use self::multiplex_service::MultiplexService;
Expand Down
2 changes: 1 addition & 1 deletion examples/reverse-proxy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-reverse-proxy
//! cargo run -p example-reverse-proxy
//! ```

use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/routes-and-handlers-close-together/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-routes-and-handlers-close-together
//! cargo run -p example-routes-and-handlers-close-together
//! ```

use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/sessions/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-sessions
//! cargo run -p example-sessions
//! ```

use async_session::{MemoryStore, Session, SessionStore as _};
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-router-wasm/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-simple-router-wasm
//! cargo run -p example-simple-router-wasm
//! ```
//!
//! This example shows what using axum in a wasm context might look like. This example should
Expand Down
2 changes: 1 addition & 1 deletion examples/sqlx-postgres/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-sqlx-postgres
//! cargo run -p example-sqlx-postgres
//! ```
//!
//! Test with curl:
Expand Down
2 changes: 1 addition & 1 deletion examples/sse/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples && cargo run -p example-sse
//! cargo run -p example-sse
//! ```

use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/static-file-server/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cd examples/static-file-server && cargo run -p example-static-file-server
//! cargo run -p example-static-file-server
//! ```

use axum::{
Expand Down
Loading