Set up automatic CI for examples/
The runtime should have an operating mode where it will run the client and server as normal, and exit with a 0 or error status code depending on one of these:
- Error: The client fails to connect to the server
- Error: A timeout after initial startup expires (e.g. 5 seconds after the client expires)
- Success: The guest code calls a runtime function to notify it that it is done. Upon doing so, the runtime will take a screenshot of the current state. If the screenshot does not match a stored screenshot, it fails. Otherwise, it succeeds.
The examples would have something like
runtime::ci_test(|success, fail| async {
sleep(1).await;
if entity::exists(id) {
success();
} else {
fail("The entity did not exist.".to_string());
}
});
at the end of their execution. This is not automatic as the guests should be able to specify their own success conditions (e.g. "was this entity created?") and to lock their state for the screenshot (e.g. for the asset loading example, it should lock its cube in place for the screenshot)
So I'm thinking a first step towards this would be to just add these three things;
- [ ] Headless mode
- [ ] A
screenshotfunction (and after than maybe ascreenshot_compare, which would return true if the screenshot was different from the one on disk). This would need #6 though. - [ ] An
exit(code)function
If we have that, we can build simple test modules that can run on the ci.
Seems pretty reasonable. I'd suggest wiring up environment variables with WASI, and then we can tell it the screenshot to match (assuming we can pack image data into an env var) and any other conditions that it should know about. Let's give this a shot once #6 is in.