summaryrefslogtreecommitdiffstats
path: root/library/backtrace/.github/workflows
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:36 +0000
commite02c5b5930c2c9ba3e5423fe12e2ef0155017297 (patch)
treefd60ebbbb5299e16e5fca8c773ddb74f764760db /library/backtrace/.github/workflows
parentAdding debian version 1.73.0+dfsg1-1. (diff)
downloadrustc-e02c5b5930c2c9ba3e5423fe12e2ef0155017297.tar.xz
rustc-e02c5b5930c2c9ba3e5423fe12e2ef0155017297.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/backtrace/.github/workflows')
-rw-r--r--library/backtrace/.github/workflows/check-binary-size.yml83
-rw-r--r--library/backtrace/.github/workflows/main.yml2
2 files changed, 84 insertions, 1 deletions
diff --git a/library/backtrace/.github/workflows/check-binary-size.yml b/library/backtrace/.github/workflows/check-binary-size.yml
new file mode 100644
index 000000000..0beae1da9
--- /dev/null
+++ b/library/backtrace/.github/workflows/check-binary-size.yml
@@ -0,0 +1,83 @@
+# This workflow checks if a PR commit has changed the size of a hello world Rust program.
+# It downloads Rustc and compiles two versions of a stage0 compiler - one using the base commit
+# of the PR, and one using the latest commit in the PR.
+# If the size of the hello world program has changed, it posts a comment to the PR.
+name: Check binary size
+
+on:
+ pull_request_target:
+ branches:
+ - master
+
+jobs:
+ test:
+ name: Check binary size
+ runs-on: ubuntu-latest
+ permissions:
+ pull-requests: write
+ steps:
+ - name: Print info
+ run: |
+ echo "Current SHA: ${{ github.event.pull_request.head.sha }}"
+ echo "Base SHA: ${{ github.event.pull_request.base.sha }}"
+ - name: Clone Rustc
+ uses: actions/checkout@v3
+ with:
+ repository: rust-lang/rust
+ fetch-depth: 1
+ - name: Fetch backtrace
+ run: git submodule update --init library/backtrace
+ - name: Create hello world program that uses backtrace
+ run: printf "fn main() { panic!(); }" > foo.rs
+ - name: Build binary with base version of backtrace
+ run: |
+ printf "[llvm]\ndownload-ci-llvm = true\n\n[rust]\nincremental = false\n" > config.toml
+ cd library/backtrace
+ git remote add head-pr https://github.com/${{ github.event.pull_request.head.repo.full_name }}
+ git fetch --all
+ git checkout ${{ github.event.pull_request.base.sha }}
+ cd ../..
+ git add library/backtrace
+ python3 x.py build library --stage 0
+ ./build/x86_64-unknown-linux-gnu/stage0-sysroot/bin/rustc -O foo.rs -o binary-reference
+ - name: Build binary with PR version of backtrace
+ run: |
+ cd library/backtrace
+ git checkout ${{ github.event.pull_request.head.sha }}
+ cd ../..
+ git add library/backtrace
+ rm -rf build/x86_64-unknown-linux-gnu/stage0-std
+ python3 x.py build library --stage 0
+ ./build/x86_64-unknown-linux-gnu/stage0-sysroot/bin/rustc -O foo.rs -o binary-updated
+ - name: Display binary size
+ run: |
+ ls -la binary-*
+ echo "SIZE_REFERENCE=$(stat -c '%s' binary-reference)" >> "$GITHUB_ENV"
+ echo "SIZE_UPDATED=$(stat -c '%s' binary-updated)" >> "$GITHUB_ENV"
+ - name: Post a PR comment if the size has changed
+ uses: actions/github-script@v6
+ with:
+ script: |
+ const reference = process.env.SIZE_REFERENCE;
+ const updated = process.env.SIZE_UPDATED;
+ const diff = updated - reference;
+ const plus = diff > 0 ? "+" : "";
+ const diff_str = `${plus}${diff}B`;
+
+ if (diff !== 0) {
+ const percent = (((updated / reference) - 1) * 100).toFixed(2);
+ // The body is created here and wrapped so "weirdly" to avoid whitespace at the start of the lines,
+ // which is interpreted as a code block by Markdown.
+ const body = `Below is the size of a hello-world Rust program linked with libstd with backtrace.
+
+ Original binary size: **${reference}B**
+ Updated binary size: **${updated}B**
+ Difference: **${diff_str}** (${percent}%)`;
+
+ github.rest.issues.createComment({
+ issue_number: context.issue.number,
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ body
+ })
+ }
diff --git a/library/backtrace/.github/workflows/main.yml b/library/backtrace/.github/workflows/main.yml
index 29fff2795..21d7cb492 100644
--- a/library/backtrace/.github/workflows/main.yml
+++ b/library/backtrace/.github/workflows/main.yml
@@ -229,7 +229,7 @@ jobs:
with:
submodules: true
- name: Install Rust
- run: rustup update 1.55.0 && rustup default 1.55.0
+ run: rustup update 1.65.0 && rustup default 1.65.0
- run: cargo build
miri: