From 1bcbfbf6066cf36c3a0dee507c01219b77c5b135 Mon Sep 17 00:00:00 2001 From: Olivier Lemasle Date: Wed, 18 Oct 2023 15:30:27 +0200 Subject: [PATCH 1/5] fix(ci): Fix bench job --- .github/workflows/bench.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 213ac808178e..2b7c5df0261e 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -27,7 +27,7 @@ jobs: matrix: rust: [nightly] platform: - - { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04 } + - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest } runs-on: ${{ matrix.platform.os }} @@ -43,7 +43,7 @@ jobs: target: ${{ matrix.platform.target }} - name: setup python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: '3.10' architecture: x64 @@ -53,8 +53,8 @@ jobs: python -m pip install --upgrade pip sudo apt-get update sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev xvfb - wget https://github.com/sharkdp/hyperfine/releases/download/v1.11.0/hyperfine_1.11.0_amd64.deb - sudo dpkg -i hyperfine_1.11.0_amd64.deb + wget https://github.com/sharkdp/hyperfine/releases/download/v1.18.0/hyperfine_1.18.0_amd64.deb + sudo dpkg -i hyperfine_1.18.0_amd64.deb pip install memory_profiler - uses: Swatinem/rust-cache@v2 From 553552febc1e3aa64f912ea2c7e1ca4e2a5c6364 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Thu, 19 Oct 2023 21:01:52 -0300 Subject: [PATCH 2/5] run bench on change --- .github/workflows/bench.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 2b7c5df0261e..69625913474a 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -10,6 +10,9 @@ on: - dev - 1.x workflow_dispatch: + pull_request: + paths: + - '.github/workflows/bench.yml' env: RUST_BACKTRACE: 1 From 3a58e5d57fa1c3245141b4ea78f79ffe9c419b32 Mon Sep 17 00:00:00 2001 From: Olivier Lemasle Date: Sat, 21 Oct 2023 18:14:13 +0200 Subject: [PATCH 3/5] Fix benchmarks: update to new Tauri primitives API --- tooling/bench/tests/cpu_intensive/public/site.js | 2 +- tooling/bench/tests/files_transfer/public/index.html | 11 ++++++++--- tooling/bench/tests/helloworld/public/index.html | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tooling/bench/tests/cpu_intensive/public/site.js b/tooling/bench/tests/cpu_intensive/public/site.js index 412feadd1feb..7bbd2f339041 100644 --- a/tooling/bench/tests/cpu_intensive/public/site.js +++ b/tooling/bench/tests/cpu_intensive/public/site.js @@ -21,7 +21,7 @@ const onMessage = (message) => { if (message.data.status === 'done') { // tell tauri that we are done - window.__TAURI__.invoke('app_completed_successfully') + window.__TAURI__.primitives.invoke('app_completed_successfully') } status.innerHTML = `${prefix} Found ${message.data.count} prime numbers in ${message.data.time}ms` diff --git a/tooling/bench/tests/files_transfer/public/index.html b/tooling/bench/tests/files_transfer/public/index.html index 7435e92c4a44..ff267f8c516b 100644 --- a/tooling/bench/tests/files_transfer/public/index.html +++ b/tooling/bench/tests/files_transfer/public/index.html @@ -10,14 +10,19 @@

Welcome to Tauri!

diff --git a/tooling/bench/tests/helloworld/public/index.html b/tooling/bench/tests/helloworld/public/index.html index cea1b7a23ece..a304244ade52 100644 --- a/tooling/bench/tests/helloworld/public/index.html +++ b/tooling/bench/tests/helloworld/public/index.html @@ -10,7 +10,7 @@

Welcome to Tauri!

