Add CI step to test packages with debug assertions off (#2507)

* test packages in release mode

* run release tests in a separate job

* fix release generation box tests
This commit is contained in:
Evan Almloff 2024-06-12 22:07:52 +02:00 committed by GitHub
parent 2f387604a8
commit 487570d897
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 35 additions and 3 deletions

View file

@ -79,6 +79,30 @@ jobs:
swap-storage: false
- run: cargo make tests
release-test:
if: github.event.pull_request.draft == false
name: Test Suite with Optimizations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: davidB/rust-cargo-make@v1
- uses: browser-actions/setup-firefox@latest
- uses: jetli/wasm-pack-action@v0.4.0
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
with: # speed things up a bit
large-packages: false
docker-images: false
swap-storage: false
- run: cargo test --profile release-unoptimized --lib --bins --tests --examples --workspace --exclude dioxus-desktop --exclude dioxus-mobile
fmt:
if: github.event.pull_request.draft == false
name: Rustfmt

View file

@ -135,6 +135,10 @@ opt-level = 1
[profile.cli-dev.package."*"]
opt-level = 3
# Disable debug assertions to check the released path of core and other packages, but build without optimizations to keep build times quick
[profile.release-unoptimized]
inherits = "dev"
debug-assertions = false
# This is a "virtual package"
# It is not meant to be published, but is used so "cargo run --example XYZ" works properly

View file

@ -18,7 +18,6 @@ use std::{
sync::Arc,
};
use tao::{
dpi::PhysicalSize,
event::Event,
event_loop::{ControlFlow, EventLoop, EventLoopBuilder, EventLoopProxy, EventLoopWindowTarget},
window::WindowId,
@ -481,7 +480,7 @@ impl App {
window.set_outer_position(tao::dpi::PhysicalPosition::new(
position.0, position.1,
));
window.set_inner_size(PhysicalSize::new(size.0, size.1));
window.set_inner_size(tao::dpi::PhysicalSize::new(size.0, size.1));
}
}
}

View file

@ -70,14 +70,19 @@ fn write_while_writing_error() {
let owner = UnsyncStorage::owner();
let value = owner.insert(1);
#[allow(unused)]
let (write, location) = write_at_location(value);
let write_result = value.try_write();
assert!(write_result.is_err());
#[cfg(debug_assertions)]
assert_eq!(
value.try_write().err(),
write_result.err(),
Some(BorrowMutError::AlreadyBorrowedMut(
AlreadyBorrowedMutError::new(location)
))
);
drop(write);
}