trunk-rs / trunk

Build, bundle & ship your Rust WASM application to the web.

Home Page:https://trunkrs.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"no rust project found" in Gitlab Pages CI

Waridley opened this issue · comments

I'm trying to deploy a game jam project to Gitlab Pages using Trunk, but no matter what I do it only copies the assets folder and index.html, and doesn't build the Rust project.

Here's an example job log:
https://gitlab.com/Waridley/pac-ghoul/-/jobs/5198168518

I'm not sure if it's related to the fact that the rust project is not in the root of the repository, but in the rs folder. However, it is finding Trunk.toml just fine in the same folder.

@Waridley Hi!
I ran into the same problem. It has a very trivial solution. You need to move your index.html file to the same level as Cargo.toml.
This is because in the current version (0.17.5) trunk does the following to find the project path:
let path = html_dir.join("Cargo.toml");
image

@Waridley Hi!
I ran into the same problem. It has a very trivial solution. You need to move your index.html file to the same level as Cargo.toml.

Mine is, though. I even added an ls to the CI to verify that it could see all of the files. They are in the rs folder, so not the root of the repo, but all in the same folder:
Screenshot_20231014-152201.png

Not sure about the exact layout of your project, but there's a way to influence this lookup: https://trunkrs.dev/assets/#rust

In my case, let metadata = match spawn_blocking(move || cmd.exec()) failed because CARGO env variable was not set up, maybe that helps.

In my case, I added <link data-trunk rel="rust" href="/Cargo.toml" />; it moved on to another issue (failed to open the cargo registry index). I eventually switched to running it as root to solve the latter.

In my case, I added <link data-trunk rel="rust" href="/Cargo.toml" />; it moved on to another issue (failed to open the cargo registry index). I eventually switched to running it as root to solve the latter.

That worked, thank you.

Of course it would still be nice to know the root cause and prevent this from happening to others if possible.

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.