Skip to content

Commit

Permalink
Merge pull request #97 from el-tumero/install
Browse files Browse the repository at this point in the history
add install script
  • Loading branch information
el-tumero authored Aug 7, 2024
2 parents 16fc909 + 0ab4860 commit b71de03
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 13 deletions.
31 changes: 18 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,22 @@ jobs:
- name: Install yarn
run: npm i -g yarn

- name: Deploy local contract & setup data
- name: Setup project
run: |
cd contracts
yarn
yarn hardhat compile
yarn hardhat node > /dev/null 2>&1 &
yarn deploy:local
yarn cand
- name: Build website
run: |
cd frontend
yarn
yarn build
chmod +x ./install.sh
./install.sh
# - name: Deploy local contract & setup data
# run: |
# cd contracts
# yarn
# yarn hardhat compile
# yarn hardhat node > /dev/null 2>&1 &
# yarn deploy:local
# yarn cand

# - name: Build website
# run: |
# cd frontend
# yarn
# yarn build
43 changes: 43 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# Script for setting up the project
# This script assumes a unix environment
# Last modified: 07/08/2024

cmd_exists() {
command -v "$1" &> /dev/null
}

if ! cmd_exists yarn; then
echo "Error: yarn is not installed or not in PATH"; exit 1
fi

if ! cmd_exists forge; then
echo "Error: forge (Foundry) is not installed or not in PATH"; exit 1
fi

require_ok() {
if [ $? -ne 0 ]; then
echo "Error: $1 failed"
exit 1
fi
}

cd contracts
yarn --dev
require_ok "yarn install in contracts"
npx hardhat compile
require_ok "hardhat compile"
yarn cand
require_ok "generate candidates"
yarn types
require_ok "generate web types"
yarn local-node &
HH_NODE_PID=$!
yarn deploy:local
require_ok "hardhat localhost deploy"

cd ../frontend
yarn --dev
echo "Setup complete. Run web locally with: 'cd frontend && yarn dev:test'"
kill $HH_NODE_PID

0 comments on commit b71de03

Please sign in to comment.