Skip to content

Commit

Permalink
Move examples to separate workspace (#978)
Browse files Browse the repository at this point in the history
* Move examples to separate workspace

* update commands to run examples

* remove debug
  • Loading branch information
davidpdrsn authored Apr 29, 2022
1 parent 6e18350 commit 1fe4558
Show file tree
Hide file tree
Showing 38 changed files with 51 additions and 45 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ on:

jobs:
check:
# Run `cargo check` first to ensure that the pushed code at least compiles.
runs-on: ubuntu-latest
strategy:
matrix:
pwd:
- .
- examples
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
Expand All @@ -23,15 +27,13 @@ jobs:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v1
- name: Check
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all --all-targets --all-features
working-directory: ${{ matrix.pwd }}
run: |
cargo clippy --all --all-targets --all-features
- name: rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
working-directory: ${{ matrix.pwd }}
run: |
cargo fmt --all -- --check
check-docs:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -106,6 +108,7 @@ jobs:
args: >
-p axum
-p axum-extra
-p axum-core
--all-features --all-targets
# the compiler errors are different on 1.54 which makes
# the trybuild tests in axum-macros fail, so just run the doc
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
/examples/target
Cargo.lock
.DS_Store
.DS_Store
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ members = [
"axum-core",
"axum-extra",
"axum-macros",
"examples/*",
]
3 changes: 3 additions & 0 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[workspace]
members = ["*"]
exclude = ["target"]
2 changes: 1 addition & 1 deletion examples/async-graphql/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Run with
//!
//! ```not_rust
//! cargo run -p example-async-graphql
//! cd examples && cargo run -p example-async-graphql
//! ```
mod starwars;
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
//! cargo run -p example-chat
//! cd examples && 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
//! cargo run -p example-consume-body-in-extractor-or-middleware
//! cd examples && 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
//! cargo run -p example-cors
//! cd examples && cargo run -p example-cors
//! ```
use axum::{
Expand Down
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
//! cargo run -p example-customize-extractor-error
//! cd examples && cargo run -p example-customize-extractor-error
//! ```
use axum::{
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
//! cargo run -p example-customize-path-rejection
//! cd examples && 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
//! cargo run -p example-error-handling-and-dependency-injection
//! cd examples && 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
//! cargo run -p example-form
//! cd examples && 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
//! cargo run -p example-global-404-handler
//! cd examples && 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
//! cargo run -p example-graceful-shutdown
//! cd examples && cargo run -p example-graceful-shutdown
//! kill or ctrl-c
//! ```
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
//! cargo run -p example-hello-world
//! cd examples && cargo run -p example-hello-world
//! ```
use axum::{response::Html, 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
//! cargo run -p example-key-value-store
//! cd examples && 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
//! cargo run -p example-low-level-rustls
//! cd examples && 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
//! cargo run -p example-multipart-form
//! cd examples && cargo run -p example-multipart-form
//! ```
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
//! cargo run -p example-print-request-response
//! cd examples && 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
//! cargo run -p example-prometheus-metrics
//! cd examples && 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
//! cargo run -p example-query-params-with-empty-strings
//! cd examples && 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
//! cargo run -p example-readme
//! cd examples && cargo run -p example-readme
//! ```
use axum::{
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
//! cargo run -p example-reverse-proxy
//! cd examples && 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
//! cargo run -p example-routes-and-handlers-close-together
//! cd examples && 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
//! cargo run -p example-sessions
//! cd examples && cargo run -p example-sessions
//! ```
use async_session::{MemoryStore, Session, SessionStore as _};
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
//! cargo run -p example-sqlx-postgres
//! cd examples && 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
//! cargo run -p example-sse
//! cd examples && 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
//! cargo run -p example-static-file-server
//! cd examples && cargo run -p example-static-file-server
//! ```
use axum::{http::StatusCode, routing::get_service, Router};
Expand Down
2 changes: 1 addition & 1 deletion examples/stream-to-file/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cargo run -p example-stream-to-file
//! cd examples && cargo run -p example-stream-to-file
//! ```
use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/templates/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cargo run -p example-templates
//! cd examples && cargo run -p example-templates
//! ```
use askama::Template;
Expand Down
2 changes: 1 addition & 1 deletion examples/tls-rustls/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cargo run -p example-tls-rustls
//! cd examples && cargo run -p example-tls-rustls
//! ```
use axum::{routing::get, Router};
Expand Down
2 changes: 1 addition & 1 deletion examples/todos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//! Run with
//!
//! ```not_rust
//! cargo run -p example-todos
//! cd examples && cargo run -p example-todos
//! ```
use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/tokio-postgres/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cargo run -p example-tokio-postgres
//! cd examples && cargo run -p example-tokio-postgres
//! ```
use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/tracing-aka-logging/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cargo run -p example-tracing-aka-logging
//! cd examples && cargo run -p example-tracing-aka-logging
//! ```
use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/unix-domain-socket/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cargo run -p example-unix-domain-socket
//! cd examples && cargo run -p example-unix-domain-socket
//! ```
#[cfg(unix)]
Expand Down
2 changes: 1 addition & 1 deletion examples/validator/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cargo run -p example-validator
//! cd examples && cargo run -p example-validator
//!
//! curl '127.0.0.1:3000?name='
//! -> Input validation error: [name: Can not be empty]
Expand Down
2 changes: 1 addition & 1 deletion examples/versioning/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Run with
//!
//! ```not_rust
//! cargo run -p example-versioning
//! cd examples && cargo run -p example-versioning
//! ```
use axum::{
Expand Down
2 changes: 1 addition & 1 deletion examples/websockets/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Run with
//!
//! ```not_rust
//! cargo run -p example-websockets
//! cd examples && cargo run -p example-websockets
//! ```
use axum::{
Expand Down

0 comments on commit 1fe4558

Please sign in to comment.