Merge pull request #1798 from DioxusLabs/jk/fix-miri-test-setup

Fix: move miri and playwright to the main CI so it gets run less
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2024-01-08 15:19:10 -08:00
commit 546868551a
17 files changed
+111 -237

No files matched your search

+88 -30
View File
@@ -31,22 +31,23 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
check:
if: github.event.pull_request.draft == false
name: Check
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- run: sudo apt-get update
- run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev
- uses: dtolnay/rust-toolchain@stable
- uses: mozilla-actions/sccache-action@v0.0.3
- uses: ilammy/setup-nasm@v1
- run: sudo apt-get update
- run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev
- uses: actions/checkout@v4
- run: cargo check --all --examples --tests
@@ -54,17 +55,12 @@ jobs:
if: github.event.pull_request.draft == false
name: Test Suite
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- run: sudo apt-get update
- run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
- uses: dtolnay/rust-toolchain@stable
- uses: mozilla-actions/sccache-action@v0.0.3
- uses: ilammy/setup-nasm@v1
- run: sudo apt-get update
- run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
- uses: davidB/rust-cargo-make@v1
- uses: browser-actions/setup-firefox@latest
- uses: jetli/wasm-pack-action@v0.4.0
@@ -75,11 +71,6 @@ jobs:
if: github.event.pull_request.draft == false
name: Rustfmt
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- uses: dtolnay/rust-toolchain@stable
- uses: mozilla-actions/sccache-action@v0.0.3
@@ -92,28 +83,95 @@ jobs:
if: github.event.pull_request.draft == false
name: Clippy
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- run: sudo apt-get update
- run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev
- uses: dtolnay/rust-toolchain@stable
- uses: mozilla-actions/sccache-action@v0.0.3
- uses: ilammy/setup-nasm@v1
- run: sudo apt-get update
- run: sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev
- run: rustup component add clippy
- uses: actions/checkout@v4
- run: cargo clippy --workspace --examples --tests -- -D warnings
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: mozilla-actions/sccache-action@v0.0.3
- 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:
if: github.event.pull_request.draft == false
name: Playwright Tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./playwright-tests
steps:
# Do our best to cache the toolchain and node install steps
- uses: actions/checkout@v4
- uses: ilammy/setup-nasm@v1
- uses: actions/setup-node@v4
with:
node-version: 16
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: x86_64-unknown-linux-gnu,wasm32-unknown-unknown
- uses: mozilla-actions/sccache-action@v0.0.3
- name: Install dependencies
run: npm ci
- name: Install Playwright
run: npm install -D @playwright/test
- name: Install Playwright Browsers
run: npx playwright install --with-deps
# Cache the CLI by using cargo run internally
# - name: Install Dioxus CLI
# uses: actions-rs/cargo@v1
# with:
# command: install
# args: --path packages/cli
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
matrix_test:
runs-on: ${{ matrix.platform.os }}
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
RUST_CARGO_COMMAND: ${{ matrix.platform.cross == true && 'cross' || 'cargo' }}
strategy:
matrix:
-133
View File
@@ -1,133 +0,0 @@
name: Miri Tests
on:
push:
# Run in PRs and for bors, but not on master.
branches:
- 'auto'
- 'try'
paths:
- packages/**
- examples/**
- src/**
- .github/**
- lib.rs
- Cargo.toml
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- 'master'
schedule:
- cron: '6 6 * * *' # At 6:06 UTC every day.
env:
CARGO_UNSTABLE_SPARSE_REGISTRY: 'true'
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: 1
# Change to specific Rust release to pin
rust_stable: stable
rust_nightly: nightly-2023-11-16
rust_clippy: 1.70.0
# When updating this, also update:
# - README.md
# - tokio/README.md
# - CONTRIBUTING.md
# - tokio/Cargo.toml
# - tokio-util/Cargo.toml
# - tokio-test/Cargo.toml
# - tokio-stream/Cargo.toml
# rust_min: 1.49.0
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ${{ matrix.os }}
env:
RUST_BACKTRACE: 1
HOST_TARGET: ${{ matrix.host_target }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
host_target: x86_64-unknown-linux-gnu
# - os: macos-latest
# host_target: x86_64-apple-darwin
# - os: windows-latest
# host_target: i686-pc-windows-msvc
# - os: windows-latest
# host_target: i686-pc-windows-msvc
# - os: windows-latest
# host_target: i686-pc-windows-msvc
# - os: windows-latest
# host_target: i686-pc-windows-msvc
steps:
- name: Set the tag GC interval to 1 on linux
if: runner.os == 'Linux'
run: echo "MIRIFLAGS=-Zmiri-tag-gc=1" >> $GITHUB_ENV
- 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
- 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
# working-directory: tokio
env:
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields
PROPTEST_CASES: 10
# Cache the global cargo directory, but NOT the local `target` directory which
# we cannot reuse anyway when the nightly changes (and it grows quite large
# over time).
# - name: Add cache for cargo
# id: cache
# uses: actions/cache@v3
# with:
# path: |
# # Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
# ~/.cargo/bin
# ~/.cargo/registry/index
# ~/.cargo/registry/cache
# ~/.cargo/git/db
# # contains package information of crates installed via `cargo install`.
# ~/.cargo/.crates.toml
# ~/.cargo/.crates2.json
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# restore-keys: ${{ runner.os }}-cargo
# - name: Install rustup-toolchain-install-master
# if: ${{ steps.cache.outputs.cache-hit != 'true' }}
# shell: bash
# run: |
# cargo install -f rustup-toolchain-install-master
# - name: Install "master" toolchain
# shell: bash
# run: |
# if [[ ${{ github.event_name }} == 'schedule' ]]; then
# echo "Building against latest rustc git version"
# git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1 > rust-version
# fi
# toolchain --host ${{ matrix.host_target }}
# - name: Show Rust version
# run: |
# rustup show
# rustc -Vv
# cargo -V
# - name: Test
# run: |
# MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-ignore-leaks" cargo +nightly miri test --package dioxus-core --test miri_stress -- --exact --nocapture
# MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-ignore-leaks" cargo +nightly miri test --package dioxus-native-core --test miri_native -- --exact --nocapture
-52
View File
@@ -1,52 +0,0 @@
name: Playwright Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
defaults:
run:
working-directory: ./playwright-tests
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
if: github.event.pull_request.draft == false
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
# Do our best to cache the toolchain and node install steps
- uses: actions/checkout@v4
- uses: ilammy/setup-nasm@v1
- uses: actions/setup-node@v4
with:
node-version: 16
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: x86_64-unknown-linux-gnu,wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- name: Install dependencies
run: npm ci
- name: Install Playwright
run: npm install -D @playwright/test
- name: Install Playwright Browsers
run: npx playwright install --with-deps
# Cache the CLI by using cargo run internally
# - name: Install Dioxus CLI
# uses: actions-rs/cargo@v1
# with:
# command: install
# args: --path packages/cli
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
+8 -3
View File
@@ -98,6 +98,12 @@ thiserror = "1.0.40"
prettyplease = { package = "prettier-please", version = "0.2", features = [
"verbatim",
] }
manganis-cli-support = { git = "https://github.com/DioxusLabs/collect-assets", rev = "94ea6f7", features = [
"webp",
"html",
] }
manganis = { git = "https://github.com/DioxusLabs/collect-assets", rev = "94ea6f7" }
# This is a "virtual package"
# It is not meant to be published, but is used so "cargo run --example XYZ" works properly
@@ -136,8 +142,7 @@ reqwest = { version = "0.11.9", features = ["json"] }
env_logger = "0.10.0"
simple_logger = "4.0.0"
thiserror = { workspace = true }
[dependencies]
manganis = { workspace = true }
tracing-subscriber = "0.3.17"
http-range = "0.1.5"
+1 -1
View File
@@ -10,7 +10,7 @@ fn app(cx: Scope) -> Element {
p {
"This should show an image:"
}
img { src: mg!(image("examples/assets/logo.png").format(ImageType::Avif)).to_string() }
img { src: manganis::mg!(image("examples/assets/logo.png").format(ImageType::Avif)).to_string() }
}
})
}
+1 -1
View File
@@ -18,7 +18,7 @@ fn main() {
);
}
const _STYLE: &str = mg!(file("./examples/assets/fileexplorer.css"));
const _STYLE: &str = manganis::mg!(file("./examples/assets/fileexplorer.css"));
fn app(cx: Scope) -> Element {
let files = use_ref(cx, Files::new);
+1
View File
@@ -13,6 +13,7 @@ publish = false
[dependencies]
dioxus = { path = "../../packages/dioxus" }
manganis = { workspace = true }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
dioxus-desktop = { path = "../../packages/desktop" }
+1 -1
View File
@@ -2,7 +2,7 @@
use dioxus::prelude::*;
const _STYLE: &str = mg!(file("./public/tailwind.css"));
const _STYLE: &str = manganis::mg!(file("./public/tailwind.css"));
fn main() {
#[cfg(not(target_arch = "wasm32"))]
+1 -1
View File
@@ -7,7 +7,7 @@ fn main() {
dioxus_desktop::launch(app);
}
const _STYLE: &str = mg!(file("./examples/assets/todomvc.css"));
const _STYLE: &str = manganis::mg!(file("./examples/assets/todomvc.css"));
#[derive(PartialEq, Eq, Clone, Copy)]
pub enum FilterState {
+2 -1
View File
@@ -76,7 +76,8 @@ toml_edit = "0.19.11"
tauri-bundler = { version = "=1.4.*", features = ["native-tls-vendored"] }
tauri-utils = "=1.5.*"
manganis-cli-support = { git = "https://github.com/DioxusLabs/collect-assets", features = ["webp", "html"] }
# todo: don't make this optional
manganis-cli-support = { workspace = true, features = ["webp", "html"] }
dioxus-autofmt = { workspace = true }
dioxus-check = { workspace = true }
+1
View File
@@ -136,6 +136,7 @@ impl Bundle {
}
// Add all assets from collect assets to the bundle
#[cfg(feature = "collect-assets")]
{
let config = manganis_cli_support::Config::current();
let location = config.assets_serve_location().to_string();
+1
View File
@@ -133,6 +133,7 @@ impl Runtime {
/// }
/// }
///
/// # #[allow(non_snake_case)]
/// fn Component(cx: Scope<ComponentProps>) -> Element {
/// cx.use_hook(|| RuntimeGuard::new(cx.props.runtime.clone()));
///
+2 -5
View File
@@ -53,10 +53,7 @@ tao = { version = "0.24.0", features = ["rwh_05"] }
[target.'cfg(any(target_os = "windows",target_os = "macos",target_os = "linux",target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))'.dependencies]
# This is only for debug mode, and it appears mobile does not support some packages this uses
manganis-cli-support = { git = "https://github.com/DioxusLabs/collect-assets", optional = true, features = [
"webp",
"html",
] }
manganis-cli-support = { workspace = true, optional = true, features = ["webp", "html"] }
rfd = "0.12"
global-hotkey = "0.4.1"
muda = "0.11.3"
@@ -76,7 +73,7 @@ fullscreen = ["wry/fullscreen"]
transparent = ["wry/transparent"]
devtools = ["wry/devtools"]
hot-reload = ["dioxus-hot-reload"]
asset-collect = ["manganis-cli-support"]
collect-assets = ["manganis-cli-support"]
gnu = []
[package.metadata.docs.rs]
-3
View File
@@ -16,7 +16,6 @@ dioxus-html = { workspace = true, optional = true }
dioxus-core-macro = { workspace = true, optional = true }
dioxus-hooks = { workspace = true, optional = true }
dioxus-rsx = { workspace = true, optional = true }
manganis = { git = "https://github.com/DioxusLabs/collect-assets" }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
dioxus-hot-reload = { workspace = true, optional = true }
@@ -37,8 +36,6 @@ criterion = "0.3.5"
thiserror = { workspace = true }
env_logger = "0.10.0"
tokio = { workspace = true, features = ["full"] }
# dioxus-edit-stream = { workspace = true }
[[bench]]
name = "jsframework"
-3
View File
@@ -22,9 +22,6 @@ pub use dioxus_rsx as rsx;
pub use dioxus_core_macro as core_macro;
pub mod prelude {
pub use manganis;
pub use manganis::mg;
#[cfg(feature = "hooks")]
pub use crate::hooks::*;
+2 -1
View File
@@ -69,7 +69,7 @@ web-sys = { version = "0.3.61", features = ["Window", "Document", "Element", "Ht
[target.'cfg(any(target_os = "windows",target_os = "macos",target_os = "linux",target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))'.dependencies]
# This is only for debug mode, and it appears mobile does not support some packages this uses
manganis-cli-support = { git = "https://github.com/DioxusLabs/collect-assets", features = ["webp", "html"] }
manganis-cli-support = { workspace = true, features = ["webp", "html"], optional = true }
[features]
default = ["hot-reload"]
@@ -83,3 +83,4 @@ salvo = ["dep:salvo", "ssr", "http-body-util"]
ssr = ["server_fn/ssr", "dioxus_server_macro/ssr", "tokio", "tokio-util", "tokio-stream", "dioxus-ssr", "tower", "hyper", "http", "dioxus-router?/ssr", "tower-layer", "anymap", "tracing-futures", "pin-project", "thiserror"]
default-tls = ["server_fn/default-tls"]
rustls = ["server_fn/rustls"]
collect-assets = ["manganis-cli-support"]
+2 -2
View File
@@ -1,4 +1,4 @@
use std::{any::Any, collections::HashMap};
use std::any::Any;
pub trait HasFileData: std::any::Any {
fn files(&self) -> Option<std::sync::Arc<dyn FileEngine>> {
@@ -10,7 +10,7 @@ pub trait HasFileData: std::any::Any {
/// A file engine that serializes files to bytes
#[derive(serde::Serialize, serde::Deserialize, Debug, PartialEq, Clone)]
pub struct SerializedFileEngine {
pub files: HashMap<String, Vec<u8>>,
pub files: std::collections::HashMap<String, Vec<u8>>,
}
#[cfg(feature = "serialize")]