-
Notifications
You must be signed in to change notification settings - Fork 1
115 lines (105 loc) · 3.83 KB
/
cron.canary.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
name: CronJob - Op Mainnet (deprecated)
on:
schedule:
- cron: "5 */6 * * *" # ie. 6:05am, 12:05pm, 6:05pm, etc.
push:
env:
FWC_RPC_URL: ${{secrets.OPTIMISM_RPC_URL}}
OPTIMISM_MAINNET_RPC_URL: ${{secrets.OPTIMISM_MAINNET_RPC_URL}}
NODE_OPTIONS: "--max_old_space_size=32768"
permissions: write-all
jobs:
runCLI:
name: Winners Compute
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 1
matrix:
node: ["20.11.1"]
os: [ubuntu-latest]
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: recursive
- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Clone foundry-winner-calc repo
uses: actions/checkout@master
with:
repository: GenerationSoftware/foundry-winner-calc
path: './foundry-winner-calc'
# -------------------------------------------------------- #
# Optimism
# -------------------------------------------------------- #
# 1. Install
- name: Install PoolTogether V5 CLI
run: |
npm install -g @generationsoftware/[email protected]
echo "$(npm -g bin)" >> $GITHUB_PATH
# 2. Compute JSON input files (vault accounts)
- name: Optimism Vault Accounts
id: vaultAccountsOptimism
uses: chuckbergeron/executable-wrapper@e19cd743c8f0c6af006f6a25bd6715c770569d72
continue-on-error: true
with:
working-directory: ./foundry-winner-calc
run_command: ptv5 compute vaultAccounts -o ./vaultAccounts -p 0xe32e5E1c5f0c80bD26Def2d0EA5008C107000d6A -c 10
# 3. Install package deps, build contracts
- name: Install deps and compile
run: |
cd ./foundry-winner-calc
npm install
npm run build
cd sol
forge install
forge build
cd ..
# 4. Store list of input JSON files in variable
- name: Finding files
working-directory: ./foundry-winner-calc
run: |
{
echo 'FILELIST<<EOF'
find ./vaultAccounts -type f -name '0x*.json' -print
echo EOF
} >> "$GITHUB_ENV"
# 5. Loop through vault input files, compute winners
- name: Iterate vaults
id: processVaults
working-directory: ./foundry-winner-calc
run: |
for i in $FILELIST; do
echo "Processing: ${i}"
node index.js ${i} ../winners/${i}
done
# 6. Concat winner output files into 1 winners.json file
- name: Concat Winner Files
uses: chuckbergeron/executable-wrapper@e19cd743c8f0c6af006f6a25bd6715c770569d72
continue-on-error: true
with:
working-directory: ./winners
run_command: ptv5 utils concatWinners -o ./vaultAccounts -p 0xe32e5E1c5f0c80bD26Def2d0EA5008C107000d6A -c 10
# 7. Commit
- name: Commit Optimism
if: steps.vaultAccountsOptimism.outputs.runStatus == 'true'
continue-on-error: true
run: |
git config pull.rebase false
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git pull
git add ./winners
git commit -m "Add mainnet (deprecated) winner results for Optimism draw #${{steps.vaultAccountsOptimism.outputs.drawId}}"
# 8. Push
- name: Push changes (if required)
uses: ad-m/github-push-action@master
if: steps.vaultAccountsOptimism.outputs.runStatus == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
force: true