Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add install script #97

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading