-
Notifications
You must be signed in to change notification settings - Fork 419
WIP: define rust/cargo-build pipeline #4608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: Build a release binary using cargo build | ||
|
|
||
| needs: | ||
| packages: | ||
| - rust | ||
| - busybox | ||
| - ca-certificates-bundle | ||
|
|
||
| inputs: | ||
| target: | ||
| description: | | ||
| The name of the binary to build | ||
|
|
||
| subpackage: | ||
| description: | | ||
| Indicates that the build will write to a subpackage target folder | ||
| default: "false" | ||
|
|
||
| pipeline: | ||
| - runs: | | ||
| cargo build --release -vv | ||
|
|
||
| if [ "${{inputs.subpackage}}" == "true" ]; then | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we should have a pipeline node which defines a value. Something like: pipeline:
- set:
target: ${{targets.destdir}}
- if: ${{inputs.subpackage}} == 'true'
set:
target: ${{targets.subpkgdir}}
- runs: |
mkdir -p ${{vars.target}}
mv target/release/${{inputs.target}} ${{vars.target}}But I also wonder if it would be helpful to have a context-specific
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I went ahead and implemented this in chainguard-dev/melange#622. |
||
| DEST_DIR="${{targets.subpkgdir}}"/usr/bin/ | ||
| else | ||
| DEST_DIR="${{targets.destdir}}"/usr/bin/ | ||
| fi | ||
|
|
||
| mkdir -p ${DEST_DIR} | ||
| mv target/release/${{inputs.target}} ${DEST_DIR} | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not a rust expert, but should we split this into
cargo/fetchandcargo/build(with--offlineor--locked) as the default?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I would like to split it, so that we can fetch in a prepare phase, and build in a later phase. This allows us to make the build process more hermetic in the future.