diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 42ee292..61351ec 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -263,3 +263,36 @@ jobs: - name: Run cargo check with every combination of features run: cargo hack check --feature-powerset --exclude-features db --no-dev-deps + + miri: + if: github.event_name == 'push' || github.event_name == 'schedule' || + github.event.pull_request.head.repo.full_name != github.repository + + name: Miri test + runs-on: ubuntu-latest + needs: ["build"] + steps: + - name: Checkout source + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly + components: miri + + - name: Install cargo-nextest + uses: taiki-e/install-action@v2 + with: + tool: nextest + + - name: Cache Cargo registry + uses: Swatinem/rust-cache@v2 + + - name: Miri setup + run: cargo miri setup + + - name: Miri test + run: cargo miri nextest run --no-fail-fast --all-features + env: + MIRIFLAGS: -Zmiri-disable-isolation diff --git a/flareon-cli/tests/migration_generator.rs b/flareon-cli/tests/migration_generator.rs index 00610ae..fadbc33 100644 --- a/flareon-cli/tests/migration_generator.rs +++ b/flareon-cli/tests/migration_generator.rs @@ -7,6 +7,7 @@ use flareon_cli::migration_generator::{ /// Test that the migration generator can generate a create model migration for /// a given model which compiles successfully. #[test] +#[cfg_attr(miri, ignore)] // unsupported operation: extern static `pidfd_spawnp` is not supported by Miri fn create_model_compile_test() { let mut generator = MigrationGenerator::new( PathBuf::from("Cargo.toml"), diff --git a/flareon-macros/src/dbtest.rs b/flareon-macros/src/dbtest.rs index d5452fa..679354a 100644 --- a/flareon-macros/src/dbtest.rs +++ b/flareon-macros/src/dbtest.rs @@ -17,6 +17,7 @@ pub(super) fn fn_to_dbtest(test_function_decl: ItemFn) -> syn::Result flareon::Result { } #[tokio::test] +#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `sqlite3_open_v2` async fn flareon_project_router_sub_path() { struct App1; impl FlareonApp for App1 { diff --git a/flareon/tests/router.rs b/flareon/tests/router.rs index f7bfc15..18e48ba 100644 --- a/flareon/tests/router.rs +++ b/flareon/tests/router.rs @@ -19,6 +19,7 @@ async fn parameterized(request: Request) -> flareon::Result { } #[tokio::test] +#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `sqlite3_open_v2` async fn test_index() { let mut client = Client::new(project().await); @@ -31,6 +32,7 @@ async fn test_index() { } #[tokio::test] +#[cfg_attr(miri, ignore)] // unsupported operation: can't call foreign function `sqlite3_open_v2` async fn path_params() { let mut client = Client::new(project().await);