NiklasEi / bevy_game_template

Template for a Bevy game including CI/CD for web, Windows, Linux, macOS, iOS and Android
https://niklasei.github.io/bevy_game_template/
Creative Commons Zero v1.0 Universal
847 stars 89 forks source link

deploy-github-page fails if you use local paths in cargo.toml #36

Closed sarkahn closed 2 years ago

sarkahn commented 2 years ago

As the title says, the deploy-github-page action fails if your cargo.toml has a local path dependency. Maybe this should have been obvious to me but it caught me off guard a bit as when you publish to crates.io it strips the local dependencies out and falls back to the published crate.

If this isn't really a bug it might at least be worth noting in the readme that you should remove local paths before publishing as the cause wasn't immediately obvious.

Failed output from the "Build release" step ``` Run trunk build --release --public-url "${GITHUB_REPOSITORY#*/}" 2022-08-31T08:00:[4](https://github.com/sarkahn/bevy_ascii_tetris/runs/8108815613?check_suite_focus=true#step:8:5)4.290680Z INFO šŸ“¦ starting build 2022-08-31T08:00:44.2912[5](https://github.com/sarkahn/bevy_ascii_tetris/runs/8108815613?check_suite_focus=true#step:8:6)1Z INFO spawning asset pipelines 2022-08-31T08:00:45.[6](https://github.com/sarkahn/bevy_ascii_tetris/runs/8108815613?check_suite_focus=true#step:8:7)56057Z ERROR āŒ error error from HTML pipeline Caused by: 0: error getting cargo metadata Error: error from HTML pipeline 1: `cargo metadata` exited with an error: error: failed to get `bevy` as a dependency of package `bevy_ascii_tetris v0.1.0 (/home/runner/work/bevy_ascii_tetris/bevy_ascii_tetris)` Caused by: Caused by: 0: error getting cargo metadata 1: `cargo metadata` exited with an error: error: failed to get `bevy` as a dependency of package `bevy_ascii_tetris v0.1.0 (/home/runner/work/bevy_ascii_tetris/bevy_ascii_tetris)` Caused by: failed to load source for dependency `bevy` Caused by: Unable to update /home/runner/work/bevy_ascii_tetris/bevy Caused by: failed to read `/home/runner/work/bevy_ascii_tetris/bevy/Cargo.toml` Caused by: No such file or directory (os error 2) failed to load source for dependency `bevy` Caused by: Unable to update /home/runner/work/bevy_ascii_tetris/bevy Caused by: failed to read `/home/runner/work/bevy_ascii_tetris/bevy/Cargo.toml` Caused by: No such file or directory (os error 2) ```
NiklasEi commented 2 years ago

We can add it to the readme for sure. I am wondering if it is possible somehow to tell cargo to build with priority for non-local paths. A quick search in the docs didn't show any options.

NiklasEi commented 2 years ago

Looking at this again, it really seems like normal behaviour. The workflow is making a build just like the other workflows, which should fail with the same issue if you try using local dependencies. I agree that the error is not optimal, but it does make obvious where it is trying to find the dependency (No such file or directory for /home/runner/work/bevy_ascii_tetris/bevy).

I still added a note to the readme.