clean up workflow, fix some more axum stuff

This commit is contained in:
Jonathan Kelley committed 2024-02-15 19:03:46 -08:00
1 parent 3ee4fa8099
commit 2763adb2d3
2 files changed
+7 -47

No files matched your search

-39
View File
@@ -112,44 +112,6 @@ jobs:
save-if: ${{ github.ref == 'refs/heads/master' }} save-if: ${{ github.ref == 'refs/heads/master' }}
- run: cargo clippy --workspace --examples --tests --all-features --all-targets -- -D warnings - run: cargo clippy --workspace --examples --tests --all-features --all-targets -- -D warnings
# We removed most unsafe that we can, and using nightly doubles our cache size
# miri:
# if: github.event.pull_request.draft == false
# name: Miri
# runs-on: ubuntu-latest
# env:
# CARGO_UNSTABLE_SPARSE_REGISTRY: 'true'
# RUSTFLAGS: -Dwarnings
# RUST_BACKTRACE: 1
# MIRIFLAGS: -Zmiri-tag-gc=1
# # Change to specific Rust release to pin
# rust_stable: stable
# rust_nightly: nightly-2023-11-16
# rust_clippy: 1.70.0
# steps:
# - uses: actions/checkout@v4
# - uses: ilammy/setup-nasm@v1
# - name: Install Rust ${{ env.rust_nightly }}
# uses: dtolnay/rust-toolchain@master
# with:
# toolchain: ${{ env.rust_nightly }}
# components: miri
# - uses: Swatinem/rust-cache@v2
# with:
# cache-all-crates: "true"
# save-if: ${{ github.ref == 'refs/heads/master' }}
# - name: miri
# # Many of tests in tokio/tests and doctests use #[tokio::test] or
# # #[tokio::main] that calls epoll_create1 that Miri does not support.
# # run: cargo miri test --features full --lib --no-fail-fast
# run: |
# cargo miri test --package dioxus-core -- --exact --nocapture
# cargo miri test --package dioxus-native-core --test miri_native -- --exact --nocapture
# env:
# MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields
# PROPTEST_CASES: 10
playwright: playwright:
if: github.event.pull_request.draft == false if: github.event.pull_request.draft == false
name: Playwright Tests name: Playwright Tests
@@ -200,7 +162,6 @@ jobs:
path: playwright-report/ path: playwright-report/
retention-days: 30 retention-days: 30
matrix_test: matrix_test:
runs-on: ${{ matrix.platform.os }} runs-on: ${{ matrix.platform.os }}
if: github.event.pull_request.draft == false if: github.event.pull_request.draft == false
+7 -8
View File
@@ -20,7 +20,7 @@ use axum::{
Router, Router,
}; };
use axum_extra::TypedHeader; use axum_extra::TypedHeader;
use axum_server::tls_rustls::RustlsConfig; use axum_server::{service::SendService, tls_rustls::RustlsConfig};
use dioxus_cli_config::CrateConfig; use dioxus_cli_config::CrateConfig;
use dioxus_cli_config::WebHttpsConfig; use dioxus_cli_config::WebHttpsConfig;
@@ -316,7 +316,7 @@ async fn setup_router(
.service(ServeDir::new(config.out_dir())); .service(ServeDir::new(config.out_dir()));
// Setup websocket // Setup websocket
let mut router = Router::new().route("/_dioxus/ws", get(ws_handler)); let mut router = Router::new().route("/_dioxus/ws", get(ws_handler.into()));
// Setup proxy // Setup proxy
for proxy_config in config.dioxus_config.web.proxy { for proxy_config in config.dioxus_config.web.proxy {
@@ -324,7 +324,7 @@ async fn setup_router(
} }
// Route file service // Route file service
router = router.fallback(get_service(file_service).handle_error( router = router.fallback(get_service(file_service.into_service()).handle_error(
|error: std::io::Error| async move { |error: std::io::Error| async move {
( (
StatusCode::INTERNAL_SERVER_ERROR, StatusCode::INTERNAL_SERVER_ERROR,
@@ -336,7 +336,7 @@ async fn setup_router(
router = if let Some(base_path) = config.dioxus_config.web.app.base_path.clone() { router = if let Some(base_path) = config.dioxus_config.web.app.base_path.clone() {
let base_path = format!("/{}", base_path.trim_matches('/')); let base_path = format!("/{}", base_path.trim_matches('/'));
Router::new() Router::new()
.nest(&base_path, axum::routing::any_service(router)) .nest(&base_path, axum::routing::any_service(router.into()))
.fallback(get(move || { .fallback(get(move || {
let base_path = base_path.clone(); let base_path = base_path.clone();
async move { format!("Outside of the base path: {}", base_path) } async move { format!("Outside of the base path: {}", base_path) }
@@ -347,7 +347,7 @@ async fn setup_router(
// Setup routes // Setup routes
router = router router = router
.route("/_dioxus/hot_reload", get(hot_reload_handler)) .route("/_dioxus/hot_reload", get(hot_reload_handler.into()))
.layer(cors) .layer(cors)
.layer(Extension(ws_reload)); .layer(Extension(ws_reload));
@@ -389,9 +389,8 @@ async fn start_server(
.await? .await?
} }
None => { None => {
axum::Server::bind(&addr) let listener = tokio::net::TcpListener::bind(&addr).await?;
.serve(router.into_make_service()) axum::serve(listener, router.into_make_service()).await?
.await?
} }
} }