Commit Graph

138 Commits

Author SHA1 Message Date
Emil Ernerfeldt 5453cceded
Use official cargo machete action (#7470) 2025-08-21 15:42:10 +02:00
Emil Ernerfeldt 531ead5ad1
Update MSRV to 1.86 (#7469) 2025-08-21 15:38:41 +02:00
Lucas Meurer 2c6611d0c6
Enable wgpu default features in eframe / egui_wgpu default features (#7344) 2025-08-05 21:21:00 +02:00
Emil Ernerfeldt 962c8e26a8
Update MSRV to 1.85 (#7279) 2025-06-30 13:43:27 +02:00
Piotr Podusowski 12cd35f48c
Disallow `accesskit` on Android NativeActivity, making `hello_android` working again (#6855)
Follow up for https://github.com/emilk/egui/pull/6766

I wasn't sure if `compile_error` is appropriate. It felt right.
2025-05-18 13:17:28 +02:00
Emil Ernerfeldt d0876a1a60
Rename `master` branch to `main` (#7034)
For consistency with other repositories, i.e. so I can write `git
checkout main` without worrying which repo I'm browsing.
2025-05-08 09:15:42 +02:00
Emil Ernerfeldt ba70106399 Fix enforce_branch_name.yml 2025-05-06 10:25:02 +02:00
Emil Ernerfeldt f3611e3e5a
Enforce that PRs are not opened from the 'master' branch of a fork (#6899)
## What
Fail all PRs that are opened from the master/main branch of the fork.

## Why
PR:s opened from the `master` branch cannot be collaborated on. That is,
we maintainers cannot push our own commits to it (e.g. to fix smaller
problems with it before merging).

## How
Untested code straight from Claude 3.7 😅
2025-04-30 14:10:59 +02:00
TÖRÖK Attila fdb9aa282a
Raise MSRV to 1.84 (#6848)
Prerequisite of https://github.com/emilk/egui/pull/6744.
See: https://github.com/gfx-rs/wgpu/pull/7218,
https://github.com/gfx-rs/wgpu/pull/7425

Please be aware that Rust 1.84 enables some (more) WASM extensions by
default, and ships with an `std` built with them enabled:
https://blog.rust-lang.org/2024/09/24/webassembly-targets-change-in-default-target-features/
According to `rustc +1.84 --print=cfg --target wasm32-unknown-unknown`,
these are: `multivalue`, `mutable-globals`, `reference-types`, and
`sign-ext`.
(c.f. `rustc +1.84 --print=cfg --target wasm32-unknown-unknown -C
target-cpu=mvp` enabling none.)
For reference: https://webassembly.org/features/

----

If support is desired for ancient/esoteric browsers that don't have
these implemented, there are two ways to get around this:
- Target `wasm32v1-none` instead, but that's a `no-std` target, and I
suppose a lot of dependencies don't work that way (e.g.
https://github.com/gfx-rs/wgpu/issues/6826)
- Using the `-Ctarget-cpu=mvp` and `-Zbuild-std=panic_abort,std` flags,
and the `RUSTC_BOOTSTRAP=1` escape hatch to allow using the latter with
non-`nightly` toolchains - until
https://github.com/rust-lang/wg-cargo-std-aware is stabilized. (For
reference:
https://github.com/ruffle-rs/ruffle/pull/18528/files#diff-fb2896d189d77b35ace9a079c1ba9b55777d16e0f11ce79f776475a451b1825a)

I don't think either of these is particularly advantageous, so I suggest
just accepting that browsers will have to have some extensions
implemented to run `egui`.
2025-04-24 17:00:29 +02:00
TÖRÖK Attila 3dd8d34257
CI: Install wasm-opt 123 from the GitHub release of Binaryen (#6849)
* Prerequisite of https://github.com/emilk/egui/pull/6848
2025-04-24 15:39:01 +02:00
Lucas Meurer d78fc39386
Use lychee link checker instead of linkinator (#5868)
Seems like linkinator doesn't find any files:
https://github.com/emilk/egui/pull/5853#issuecomment-2765526298

This will check all links in .md files (except CHANGELOG.md) and in toml
files
2025-04-03 09:26:49 +02:00
lucasmerlin 26288d7dd7
Fix preview build failing (#5756)
The preview build randomly started failing:

https://github.com/emilk/egui/actions/runs/13633368357/job/38106240555?pr=5755
2025-03-03 17:08:54 +01:00
lucasmerlin 40bf21728d
Move gifs to git lfs (#5706)
Since we moved pngs to lfs I think we should also move the gifs there.

* [x] I have followed the instructions in the PR template
2025-03-03 15:51:43 +01:00
Nicolas 0521caed2e
Fix Cargo-Machete Workflow (#5745)
As cargo machete now uses rust edition2024 we cannot use the older rust
version - we need to install the newest on the runner

* [ ] I have followed the instructions in the PR template

---------

Co-authored-by: lucasmerlin <lucasmeurer96@gmail.com>
2025-02-27 15:24:10 +01:00
lucasmerlin b8051cc301
Add `SnapshotResults` struct to egui_kittest (#5672)
I got annoyed by all the slightly different variations of "collect
snapshot results and unwrap them at the end of test" I've written, so I
added a struct to make this nice and simple.

One controversial thing: It panics when dropped. I wanted to ensure
people cannot forget to unwrap the results at the end, and this was the
best thing I could come up with. I don't think this is possible via
clippy lint or something like that.

* [x] I have followed the instructions in the PR template
2025-02-04 14:01:32 +01:00
Emil Ernerfeldt 7d87acb5fa Remove dead code from CI 2025-01-29 08:43:18 +01:00
Emil Ernerfeldt 304c6518e3
Update cargo-deny-action to v2 (#5632) 2025-01-23 11:07:51 +01:00
Emil Ernerfeldt cf965aaa30 Update awalsh128/cache-apt-pkgs-action to 1.4.3 to fix CI 2025-01-16 21:13:02 +01:00
TÖRÖK Attila a5d7cf5bd7
Upgrade to wgpu 24 (#5610) 2025-01-16 17:00:29 +01:00
lucasmerlin 86ea3f8a5c
Fix cargo test --all-features breaking rendering due to unity vertexes (#5542)
* Closes #5297 
* [x] I have followed the instructions in the PR template

It's not great but I wasn't able to come up with a better solution.
2024-12-30 12:39:17 +01:00
Emil Ernerfeldt f0ec2f05c4
Fix broken images on egui.rs (move from git lfs to normal git) (#5480)
The images in the widget gallery on egui.rs are broken:

![image](https://github.com/user-attachments/assets/305e1041-e3e3-472d-9a52-1b90e8da053d)

~Not sure why yet, and I fail to reproduce locally.~
It's because they are on git lfs.
2024-12-16 14:16:54 +01:00
lucasmerlin 36a70e12c3
Fix pr preview vulnerability (#5461)
* Closes #5458
* [x] I have followed the instructions in the PR template
2024-12-11 16:55:57 +01:00
Emil Ernerfeldt 53a926a428
Update MSRV to 1.80 (#5457)
Because some dependencies now require it, see:
* https://github.com/emilk/egui/pull/5456
2024-12-10 16:09:03 +01:00
Emil Ernerfeldt 328422dc62
Update MSRV to Rust 1.79 (#5421)
Mostly to fix `cargo-machete` CI
2024-12-01 18:58:35 +01:00
lucasmerlin 7e3275ca5c
Fix cargo machete (#5410)
* [x] I have followed the instructions in the PR template

cargo machete depends on cargo-platform which seems to bumped it's msrv.
Installing via --locked should fix this for now. I think it's fine to do
this manually instead of using the cargo action since it's so simple and
the action we used basically did the same (without --locked)
2024-12-01 18:57:41 +01:00
lucasmerlin 793cb92557
Add egui_kittest label to workflow and changelog script (#5323)
* [X] I have followed the instructions in the PR template
2024-11-01 13:25:41 +01:00
lucasmerlin bbbd936f50
Exclude icon.png from lfs (#5336)
* Closes #5331 
* [x] I have followed the instructions in the PR template
2024-11-01 13:21:05 +01:00
TÖRÖK Attila 67c82ed5f2
wgpu: Bump to wgpu 23.0.0 and wasm-bindgen to 0.2.95 (#5330)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
2024-10-30 18:53:22 +01:00
Cody Neiman 2cd3485dd4
Update MSRV from 1.76 to 1.77 (#5322)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

* [X] I have followed the instructions in the PR template

I am preparing a separate PR that adds support for JXL with `jxl-oxide`,
which is unlikely to be added to the `image` crate anytime soon (more
context will be provided in that PR).

`jxl-oxide` makes use of the
[`array::each_mut`](https://doc.rust-lang.org/stable/std/primitive.array.html#method.each_mut)
API which was stabilized in 1.77, which is the motivation for this MSRV
bump.

Rust 1.77 was officially released to stable on 21 March, 2024.
2024-10-30 09:06:34 +01:00
Emil Ernerfeldt 68352fc13e
CI: check that all png images are on git LFS (#5321)
To prevent egui repository from growing forever

* Sibling PR: https://github.com/emilk/egui/pull/5320
2024-10-29 10:30:25 +01:00
lucasmerlin 70a01138b7
Add egui testing library (#5166)
- closes #3491 
- closes #3926

This adds a testing library to egui based on
[kittest](https://github.com/rerun-io/kittest). Kittest is a new
[AccessKit](https://github.com/AccessKit/accesskit/)-based testing
library. The api is inspired by the js
[testing-library](https://testing-library.com/) where the idea is also
to query the dom based on accessibility attributes.
We made kittest with egui in mind but it should work with any rust gui
framework with AccessKit support.

It currently has support for:
- running the egui app, frame by frame
- building the AccessKit tree
- ergonomic queries via kittest
  - via e.g. get_by_name, get_by_role
- simulating events based on the accesskit node id
- creating arbitrary events based on Harness::input_mut
- rendering screenshots via wgpu
- snapshot tests with these screenshots

A simple test looks like this: 
```rust
fn main() {
    let mut checked = false;
    let app = |ctx: &Context| {
        CentralPanel::default().show(ctx, |ui| {
            ui.checkbox(&mut checked, "Check me!");
        });
    };

    let mut harness = Harness::builder().with_size(egui::Vec2::new(200.0, 100.0)).build(app);
    
    let checkbox = harness.get_by_name("Check me!");
    assert_eq!(checkbox.toggled(), Some(Toggled::False));
    checkbox.click();
    
    harness.run();

    let checkbox = harness.get_by_name("Check me!");
    assert_eq!(checkbox.toggled(), Some(Toggled::True));

    // You can even render the ui and do image snapshot tests
    #[cfg(all(feature = "wgpu", feature = "snapshot"))]
    egui_kittest::image_snapshot(&egui_kittest::wgpu::TestRenderer::new().render(&harness), "readme_example");
}
```

~Since getting wgpu to run in ci is a hassle, I'm taking another shot at
creating a software renderer for egui (ideally without a huge dependency
like skia)~ (this didn't work as well as I hoped and it turns out in CI
you can just run tests on a mac runner which comes with a real GPU)
 
Here is a example of a failed snapshot test in ci, it will say which
snapshot failed and upload an artifact with the before / after and diff
images:

https://github.com/emilk/egui/actions/runs/11183049487/job/31090724606?pr=5166
2024-10-22 12:39:00 +02:00
Emil Ernerfeldt a72ebbeafc
Add a `cargo machete` CI step (#5171)
`cargo machete` looks for unused dependencies
2024-09-26 10:24:37 +02:00
lucasmerlin 0f290b4904
Add PR preview deployments (#5131)
This adds preview deployments that will deploy a version of
egui_demo_app for each pull request, making things easier to review /
test.

Some notes on security:
The preview deployment is split in two workflows, preview_build and
preview_deploy.
`preview_build` runs on pull_request, so it won't have any access to the
repositories secrets, so it is safe to
build / execute untrusted code.
`preview_deploy` has access to the repositories secrets (so it can push
to the pr preview repo) but won't run
any untrusted code (it will just extract the build artifact and push it
to the pages branch where it will
automatically be deployed).

To set this up, a DEPLOY_KEY secret needs to be added, which allows the
action to push the compiled artifacts into this repository:
https://github.com/egui-pr-preview/pr
The deploy key is the private key part of a key generated via
ssh-keygen. The public key is set as a deploy key in that repo.
I have created the repo on a separate github org, so it won't be
directly associated with emil or egui in case someone pushes something
naughty.

I have set this up in my fork of egui to show how this works:
- I created a PR: https://github.com/lucasmerlin/egui/pull/2
- The code will be compiled and pushed to the egui-pr-preview/pr repo
and deployed via github pages
- The bot leaves a comment on the pr with a link to the preview
- The preview is available at
https://egui-pr-preview.github.io/pr/2-pr-preview-demo/
(It's unfortunately only available a couple seconds after the bot writes
the comment, because the pages deployment action is run independently on
the other repository)
- Once the PR is merged / closed the preview will be cleaned up
(unfortunately the empty folder will remain, it seems like it's not
possible to remove that via the JamesIves/github-pages-deploy-action
action I use, but I don't think that it's a big issue)

I'll leave the PR in draft until the DEPLOY_KEY is set up
2024-09-20 09:08:58 +02:00
9SMTM6 08f5eb30a4
Add opt-out `fragile-send-sync-non-atomic-wasm` feature for wgpu (#5098)
Note this will break people depending on eframe or egui-wgpu with
--no-default-features.
I don't know what to do about that to be honest.

* Closes #4914 
* [x] I have followed the instructions in the PR template

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2024-09-13 13:00:18 +02:00
Nicolas be484f5c3b
CI: Update `cache-apt-pkgs-action` (#5049)
* Closes https://github.com/emilk/egui/issues/5047
* [x] I have followed the instructions in the PR template
2024-09-01 10:23:51 +02:00
Emil Ernerfeldt 58bc67e02f
Fix compilation of `egui_extras` without `serde` feature (#5014)
* Closes https://github.com/emilk/egui/issues/4771
2024-08-27 11:38:33 +02:00
Emil Ernerfeldt a9a6e0c2f2
Remove the need for setting `web_sys_unstable_apis` (#5000)
* No longer required since https://github.com/emilk/egui/pull/4980

And despite some outdated comments, wgpu/WebGPU doesn't need it either
2024-08-26 16:31:38 +02:00
Nicolas 560b2989a7
Update `web-sys` & `wasm-bindgen` (#4980)
This PR updates web-sys & wasm to the newest version.

(this was already part of the POC #4954 )

* Closes <https://github.com/emilk/egui/issues/4961>
* Closes <https://github.com/emilk/egui/issues/4958>
* [x] I have followed the instructions in the PR template
2024-08-26 11:38:30 +02:00
lucasmerlin c9e00e50ad
Fix iOS build, and add iOS step to CI (#4898)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

This PR
- adds a pipeline to check the ios build
- removes the iOS WaitUntil workaround, which doesn't seem to be
necessary anymore after the winit update (and caused the build for iOS
to fail again because of a missing self
- ~removes a iOS workaround for window size which doesn't seem necessary
anymore~
Turns out it was still needed (but you need to actually restart the app
for the issue to show up, so I didn't catch it first)
- fixes some cargo check errors in run.rs

I've done all these changes in a single PR because otherwise the
pipeline doesn't run but I can also split them in separate PRs if that
makes it easier to review
2024-08-26 09:48:12 +02:00
Alex Pinkus ae7672e336
Move default fonts to new crate `epaint_default_fonts` (#4853)
This allows license checking tools to omit the OFL and UFL licenses when
`default_fonts` are turned off.

There was some discussion of versioning on the original issue; I have
chosen to label this version as `0.28.1` to match the other crates.
Happy to adjust the version as needed.

<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

* Closes <https://github.com/emilk/egui/issues/2321>
* [X] I have followed the instructions in the PR template

---------

Co-authored-by: Alex Pinkus <pinkus@amazon.com>
2024-07-31 09:50:02 +02:00
Emil Ernerfeldt cb9f30482f
Move `egui_plot` to its own repo (#4828)
* Part of https://github.com/emilk/egui/issues/4705

`egui_plot` can now be found at https://github.com/emilk/egui_plot
2024-07-15 18:45:19 +02:00
Emil Ernerfeldt 814ad0783c
Update to wgpu 0.20 (#4560)
* this PR reverts https://github.com/emilk/egui/pull/4559
* and re-applies https://github.com/emilk/egui/pull/4433

Before we merge, we're waiting for a wgpu 0.20.1 patch-release of

* https://github.com/gfx-rs/wgpu/pull/5681

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2024-06-13 15:00:23 +02:00
Emil Ernerfeldt 54429e0549
Revert update to wgpu 0.20 => downgrade to wgpu 0.19.1 (#4559)
0.20 has a bunch of bugs that will be fixed by:

* https://github.com/gfx-rs/wgpu/pull/5681

At Rerun, we don't want to wait for the wgpu 0.20.1 patch release before
we update egui, so we will temporarily downgrade to wgpu 0.19

After reverting I'll open a new PR that will update to 0.20 again, with
the intention of merging that once 0.20.1 is released.
2024-05-28 14:40:43 +02:00
Simon Niedermayr c9b24d5a5c
Update to wgpu 0.20 (#4433)
updates the wgpu version to 0.20 and changes the API calls accordingly. 
I had to update wasm-bindgen to "0.2.92". Otherwise, I got this error
for the demo app:
```
error: failed to select a version for `wasm-bindgen`.
    ... required by package `js-sys v0.3.69`
    ... which satisfies dependency `js-sys = "^0.3.69"` of package `eframe v0.27.2 (/home/user/Projects/egui/crates/eframe)`
    ... which satisfies path dependency `eframe` (locked to 0.27.2) of package `confirm_exit v0.1.0 (/home/user/Projects/egui/examples/confirm_exit)`
versions that meet the requirements `^0.2.92` are: 0.2.92

all possible versions conflict with previously selected packages.

  previously selected package `wasm-bindgen v0.2.90`
    ... which satisfies dependency `wasm-bindgen = "=0.2.90"` of package `egui_demo_app v0.27.2 (/home/user/Projects/egui/crates/egui_demo_app)`

failed to select a version for `wasm-bindgen` which could resolve this conflict
```

Why is it locked to this version right now?

I ran the tests, checked the web demo and my own projects, and
everything seems to work fine with wgpu 0.20.

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2024-04-30 11:47:12 +02:00
Emil Ernerfeldt 2f508d6a61
Replace cargo-cranky with workspace lints (#4413)
Replace `cargo-cranky` (which has served us well) with workspace lints
2024-04-25 17:24:50 +02:00
Emil Ernerfeldt cee790681d
Update to Rust 1.76 (#4411)
Motivation: I want to replace `cargo-cranky` with workspace lints, first
available in Rust 1.74.
However, `cargo doc` would hange on `wgpu` and `wgpu-core` on 1.74 and
1.75… so now we're on 1.76.
I think this is fine - when 1.78 is released next week we're still two
versions behind the bleeding edge.

…and the branch name is just wrong 🤦
2024-04-25 15:51:01 +02:00
Emil Ernerfeldt d99fabaef5
Add another check to Windows CI (#4038)
To see if we can catch the problem in
https://github.com/emilk/egui/pull/4037
2024-02-13 12:35:49 +01:00
Emil Ernerfeldt bfadb90d42
Update MSRV to Rust 1.72 (#3595)
Required to update to puffin 0.18
2023-11-21 17:26:35 +01:00
Emil Ernerfeldt e823491240
Update some crate dependencies (#3594)
Nothing major
2023-11-21 16:07:56 +01:00
Emil Ernerfeldt beb4714e40 Update the web-demo CI action with the new folder name 2023-11-16 16:45:06 +01:00