forked from rust-lang/backtrace-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modularise CI workflow and validate outputs for binary size checks.
- Loading branch information
Showing
2 changed files
with
117 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Github composite action to build a single-source-file test binary with an | ||
# already-checked-out version of Rust's stdlib, that will be patched with a | ||
# given revision of the backtrace crate. | ||
|
||
name: Build with patched std | ||
description: > | ||
Build a binary with a version of std that's had a specific revision of | ||
backtrace patched in. | ||
inputs: | ||
backtrace-commit: | ||
description: The git commit of backtrace to patch in to std | ||
required: true | ||
main-rs: | ||
description: The (single) source code file to compile | ||
required: true | ||
rustc-dir: | ||
description: The root directory of the rustc repo | ||
required: true | ||
outputs: | ||
test-binary-size: | ||
description: The size in bytes of the built test binary | ||
value: ${{ steps.measure.outputs.test-binary-size }} | ||
runs: | ||
using: composite | ||
steps: | ||
- shell: bash | ||
id: measure | ||
env: | ||
RUSTC_FLAGS: -Copt-level=3 -Cstrip=symbols | ||
# This symlink is made by Build::new() in the bootstrap crate, using a | ||
# symlink on Linux and a junction on Windows, so it will exist on both | ||
# platforms. | ||
RUSTC_BUILD_DIR: build/host | ||
working-directory: ${{ inputs.rustc-dir }} | ||
run: | | ||
rm -rf "$RUSTC_BUILD_DIR/stage0-std" | ||
(cd library/backtrace && git checkout ${{ inputs.backtrace-commit }}) | ||
git add library/backtrace | ||
python3 x.py build library --stage 0 | ||
TEMP_BUILD_OUTPUT=$(mktemp test-binary-XXXXXXXX) | ||
"$RUSTC_BUILD_DIR/stage0-sysroot/bin/rustc" $RUSTC_FLAGS "${{ inputs.main-rs }}" -o "$TEMP_BUILD_OUTPUT" | ||
BINARY_SIZE=$(stat -c '%s' "$TEMP_BUILD_OUTPUT") | ||
rm "$TEMP_BUILD_OUTPUT" | ||
echo "test-binary-size=$BINARY_SIZE" >> "$GITHUB_OUTPUT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters