Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): Fix bench job #8045

Merged
merged 5 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ on:
- dev
- 1.x
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/bench.yml'

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 }}
Expand All @@ -27,7 +30,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 }}

Expand All @@ -43,7 +46,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
Expand All @@ -52,9 +55,12 @@ jobs:
run: |
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
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

- uses: Swatinem/rust-cache@v2
Expand Down
6 changes: 3 additions & 3 deletions tooling/bench/src/build_benchmark_jsons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -52,15 +52,15 @@ 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));

utils::write_json(
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));
}
2 changes: 1 addition & 1 deletion tooling/bench/src/run_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tooling/bench/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}

Expand Down
2 changes: 1 addition & 1 deletion tooling/bench/tests/cpu_intensive/public/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <code>${message.data.count}</code> prime numbers in <code>${message.data.time}ms</code>`
Expand Down
11 changes: 8 additions & 3 deletions tooling/bench/tests/files_transfer/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ <h1>Welcome to Tauri!</h1>

<script>
window.addEventListener('DOMContentLoaded', (event) => {
window.__TAURI__.invoke('read_file')
window.__TAURI__.primitives
.invoke('read_file')
.then((_data) => {
// success
window.__TAURI__.invoke('app_should_close', { exitCode: 0 })
window.__TAURI__.primitives.invoke('app_should_close', {
exitCode: 0
})
})
.catch((_error) => {
// error
window.__TAURI__.invoke('app_should_close', { exitCode: 1 })
window.__TAURI__.primitives.invoke('app_should_close', {
exitCode: 1
})
})
})
</script>
Expand Down
2 changes: 1 addition & 1 deletion tooling/bench/tests/helloworld/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h1>Welcome to Tauri!</h1>

<script>
window.addEventListener('DOMContentLoaded', (event) =>
window.__TAURI__.invoke('app_loaded_successfully')
window.__TAURI__.primitives.invoke('app_loaded_successfully')
)
</script>
</body>
Expand Down
Loading