-
Notifications
You must be signed in to change notification settings - Fork 407
129 lines (106 loc) · 3.82 KB
/
t-bytecode-compare.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Release bytecode
on: pull_request
jobs:
generate:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- platform: emscripten-wasm32
os: ubuntu-latest
- platform: emscripten-asmjs
os: ubuntu-latest
- platform: linux-amd64
os: ubuntu-latest
- platform: macosx-amd64
os: macos-latest
# TODO: Run checks on Windows binaries too
env:
PLATFORM: ${{ matrix.platform }}
steps:
- uses: actions/setup-node@v4
- name: Free Disk Space Before Build
if: "env.PLATFORM == 'macosx-amd64'"
run: |
df -hI /dev/disk3s1s1
sudo rm -rf /Applications/Xcode_14.3.1.app
sudo rm -rf /Applications/Xcode_15.0.1.app
sudo rm -rf /Applications/Xcode_15.1.app
sudo rm -rf /Applications/Xcode_15.2.app
sudo rm -rf /Applications/Xcode_15.3.app
sudo rm -rf "$AGENT_TOOLSDIRECTORY" \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
/opt/pipx \
/usr/lib/mono \
/usr/local/julia* \
/usr/local/lib/android \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift
df -hI /dev/disk3s1s1
- name: Symlink solc-bin to /mnt/solc-bin
# It's now too big to fit on the main partition on Ubuntu. macOS runners are fine since
# they apparently have >70 GB available, but on Ubuntu it's mostly filled with software.
# NOTE: We don't clone to /mnt/solc-bin directly because the checkout action does not support that.
# See https://github.com/actions/checkout/issues/197
if: "env.PLATFORM != 'macosx-amd64'"
run: |
sudo mkdir /mnt/solc-bin/
sudo chown "$USER" /mnt/solc-bin/
ln -s /mnt/solc-bin/ solc-bin
- uses: actions/setup-python@v5
with:
# Use the latest minor release of Python 3. prepare_report.py requires Python >= 3.7
python-version: '3.x'
- uses: actions/checkout@v4
with:
repository: 'ethereum/solidity'
path: 'solidity/'
# bytecode_reports_for_modified_binaries.sh requires access to a working copy with full history
fetch-depth: 0
submodules: 'recursive'
- uses: actions/checkout@v4
with:
ref: ${{ env.GITHUB_REF }}
path: 'solc-bin/'
# We need more than just a single revision to be able to use diff
fetch-depth: 0
- name: Generate reports from matching release binaries
run: |
base_dir="$PWD"
mkdir reports/
cd reports/
"${base_dir}/solidity/scripts/solc-bin/bytecode_reports_for_modified_binaries.sh" \
"$PLATFORM" \
"origin/${{ github.base_ref }}" \
"origin/${GITHUB_HEAD_REF}" \
"$base_dir/solc-bin" \
"$base_dir/solidity"
- name: Upload reports
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}
path: reports/*
compare:
runs-on: ubuntu-latest
needs: generate
steps:
- uses: actions/checkout@v4
with:
repository: 'ethereum/solidity'
path: 'solidity/'
submodules: 'recursive'
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: reports/
- name: Compare
run: |
# This can happen if the PR does not touch any release binaries.
[[ -d reports/ ]] || { echo "No reports found."; exit 0; }
cd reports/
../solidity/scripts/solc-bin/compare_bytecode_reports.sh