-
Notifications
You must be signed in to change notification settings - Fork 6
186 lines (165 loc) · 7.43 KB
/
Bytecode_diff_report.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Bytecode Diff Report
env:
FOUNDRY_VERSION: nightly
OMEGA_PRIVATE_KEY: ${{ secrets.OMEGA_BASE_DEPLOYER_PK }}
TESTNET_PRIVATE_KEY: ${{ secrets.GAMMA_BASE_SEPOLIA_DEPLOYER_PK }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
BASE_SEPOLIA_RPC_URL: ${{ secrets.BASE_SEPOLIA_RPC_URL }}
FACET_SOURCE_PATH: ../../contracts/src
REPORT_OUT_DIR: ${{ vars.REPORT_OUT_DIR }}
BASESCAN_API_KEY: ${{ secrets.BASESCAN_API_KEY }}
BASESCAN_SEPOLIA_URL: 'https://api-sepolia.basescan.org/api'
BASESCAN_URL: 'https://api.basescan.org/api'
BLOCKSCOUT_SEPOLIA_URL: 'https://base-sepolia.blockscout.com/api'
BLOCKSCOUT_BASE_URL: 'https://base.blockscout.com/api'
BLOCKSCOUT_SEPOLIA_API_KEY: ${{ secrets.BLOCKSCOUT_BASE_SEPOLIA_API_KEY }}
BLOCKSCOUT_BASE_API_KEY: ${{ secrets.BLOCKSCOUT_BASE_API_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.RIVER_S3_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.RIVER_S3_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.RIVER_S3_AWS_REGION }}
GOWORK: off
on:
workflow_dispatch:
inputs:
origin_environment:
description: 'Origin environment'
required: true
type: choice
options:
- 'alpha'
- 'gamma'
- 'omega'
default: 'alpha'
target_environment:
description: 'Target environment'
required: true
type: choice
options:
- 'alpha'
- 'gamma'
- 'omega'
default: 'gamma'
workflow_call:
inputs:
origin_environment:
description: 'Origin environment'
required: true
type: string
target_environment:
description: 'Target environment'
required: true
type: string
secrets:
BASE_RPC_URL:
required: true
BASE_SEPOLIA_RPC_URL:
required: true
BASESCAN_API_KEY:
required: true
BLOCKSCOUT_BASE_SEPOLIA_API_KEY:
required: true
BLOCKSCOUT_BASE_API_KEY:
required: true
GAMMA_BASE_SEPOLIA_DEPLOYER_PK:
required: true
OMEGA_BASE_DEPLOYER_PK:
required: true
RIVER_S3_AWS_ACCESS_KEY_ID:
required: true
RIVER_S3_AWS_SECRET_ACCESS_KEY:
required: true
RIVER_S3_AWS_REGION:
required: true
jobs:
Render_Network_Diff_Upgrade_Report:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: ${{ env.FOUNDRY_VERSION }}
- name: Install node dependencies
run: yarn install --immutable
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22' # Specify the Go version you need
- name: Install dependencies
run: |
go mod download
go mod tidy
working-directory: scripts/bytecode-diff
- name: Run report generation
run: |
go run main.go -v ${{ inputs.origin_environment }} ${{ inputs.target_environment }}
working-directory: scripts/bytecode-diff
env:
REPORT_OUT_DIR: ${{ env.REPORT_OUT_DIR }}
BASESCAN_API_KEY: ${{ env.BASESCAN_API_KEY }}
BASE_RPC_URL: ${{ env.BASE_RPC_URL }}
BASE_SEPOLIA_RPC_URL: ${{ env.BASE_SEPOLIA_RPC_URL }}
FACET_SOURCE_PATH: ${{ env.FACET_SOURCE_PATH }}
GOWORK: ${{ env.GOWORK }}
- name: Get latest facet diff file
run: |
FACET_DIFF_FILE=$(find ${{ env.REPORT_OUT_DIR }} -name "facet_diff*.yaml" | sort -r | head -n 1 | xargs basename)
echo "Latest facet diff file: $FACET_DIFF_FILE"
echo "FACET_DIFF_FILE=$FACET_DIFF_FILE" >> $GITHUB_ENV
working-directory: scripts/bytecode-diff
- name: Run facet upgrades based on diffs
run: |
./scripts/upgrade-facets.sh ${{ inputs.target_environment }} ${{ env.REPORT_OUT_DIR }} ${{ env.FACET_DIFF_FILE }}
working-directory: scripts/bytecode-diff
env:
BASE_RPC_URL: ${{ env.BASE_RPC_URL }}
BASE_SEPOLIA_RPC_URL: ${{ env.BASE_SEPOLIA_RPC_URL }}
BLOCKSCOUT_SEPOLIA_URL: ${{ env.BLOCKSCOUT_SEPOLIA_URL }}
BLOCKSCOUT_SEPOLIA_API_KEY: ${{ env.BLOCKSCOUT_SEPOLIA_API_KEY }}
BLOCKSCOUT_BASE_URL: ${{ env.BLOCKSCOUT_BASE_URL }}
BLOCKSCOUT_BASE_API_KEY: ${{ env.BLOCKSCOUT_BASE_API_KEY }}
BASESCAN_API_KEY: ${{ env.BASESCAN_API_KEY }}
BASESCAN_SEPOLIA_URL: ${{ env.BASESCAN_SEPOLIA_URL }}
BASESCAN_URL: ${{ env.BASESCAN_URL }}
TESTNET_PRIVATE_KEY: ${{ env.TESTNET_PRIVATE_KEY }}
OMEGA_PRIVATE_KEY: ${{ env.OMEGA_PRIVATE_KEY }}
- name: Run final html report generation w/ updated hashes
id: gen_html_report
run: |
go run main.go add-hashes ${{ inputs.target_environment }} ${{ env.REPORT_OUT_DIR }}/${{ env.FACET_DIFF_FILE }}
working-directory: scripts/bytecode-diff
env:
BASE_RPC_URL: ${{ env.BASE_RPC_URL }}
BASE_SEPOLIA_RPC_URL: ${{ env.BASE_SEPOLIA_RPC_URL }}
GOWORK: ${{ env.GOWORK }}
- name: Configure AWS credentials
if: steps.gen_html_report.outcome == 'success'
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Copy HTML report to S3
if: steps.gen_html_report.outcome == 'success'
run: |
# Find the latest hashed HTML file
HTML_FILE=$(find ${{ env.REPORT_OUT_DIR }} -name "*_hashed_*.html" | sort -r | head -n 1)
if [ -z "$HTML_FILE" ]; then
echo "Error: No HTML file found"
exit 1
fi
echo "Latest HTML file: $HTML_FILE"
# Copy to report.html
aws s3 cp $HTML_FILE s3://${{ inputs.target_environment }}-reports/report.html
# Copy to report_YYYYMMDD.html
DATED_FILENAME="report_$(date -u +%Y%m%d).html"
aws s3 cp $HTML_FILE s3://${{ inputs.target_environment }}-reports/$DATED_FILENAME
echo "HTML report copied to S3 bucket ${{ inputs.target_environment }}-reports files report.html and $DATED_FILENAME"
working-directory: scripts/bytecode-diff