From 31cde43d6d6c54295ff20065f304366cae5f464b Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Wed, 19 Jul 2023 13:18:45 -0700 Subject: [PATCH 1/8] Add caching to windows CI and test iOS and android --- .github/workflows/macos.yml | 42 ---------------- .github/workflows/main.yml | 73 +++++++++++++++++++++++++++ .github/workflows/windows.yml | 93 ----------------------------------- 3 files changed, 73 insertions(+), 135 deletions(-) delete mode 100644 .github/workflows/macos.yml delete mode 100644 .github/workflows/windows.yml diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml deleted file mode 100644 index 471bdd715..000000000 --- a/.github/workflows/macos.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: macOS tests - -on: - push: - branches: - - master - paths: - - packages/** - - examples/** - - src/** - - .github/** - - lib.rs - - Cargo.toml - - pull_request: - types: [opened, synchronize, reopened, ready_for_review] - branches: - - master - paths: - - packages/** - - examples/** - - src/** - - .github/** - - lib.rs - - Cargo.toml - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - test: - if: github.event.pull_request.draft == false - name: Test Suite - runs-on: macos-latest - steps: - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - - uses: actions/checkout@v3 - - run: | - cargo test --all --tests - cargo test --package fermi --release diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a95af8574..8db251254 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -83,6 +83,78 @@ jobs: - uses: actions/checkout@v3 - run: cargo clippy --workspace --examples --tests -- -D warnings + test: + runs-on: ${{ matrix.platform.os }} + strategy: + matrix: + platform: + - { + target: x86_64-pc-windows-msvc, + os: windows-latest, + toolchain: '1.65.0', + cross: false, + command: 'test --all --tests' + } + - { + target: x86_64-unknown-linux-gnu, + os: ubuntu-latest, + toolchain: '1.65.0', + cross: false, + command: 'test --all --tests' + } + - { + target: x86_64-apple-darwin, + os: macos-latest, + toolchain: '1.65.0', + cross: false, + command: 'test --all --tests' + } + - { + target: aarch64-apple-ios, + os: macos-latest, + toolchain: '1.65.0', + cross: false, + command: 'build --package dioxus-mobile' + } + - { + target: aarch64-linux-android, + os: ubuntu-latest, + toolchain: '1.65.0', + cross: true, + command: 'build --package dioxus-mobile' + } + + steps: + - uses: actions/checkout@v2 + + - name: install stable + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.platform.toolchain }} + target: ${{ matrix.platform.target }} + override: true + default: true + + - name: install Linux dependencies + if: contains(matrix.platform.target, 'unknown-linux') + run: | + sudo apt-get update + sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev + + - uses: Swatinem/rust-cache@v2 + with: + workspaces: core -> ../target + save-if: ${{ matrix.features.key == 'all' }} + + - name: test + uses: actions-rs/cargo@v1 + with: + use-cross: ${{ matrix.platform.cross }} + command: ${{ matrix.platform.command }} + args: --target ${{ matrix.platform.target }} + + + # Coverage is disabled until we can fix it # coverage: # name: Coverage @@ -103,3 +175,4 @@ jobs: # uses: codecov/codecov-action@v2 # with: # fail_ci_if_error: false + diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index f5792cf1e..000000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: windows - -on: - push: - branches: - - master - paths: - - packages/** - - examples/** - - src/** - - .github/** - - lib.rs - - Cargo.toml - - pull_request: - types: [opened, synchronize, reopened, ready_for_review] - branches: - - master - paths: - - packages/** - - examples/** - - src/** - - .github/** - - lib.rs - - Cargo.toml - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - test: - if: github.event.pull_request.draft == false - runs-on: windows-latest - name: (${{ matrix.target }}, ${{ matrix.cfg_release_channel }}) - env: - CFG_RELEASE_CHANNEL: ${{ matrix.cfg_release_channel }} - strategy: - # https://help.github.com/en/actions/getting-started-with-github-actions/about-github-actions#usage-limits - # There's a limit of 60 concurrent jobs across all repos in the rust-lang organization. - # In order to prevent overusing too much of that 60 limit, we throttle the - # number of rustfmt jobs that will run concurrently. - # max-parallel: - # fail-fast: false - matrix: - target: [x86_64-pc-windows-gnu, x86_64-pc-windows-msvc] - cfg_release_channel: [stable] - - steps: - # The Windows runners have autocrlf enabled by default - # which causes failures for some of rustfmt's line-ending sensitive tests - - name: disable git eol translation - run: git config --global core.autocrlf false - - # Run build - - name: Install Rustup using win.rustup.rs - run: | - # Disable the download progress bar which can cause perf issues - $ProgressPreference = "SilentlyContinue" - Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe - .\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --default-toolchain=none - del rustup-init.exe - rustup target add ${{ matrix.target }} - shell: powershell - - - name: Add mingw64 to path for x86_64-gnu - run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH - if: matrix.target == 'x86_64-pc-windows-gnu' && matrix.channel == 'nightly' - shell: bash - - # - name: checkout - # uses: actions/checkout@v3 - # with: - # path: C:/dioxus.git - # fetch-depth: 1 - - # we need to use the C drive as the working directory - - - name: Checkout - run: | - mkdir C:/dioxus.git - git clone https://github.com/dioxuslabs/dioxus.git C:/dioxus.git --depth 1 - - - name: test - working-directory: C:/dioxus.git - run: | - rustc -Vv - cargo -V - set RUST_BACKTRACE=1 - cargo build --all --tests --examples - cargo test --all --tests - cargo test --package fermi --release - shell: cmd From d9f0b149688085659e3ea02987c51197aead6be3 Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Wed, 19 Jul 2023 13:22:33 -0700 Subject: [PATCH 2/8] Rename CI field to enable wasm + linux --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8db251254..280cf8c73 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -83,7 +83,7 @@ jobs: - uses: actions/checkout@v3 - run: cargo clippy --workspace --examples --tests -- -D warnings - test: + matrix_test: runs-on: ${{ matrix.platform.os }} strategy: matrix: From 27a6babbd7625d5cbf2a886c05f9d8098ecbeefd Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Wed, 19 Jul 2023 13:26:34 -0700 Subject: [PATCH 3/8] Fix syntax error in yml --- .github/workflows/main.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 280cf8c73..e2b01f525 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -93,35 +93,40 @@ jobs: os: windows-latest, toolchain: '1.65.0', cross: false, - command: 'test --all --tests' + command: 'test', + args: '--all --tests' } - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, toolchain: '1.65.0', cross: false, - command: 'test --all --tests' + command: 'test', + args: '--all --tests' } - { target: x86_64-apple-darwin, os: macos-latest, toolchain: '1.65.0', cross: false, - command: 'test --all --tests' + command: 'test', + args: '--all --tests' } - { target: aarch64-apple-ios, os: macos-latest, toolchain: '1.65.0', cross: false, - command: 'build --package dioxus-mobile' + command: 'build', + args: '--package dioxus-mobile' } - { target: aarch64-linux-android, os: ubuntu-latest, toolchain: '1.65.0', cross: true, - command: 'build --package dioxus-mobile' + command: 'build', + args: '--package dioxus-mobile' } steps: @@ -151,7 +156,7 @@ jobs: with: use-cross: ${{ matrix.platform.cross }} command: ${{ matrix.platform.command }} - args: --target ${{ matrix.platform.target }} + args: --target ${{ matrix.platform.target }} ${{ matrix.platform.args }} From b1a4ac48d4c069e9f8d70af6f3dfe12b8023eea5 Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Wed, 19 Jul 2023 13:52:27 -0700 Subject: [PATCH 4/8] Move filedialog code into cfg-ed out folder --- packages/desktop/src/file_upload.rs | 75 +++++++++++++++-------------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/packages/desktop/src/file_upload.rs b/packages/desktop/src/file_upload.rs index 778c209ac..7b5f08fc3 100644 --- a/packages/desktop/src/file_upload.rs +++ b/packages/desktop/src/file_upload.rs @@ -14,42 +14,6 @@ pub(crate) struct FileDialogRequest { pub bubbles: bool, } -fn get_file_event_for_folder(request: &FileDialogRequest, dialog: rfd::FileDialog) -> Vec { - if request.multiple { - dialog.pick_folders().into_iter().flatten().collect() - } else { - dialog.pick_folder().into_iter().collect() - } -} - -fn get_file_event_for_file( - request: &FileDialogRequest, - mut dialog: rfd::FileDialog, -) -> Vec { - let filters: Vec<_> = request - .accept - .as_deref() - .unwrap_or_default() - .split(',') - .filter_map(|s| Filters::from_str(s).ok()) - .collect(); - - let file_extensions: Vec<_> = filters - .iter() - .flat_map(|f| f.as_extensions().into_iter()) - .collect(); - - dialog = dialog.add_filter("name", file_extensions.as_slice()); - - let files: Vec<_> = if request.multiple { - dialog.pick_files().into_iter().flatten().collect() - } else { - dialog.pick_file().into_iter().collect() - }; - - files -} - #[cfg(not(any( target_os = "windows", target_os = "macos", @@ -73,6 +37,45 @@ pub(crate) fn get_file_event(_request: &FileDialogRequest) -> Vec { target_os = "openbsd" ))] pub(crate) fn get_file_event(request: &FileDialogRequest) -> Vec { + fn get_file_event_for_folder( + request: &FileDialogRequest, + dialog: rfd::FileDialog, + ) -> Vec { + if request.multiple { + dialog.pick_folders().into_iter().flatten().collect() + } else { + dialog.pick_folder().into_iter().collect() + } + } + + fn get_file_event_for_file( + request: &FileDialogRequest, + mut dialog: rfd::FileDialog, + ) -> Vec { + let filters: Vec<_> = request + .accept + .as_deref() + .unwrap_or_default() + .split(',') + .filter_map(|s| Filters::from_str(s).ok()) + .collect(); + + let file_extensions: Vec<_> = filters + .iter() + .flat_map(|f| f.as_extensions().into_iter()) + .collect(); + + dialog = dialog.add_filter("name", file_extensions.as_slice()); + + let files: Vec<_> = if request.multiple { + dialog.pick_files().into_iter().flatten().collect() + } else { + dialog.pick_file().into_iter().collect() + }; + + files + } + let dialog = rfd::FileDialog::new(); if request.directory { From afa86877358594146e1aaf37b1033d90c14add1a Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Wed, 19 Jul 2023 16:22:19 -0700 Subject: [PATCH 5/8] Bump rust version to 1.69 --- .github/workflows/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e2b01f525..a710505db 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -91,7 +91,7 @@ jobs: - { target: x86_64-pc-windows-msvc, os: windows-latest, - toolchain: '1.65.0', + toolchain: '1.69.0', cross: false, command: 'test', args: '--all --tests' @@ -99,7 +99,7 @@ jobs: - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, - toolchain: '1.65.0', + toolchain: '1.69.0', cross: false, command: 'test', args: '--all --tests' @@ -107,7 +107,7 @@ jobs: - { target: x86_64-apple-darwin, os: macos-latest, - toolchain: '1.65.0', + toolchain: '1.69.0', cross: false, command: 'test', args: '--all --tests' @@ -115,7 +115,7 @@ jobs: - { target: aarch64-apple-ios, os: macos-latest, - toolchain: '1.65.0', + toolchain: '1.69.0', cross: false, command: 'build', args: '--package dioxus-mobile' @@ -123,7 +123,7 @@ jobs: - { target: aarch64-linux-android, os: ubuntu-latest, - toolchain: '1.65.0', + toolchain: '1.69.0', cross: true, command: 'build', args: '--package dioxus-mobile' From 9d942f1162d3fe6dfaaca92102ace9bb66c8ebd8 Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Wed, 19 Jul 2023 17:20:48 -0700 Subject: [PATCH 6/8] make msrv 1.66 --- packages/router-macro/src/segment.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/router-macro/src/segment.rs b/packages/router-macro/src/segment.rs index 2f7455a3f..62dea59a7 100644 --- a/packages/router-macro/src/segment.rs +++ b/packages/router-macro/src/segment.rs @@ -236,7 +236,7 @@ pub(crate) fn create_error_type( match segment { RouteSegment::Static(index) => { error_variants.push(quote! { #error_name(String) }); - display_match.push(quote! { Self::#error_name(found) => write!(f, "Static segment '{}' did not match instead found '{found}'", #index)? }); + display_match.push(quote! { Self::#error_name(found) => write!(f, "Static segment '{}' did not match instead found '{}'", #index, found)? }); } RouteSegment::Dynamic(ident, ty) => { let missing_error = segment.missing_error_name().unwrap(); From 462338e49ff7cf7bb7744a1470098777c5096cdc Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Wed, 19 Jul 2023 18:48:17 -0700 Subject: [PATCH 7/8] Remove linux from matrix since we already test it with the wasmpack test --- .github/workflows/main.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a710505db..5f1c761bb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -96,14 +96,6 @@ jobs: command: 'test', args: '--all --tests' } - - { - target: x86_64-unknown-linux-gnu, - os: ubuntu-latest, - toolchain: '1.69.0', - cross: false, - command: 'test', - args: '--all --tests' - } - { target: x86_64-apple-darwin, os: macos-latest, @@ -140,12 +132,6 @@ jobs: override: true default: true - - name: install Linux dependencies - if: contains(matrix.platform.target, 'unknown-linux') - run: | - sudo apt-get update - sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev - - uses: Swatinem/rust-cache@v2 with: workspaces: core -> ../target From 223d588c8589b4886a9e57cd0b1db080d3e5e2dd Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Wed, 19 Jul 2023 19:33:39 -0700 Subject: [PATCH 8/8] Bump msrv to support simple logger --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5f1c761bb..0abb1404c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -91,7 +91,7 @@ jobs: - { target: x86_64-pc-windows-msvc, os: windows-latest, - toolchain: '1.69.0', + toolchain: '1.70.0', cross: false, command: 'test', args: '--all --tests' @@ -99,7 +99,7 @@ jobs: - { target: x86_64-apple-darwin, os: macos-latest, - toolchain: '1.69.0', + toolchain: '1.70.0', cross: false, command: 'test', args: '--all --tests' @@ -107,7 +107,7 @@ jobs: - { target: aarch64-apple-ios, os: macos-latest, - toolchain: '1.69.0', + toolchain: '1.70.0', cross: false, command: 'build', args: '--package dioxus-mobile' @@ -115,7 +115,7 @@ jobs: - { target: aarch64-linux-android, os: ubuntu-latest, - toolchain: '1.69.0', + toolchain: '1.70.0', cross: true, command: 'build', args: '--package dioxus-mobile'