Skip to content

Commit

Permalink
add barge deploy check
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcos20 committed Aug 2, 2023
1 parent df4db48 commit 4d13bb6
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/deployment_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: 'CI'

on:
push:
branches:
- main
tags:
- '**'
pull_request:
branches:
- '**'

jobs:
check_deployment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Cache node_modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-test-unit-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-test-unit-${{ env.cache-name }}-
# Env var expansion workaround
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
- name: Set ADDRESS_FILE
run: echo "ADDRESS_FILE=${HOME}/.ocean/ocean-contracts/artifacts/address.json" >> $GITHUB_ENV
- name: Build local docker file
run: docker build -t 'oceanprotocol/ocean-contracts:test' .
- name: Checkout Barge
uses: actions/checkout@v3
with:
repository: 'oceanprotocol/barge'
path: 'barge'

- name: Run Ganache with Barge
working-directory: ${{ github.workspace }}/barge
run: |
bash -x start_ocean.sh --no-aquarius --no-elasticsearch --no-provider --no-dashboard 2>&1 > start_ocean.log &
env:
CONTRACTS_VERSION: test
- run: npm ci
- name: Wait for contracts deployment
working-directory: ${{ github.workspace }}/barge
run: |
for i in $(seq 1 250); do
sleep 5
[ -f "$HOME/.ocean/ocean-contracts/artifacts/ready" ] && break
done
ls -la "$HOME/.ocean/ocean-contracts/artifacts/"
- run: node scripts/check_deployment.js
29 changes: 29 additions & 0 deletions scripts/check_deployment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* eslint-disable no-unused-vars */
const fs = require('fs')

async function testDeployment() {
// load addresses file first
addresses = null
try {
addresses = JSON.parse(fs.readFileSync(process.env.ADDRESS_FILE, 'utf8'))
}
catch {
console.error("Could not load addreses files")
process.exit(1)
}
if (!('development' in addresses)) {
console.error("Missing development network")
process.exit(1)
}
keys = ["startBlock", "Router", "FixedPrice", "ERC20Template", "ERC721Template", "Dispenser", "ERC721Factory"]
for (const key of keys) {
if (!(key in addresses['development'])) {
console.error("Missing " + key + " deployment")
process.exit(1)
}
}
console.log("All good")
process.exit(0)
}

testDeployment()

0 comments on commit 4d13bb6

Please sign in to comment.