Skip to content

Commit

Permalink
Update CI to use pdr instead of scripts/ (#399)
Browse files Browse the repository at this point in the history
* Update check script CI

* Update cron topup

* Workflow dispatch

* Nevermind, revert previous commit

* Run on push to test

* Pass ppss.web3_pp instead of web3_config

* Don't run on push
  • Loading branch information
trizin authored Nov 24, 2023
1 parent b46cd81 commit 40a478b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/check_mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ jobs:
pip install -r requirements.txt
- name: Notify Slack
env:
RPC_URL: "https://sapphire.oasis.io"
SUBGRAPH_URL: "https://v4.subgraph.sapphire-mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph"
PRIVATE_KEY: "0xb23c44b8118eb7a7f70d21b0d20aed9b05d85d22ac6a0e57697c564da1c35554"
run: |
output=$(python scripts/check_network.py 1 | grep -E 'FAIL|WARNING|error' || true)
output=$(python pdr check_network ppss.yaml sapphire-mainnet | grep -E 'FAIL|WARNING|error' || true)
fact=$(curl -s https://catfact.ninja/fact | jq -r '.fact')
if [ -z "$output" ]; then
echo "No output, so no message will be sent to Slack"
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/check_testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ jobs:
pip install -r requirements.txt
- name: Notify Slack
env:
RPC_URL: "https://testnet.sapphire.oasis.dev"
SUBGRAPH_URL: "https://v4.subgraph.sapphire-testnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph"
PRIVATE_KEY: "0xb23c44b8118eb7a7f70d21b0d20aed9b05d85d22ac6a0e57697c564da1c35554"
run: |
output=$(python scripts/check_network.py 1 | grep -E 'FAIL|WARNING|error' | grep -v "1h" || true)
output=$(python pdr check_network ppss.yaml sapphire-testnet | grep -E 'FAIL|WARNING|error' | grep -v "1h" || true)
joke=$(curl -s https://official-joke-api.appspot.com/jokes/general/random | jq -r '.[0].setup, .[0].punchline')
if [ -z "$output" ]; then
echo "No output, so no message will be sent to Slack"
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/cron_topup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Topup accounts
on:
schedule:
- cron: "0 * * * *"

jobs:
topup-mainnet:
runs-on: ubuntu-latest
Expand All @@ -22,11 +22,9 @@ jobs:
pip install -r requirements.txt
- name: Set env variables
run: |
echo "SUBGRAPH_URL=http://v4.subgraph.sapphire-mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph" >> $GITHUB_ENV
echo "RPC_URL=https://sapphire.oasis.io" >> $GITHUB_ENV
echo "PRIVATE_KEY=${{ secrets.TOPUP_SCRIPT_PK }}" >> $GITHUB_ENV
- name: Run top-up script
run: python3 scripts/topup.py
run: python3 pdr topup ppss.yaml sapphire-mainnet

topup-testnet:
runs-on: ubuntu-latest
Expand All @@ -43,8 +41,6 @@ jobs:
pip install -r requirements.txt
- name: Set env variables
run: |
echo "SUBGRAPH_URL=http://v4.subgraph.sapphire-testnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph" >> $GITHUB_ENV
echo "RPC_URL=https://testnet.sapphire.oasis.dev" >> $GITHUB_ENV
echo "PRIVATE_KEY=${{ secrets.TOPUP_SCRIPT_PK }}" >> $GITHUB_ENV
- name: Run top-up script
run: python3 scripts/topup.py
run: python3 pdr topup ppss.yaml sapphire-testnet
4 changes: 2 additions & 2 deletions pdr_backend/util/topup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def topup_main(ppss: PPSS):
print("Unknown network")
sys.exit(1)

OCEAN = Token(web3_config, OCEAN_TOKEN_ADDRS[chain_id])
ROSE = NativeToken(web3_config)
OCEAN = Token(ppss.web3_pp, OCEAN_TOKEN_ADDRS[chain_id])
ROSE = NativeToken(ppss.web3_pp)

owner_OCEAN_bal = int(OCEAN.balanceOf(web3_config.owner)) / 1e18
owner_ROSE_bal = int(ROSE.balanceOf(web3_config.owner)) / 1e18
Expand Down

0 comments on commit 40a478b

Please sign in to comment.