-
Notifications
You must be signed in to change notification settings - Fork 35
53 lines (50 loc) · 1.96 KB
/
define_rpc_endpoints.yaml
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
name: Verify and Define RPC Endpoints
on: [push] # Trigger the workflow on push
jobs:
check_rpc_endpoints:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- network: 'sepolia'
l1_rpc_url: "https://ci-sepolia-l1.optimism.io"
l2_rpc_url: "https://sepolia.optimism.io"
- network: 'goerli'
l1_rpc_url: "https://ci-goerli-l1.optimism.io"
l2_rpc_url: "https://goerli.optimism.io"
- network: 'mainnet'
l1_rpc_url: "https://ci-mainnet-l1.optimism.io"
l2_rpc_url: "https://mainnet.optimism.io"
outputs:
l1_rpc_url: ${{ steps.check_endpoints.outputs.l1_rpc_url }}
l2_rpc_url: ${{ steps.check_endpoints.outputs.l2_rpc_url }}
steps:
- uses: actions/checkout@v2
- name: Check RPC Endpoints
id: check_endpoints
run: |
export TIME_DIFF_THRESHOLD="30"
if ops/verify-geth-endpoint.sh "${{ matrix.l1_rpc_url }}" $TIME_DIFF_THRESHOLD; then
if ops/verify-geth-endpoint.sh "${{ matrix.l2_rpc_url }}" $TIME_DIFF_THRESHOLD; then
echo "Both RPC endpoints are up to date and not syncing."
echo "l1_rpc_url=${{ matrix.l1_rpc_url }}" >> $GITHUB_OUTPUT
echo "l2_rpc_url=${{ matrix.l2_rpc_url }}" >> $GITHUB_OUTPUT
else
echo "L2 RPC endpoint for ${{ matrix.network }} failed the checks."
exit 1
fi
else
echo "L1 RPC endpoint for ${{ matrix.network }} failed the checks."
exit 1
fi
example_mainnet_job:
needs: check_rpc_endpoints
runs-on: ubuntu-latest
steps:
- name: Use RPC URLs
run: |
L1_RPC_URL=${{ needs.check_rpc_endpoints.outputs.l1_rpc_url }}
L2_RPC_URL=${{ needs.check_rpc_endpoints.outputs.l2_rpc_url }}
echo "L1 RPC URL: $L1_RPC_URL"
echo "L2 RPC URL: $L2_RPC_URL"
# Use L1_RPC_URL and L2_RPC_URL here.