Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

rust: build fails if main.rs relocated to src/main.rs #2

Open
jdolitsky opened this issue Jul 14, 2022 · 2 comments
Open

rust: build fails if main.rs relocated to src/main.rs #2

jdolitsky opened this issue Jul 14, 2022 · 2 comments

Comments

@jdolitsky
Copy link
Member

Running thew action chainguard-dev/actions/melange-build@main:

2022/07/13 22:11:55 melange (hello-server/aarch64): populating workspace /tmp/melange-workspace-833668723 from .
2022/07/13 22:11:55 melange (hello-server/aarch64):   -> .gitignore
2022/07/13 22:11:55 melange (hello-server/aarch64):   -> Cargo.lock
2022/07/13 22:11:55 melange (hello-server/aarch64):   -> Cargo.toml
2022/07/13 22:11:55 melange (hello-server/aarch64):   -> apko.yaml
2022/07/13 22:11:55 melange (hello-server/aarch64):   -> melange.rsa
2022/07/13 22:11:55 melange (hello-server/aarch64):   -> melange.rsa.pub
2022/07/13 22:11:55 melange (hello-server/aarch64):   -> melange.yaml
2022/07/13 22:11:55 melange (hello-server/aarch64): running the main pipeline
2022/07/13 22:11:55 melange (hello-server/aarch64): running step Build Rust application
2022/07/13 22:11:55 melange (hello-server/aarch64):     ${{package.version}}: 0.1.0
2022/07/13 22:11:55 melange (hello-server/aarch64):     ${{package.epoch}}: 0
2022/07/13 22:11:55 melange (hello-server/aarch64):     ${{targets.destdir}}: /home/build/melange-out/hello-server
2022/07/13 22:11:55 melange (hello-server/aarch64):     ${{package.name}}: hello-server
2022/07/13 22:11:56 melange (hello-server/aarch64): error: failed to parse manifest at `/home/build/Cargo.toml`
2022/07/13 22:11:56 melange (hello-server/aarch64): 
2022/07/13 22:11:56 melange (hello-server/aarch64): Caused by:
2022/07/13 22:11:56 melange (hello-server/aarch64):   no targets specified in the manifest
2022/07/13 22:11:56 melange (hello-server/aarch64):   either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present

For some reason, if moving the file to src/main.rs (more idiomatic for Rust), it does not appear in the workspace

@jdolitsky
Copy link
Member Author

This issue does not occur locally, which makes me think it is related to running the upstream GitHub action (chainguard-dev/actions/melange-build@main)

@OscarAyoy
Copy link

I just ran into this myself. It seems the src folder gets automatically ignored / excluded. I attempted to explicitly un-ignore the folder in a custom .melangeignore file, but had no success. In the end the easiest work-around was to simply rename the folder. This only applies to the melange-build action though. Works fine building locally using the Docker image.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants