Skip to content

Commit 95408a3

Browse files
authored
♻️ Refactor gas-diff CI job (#1508)
1 parent 5220432 commit 95408a3

File tree

3 files changed

+52
-6
lines changed

3 files changed

+52
-6
lines changed

.github/workflows/ci-all-via-ir.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
- name: Install Dependencies
2424
run: forge install
2525

26+
# NOTE: skipping solc 0.8.32 due to compiler bug
27+
# https://github.com/argotorg/solidity/issues/16360
2628
- name: Run Tests with ${{ matrix.profile }}
2729
run: >
2830
( [ "${{ matrix.profile }}" = "via-ir-0" ] &&
@@ -45,8 +47,6 @@ jobs:
4547
forge test --use 0.8.16 --via-ir &&
4648
forge test --use 0.8.17 --via-ir
4749
) ||
48-
# NOTE: skipping solc 0.8.32 due to compiler bug
49-
# https://github.com/argotorg/solidity/issues/16360
5050
( [ "${{ matrix.profile }}" = "via-ir-3" ] &&
5151
forge test --use 0.8.33 --via-ir &&
5252
forge test --use 0.8.31 --via-ir &&

.github/workflows/ci.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,19 @@ jobs:
139139
- name: Generate gas diff
140140
uses: atarpara/[email protected]
141141
id: gas_diff
142-
- name: Add gas diff to sticky comment
143-
uses: marocchino/sticky-pull-request-comment@v2
142+
- name: Save gas diff output
143+
if: steps.gas_diff.outputs.markdown
144+
run: |
145+
mkdir -p ./gas-diff
146+
echo "${{ steps.gas_diff.outputs.markdown }}" > ./gas-diff/comment.md
147+
echo "${{ github.event.number }}" > ./gas-diff/pr-number.txt
148+
- name: Upload gas diff artifact
149+
if: steps.gas_diff.outputs.markdown
150+
uses: actions/upload-artifact@v4
144151
with:
145-
delete: ${{ !steps.gas_diff.outputs.markdown }}
146-
message: ${{ steps.gas_diff.outputs.markdown }}
152+
name: gas-diff
153+
path: gas-diff/
154+
147155

148156
prep-checker:
149157
runs-on: ${{ matrix.os }}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Post Gas Diff Comment
2+
3+
on:
4+
workflow_run:
5+
workflows: ["ci"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
comment:
11+
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
12+
runs-on: ubuntu-latest
13+
permissions:
14+
pull-requests: write
15+
steps:
16+
- name: Download gas diff artifact
17+
uses: actions/download-artifact@v4
18+
with:
19+
name: gas-diff
20+
github-token: ${{ secrets.GITHUB_TOKEN }}
21+
run-id: ${{ github.event.workflow_run.id }}
22+
- name: Read PR number
23+
id: pr
24+
run: echo "number=$(cat pr-number.txt)" >> $GITHUB_OUTPUT
25+
- name: Read gas diff
26+
id: gas_diff
27+
run: |
28+
if [ -f comment.md ]; then
29+
echo "markdown<<EOF" >> $GITHUB_OUTPUT
30+
cat comment.md >> $GITHUB_OUTPUT
31+
echo "EOF" >> $GITHUB_OUTPUT
32+
fi
33+
- name: Add gas diff to sticky comment
34+
uses: marocchino/sticky-pull-request-comment@v2
35+
with:
36+
number: ${{ steps.pr.outputs.number }}
37+
delete: ${{ !steps.gas_diff.outputs.markdown }}
38+
message: ${{ steps.gas_diff.outputs.markdown }}

0 commit comments

Comments
 (0)