From 027392aebf5c6e2f0d56d15dffb9601e9e6d5449 Mon Sep 17 00:00:00 2001 From: Olivier Lemasle Date: Sat, 21 Oct 2023 18:16:09 +0200 Subject: [PATCH 4/5] Benchmarks improvements: clippy + GH action --- .github/workflows/bench.yml | 4 ++-- tooling/bench/src/build_benchmark_jsons.rs | 6 +++--- tooling/bench/src/run_benchmark.rs | 2 +- tooling/bench/src/utils.rs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 69625913474a..40ee75d72327 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -17,7 +17,7 @@ on: env: RUST_BACKTRACE: 1 CARGO_PROFILE_DEV_DEBUG: 0 # This would add unnecessary bloat to the target folder, decreasing cache efficiency. - LC_ALL: en_US.UTF-8 # This prevents strace from changing it's number format to use commas. + LC_ALL: en_US.UTF-8 # This prevents strace from changing its number format to use commas. concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -55,7 +55,7 @@ jobs: run: | python -m pip install --upgrade pip sudo apt-get update - sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev xvfb + sudo apt-get install -y --no-install-recommends libwebkit2gtk-4.1-dev libayatana-appindicator3-dev xvfb wget https://github.com/sharkdp/hyperfine/releases/download/v1.18.0/hyperfine_1.18.0_amd64.deb sudo dpkg -i hyperfine_1.18.0_amd64.deb pip install memory_profiler diff --git a/tooling/bench/src/build_benchmark_jsons.rs b/tooling/bench/src/build_benchmark_jsons.rs index a64fa6d39b27..73246b7d51d9 100644 --- a/tooling/bench/src/build_benchmark_jsons.rs +++ b/tooling/bench/src/build_benchmark_jsons.rs @@ -26,7 +26,7 @@ fn main() { // current data let current_data_buffer = BufReader::new( - File::open(&utils::target_dir().join("bench.json")).expect("Unable to read current data file"), + File::open(utils::target_dir().join("bench.json")).expect("Unable to read current data file"), ); let current_data: utils::BenchResult = serde_json::from_reader(current_data_buffer).expect("Unable to read current data buffer"); @@ -52,7 +52,7 @@ fn main() { tauri_data .to_str() .expect("Something wrong with tauri_data"), - &serde_json::to_value(&all_data).expect("Unable to build final json (all)"), + &serde_json::to_value(all_data).expect("Unable to build final json (all)"), ) .unwrap_or_else(|_| panic!("Unable to write {:?}", tauri_data)); @@ -60,7 +60,7 @@ fn main() { tauri_recent .to_str() .expect("Something wrong with tauri_recent"), - &serde_json::to_value(&recent).expect("Unable to build final json (recent)"), + &serde_json::to_value(recent).expect("Unable to build final json (recent)"), ) .unwrap_or_else(|_| panic!("Unable to write {:?}", tauri_recent)); } diff --git a/tooling/bench/src/run_benchmark.rs b/tooling/bench/src/run_benchmark.rs index 59c9788aa532..27b24c638a69 100644 --- a/tooling/bench/src/run_benchmark.rs +++ b/tooling/bench/src/run_benchmark.rs @@ -276,7 +276,7 @@ fn main() -> Result<()> { let target_dir = utils::target_dir(); - env::set_current_dir(&utils::bench_root_path())?; + env::set_current_dir(utils::bench_root_path())?; let format = time::format_description::parse("[year]-[month]-[day]T[hour]:[minute]:[second]Z").unwrap(); diff --git a/tooling/bench/src/utils.rs b/tooling/bench/src/utils.rs index d8db7e926d82..6ba088becf4a 100644 --- a/tooling/bench/src/utils.rs +++ b/tooling/bench/src/utils.rs @@ -64,7 +64,7 @@ pub fn bench_root_path() -> PathBuf { pub fn home_path() -> PathBuf { #[cfg(any(target_os = "macos", target_os = "linux"))] return PathBuf::from(env!("HOME")); - #[cfg(any(target_os = "windows"))] + #[cfg(target_os = "windows")] return PathBuf::from(env!("HOMEPATH")); } From f798933e50bca4408a1c93d3d246648b3e093bc5 Mon Sep 17 00:00:00 2001 From: Olivier Lemasle Date: Sat, 21 Oct 2023 19:09:03 +0200 Subject: [PATCH 5/5] ci: bench: add at-spi2-core --- .github/workflows/bench.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 40ee75d72327..9e62ee04cf13 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -55,7 +55,10 @@ jobs: run: | python -m pip install --upgrade pip sudo apt-get update - sudo apt-get install -y --no-install-recommends libwebkit2gtk-4.1-dev libayatana-appindicator3-dev xvfb + sudo apt-get install -y --no-install-recommends \ + libwebkit2gtk-4.1-dev libayatana-appindicator3-dev \ + xvfb \ + at-spi2-core wget https://github.com/sharkdp/hyperfine/releases/download/v1.18.0/hyperfine_1.18.0_amd64.deb sudo dpkg -i hyperfine_1.18.0_amd64.deb pip install memory_profiler