Skip to content

Commit

Permalink
Generally clean up a few things.
Browse files Browse the repository at this point in the history
  • Loading branch information
detly committed Jul 21, 2023
1 parent a98b5e6 commit 795820b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build-with-patched-std/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ outputs:
description: The size in bytes of the built test binary
value: ${{ steps.measure.outputs.test-binary-size }}
runs:
using: "composite"
using: composite
steps:
- shell: bash
id: measure
Expand Down
5 changes: 5 additions & 0 deletions .github/actions/report-code-size-changes/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ runs:
const size_dir = process.env.DATA_DIRECTORY;
// Map the set of all the *.json files into an array of objects.
const globber = await glob.create(`${size_dir}/*.json`);
const files = await globber.glob();
const sizes = files.map(path => {
const contents = fs.readFileSync(path);
return JSON.parse(contents);
});
// Map each object into some text, but only if it shows any difference
// to report.
const size_reports = sizes.flatMap(size_data => {
const platform = size_data["platform"];
const reference = size_data["reference"];
Expand Down Expand Up @@ -91,6 +94,8 @@ runs:
}
});
// If there are any size changes to report, format a comment and post
// it.
if (size_reports.length > 0) {
const comment_sizes = size_reports.join("");
const body = `Code size changes for a hello-world Rust program linked with libstd with backtrace:
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/check-binary-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ name: Check binary size

on: pull_request_target

# Both the "measure" and "report" jobs need to know this.
env:
SIZE_DATA_DIR: sizes

Expand Down Expand Up @@ -51,6 +52,8 @@ jobs:
- name: Set up std repository and backtrace submodule for size test
shell: bash
working-directory: ${{ env.RUSTC_DIR }}
env:
PR_SOURCE_REPO: ${{ github.event.pull_request.head.repo.full_name }}
run: |
# Bootstrap config
cat <<EOF > config.toml
Expand All @@ -70,19 +73,19 @@ jobs:
git submodule update --init library/backtrace
cd library/backtrace
git remote add head-pr https://github.com/${{ github.event.pull_request.head.repo.full_name }}
git remote add head-pr "https://github.com/$PR_SOURCE_REPO"
git fetch --all
- name: Build binary with base version of backtrace
uses: ./backtrace/.github/actions/build-with-patched-std
with:
backtrace-commit: $BASE_COMMIT
backtrace-commit: ${{ env.BASE_COMMIT }}
main-rs: ${{ env.TEST_MAIN_RS }}
rustc-dir: ${{ env.RUSTC_DIR }}
id: size-reference
- name: Build binary with PR version of backtrace
uses: ./backtrace/.github/actions/build-with-patched-std
with:
backtrace-commit: $HEAD_COMMIT
backtrace-commit: ${{ env.HEAD_COMMIT }}
main-rs: ${{ env.TEST_MAIN_RS }}
rustc-dir: ${{ env.RUSTC_DIR }}
id: size-updated
Expand Down

0 comments on commit 795820b

Please sign in to comment.