forked from bluealloy/revm
-
Notifications
You must be signed in to change notification settings - Fork 13
52 lines (44 loc) · 1.59 KB
/
cachegrind.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Valgrind Cachegrind
on:
pull_request:
branches: [main]
jobs:
valgrind:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup | Rust
uses: ATiltedTree/setup-rust@v1
with:
rust-version: stable
- name: Install Valgrind
run: |
sudo apt-get update
sudo apt-get install -y valgrind
- name: Run Valgrind
run: |
cargo b -r -p revm-test --bin snailtracer
valgrind --tool=cachegrind target/release/snailtracer 2>&1 | tee cachegrind_results.txt
- name: Valgrind results
id: valgrind_results
run: |
contents=$(printf "%s" "$(head -c 64000 cachegrind_results.txt)")
# dump line by line into a file
printf "Valgrind Results:\n\n\`\`\`\n%s\n\`\`\`" "$contents" > results.md
- name: Comment on PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Try to edit the last comment
if gh pr comment ${{ github.event.pull_request.number }} --edit-last --body-file results.md; then
echo "Successfully edited last comment."
else
echo "Failed to edit last comment. Trying to add a new comment instead!"
# If editing last comment fails, try to add a new comment
if ! gh pr comment ${{ github.event.pull_request.number }} --body-file results.md; then
echo "Comment failed to be made, printing out results here:"
cat results.md
fi
fi