Skip to content

Commit 09761d4

Browse files
gfournierProCopilotLe-Caignecgithub-actions[bot]
authored
feat: configuring bridges contracts on CI (#81)
Co-authored-by: Copilot <[email protected]> Co-authored-by: Robin Le Caignec <[email protected]> Co-authored-by: GitHub Actions Bot <github-actions[bot]@users.noreply.github.com>
1 parent 9029aa7 commit 09761d4

File tree

2 files changed

+82
-1
lines changed

2 files changed

+82
-1
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Configure Bridges
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
network_type:
7+
description: 'Network type to configure'
8+
required: true
9+
type: choice
10+
options:
11+
- testnets
12+
- mainnets
13+
default: 'testnets'
14+
15+
jobs:
16+
setup-matrix:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
matrix: ${{ steps.set-matrix.outputs.matrix }}
20+
steps:
21+
- name: Set matrix based on network type
22+
id: set-matrix
23+
run: |
24+
if [ "${{ github.event.inputs.network_type }}" == "testnets" ]; then
25+
MATRIX='[
26+
{
27+
"source_chain": "sepolia",
28+
"target_chain": "arbitrum_sepolia"
29+
},
30+
{
31+
"source_chain": "arbitrum_sepolia",
32+
"target_chain": "sepolia"
33+
}
34+
]'
35+
else
36+
MATRIX='[
37+
{
38+
"source_chain": "ethereum",
39+
"target_chain": "arbitrum"
40+
},
41+
{
42+
"source_chain": "arbitrum",
43+
"target_chain": "ethereum"
44+
}
45+
]'
46+
fi
47+
48+
# Convertir en une ligne pour GitHub Output
49+
echo "matrix=$(echo "$MATRIX" | jq -c .)" >> $GITHUB_OUTPUT
50+
51+
configure-bridges:
52+
needs: setup-matrix
53+
runs-on: ubuntu-latest
54+
strategy:
55+
matrix:
56+
include: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
57+
fail-fast: false
58+
concurrency:
59+
group: configure-bridges-${{ matrix.source_chain }}-${{ matrix.target_chain }}
60+
cancel-in-progress: true
61+
env:
62+
CI: true
63+
environment: ${{ matrix.source_chain }}
64+
steps:
65+
- uses: actions/checkout@v4
66+
with:
67+
submodules: recursive
68+
69+
- name: Install Foundry
70+
uses: foundry-rs/foundry-toolchain@v1
71+
with:
72+
version: stable
73+
cache: true
74+
75+
- name: Configure bridge from ${{ matrix.source_chain }} to ${{ matrix.target_chain }}
76+
env:
77+
ADMIN_PRIVATE_KEY: ${{ secrets.ADMIN_PRIVATE_KEY }}
78+
SOURCE_CHAIN: ${{ matrix.source_chain }}
79+
TARGET_CHAIN: ${{ matrix.target_chain }}
80+
RPC_URL: ${{ secrets.RPC_URL }}
81+
run: make configure-bridge

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ configure-bridge: # SOURCE_CHAIN, TARGET_CHAIN, RPC_URL
147147
SOURCE_CHAIN=$(SOURCE_CHAIN) TARGET_CHAIN=$(TARGET_CHAIN) \
148148
forge script script/bridges/layerZero/IexecLayerZeroBridge.s.sol:Configure \
149149
--rpc-url $(RPC_URL) \
150-
--account $(ACCOUNT) \
150+
$$(if [ "$(CI)" = "true" ]; then echo "--private-key $(ADMIN_PRIVATE_KEY)"; else echo "--account $(ACCOUNT)"; fi) \
151151
--broadcast \
152152
-vvv
153153

0 commit comments

Comments
 (0)