Skip to content

Commit

Permalink
adds a prelim mech quickstart scripting
Browse files Browse the repository at this point in the history
  • Loading branch information
KahanMajmudar committed Nov 19, 2024
0 parents commit 07d3c48
Show file tree
Hide file tree
Showing 72 changed files with 23,913 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FORK_URL=
NODE_ENV=
DEV_RPC=
STAKING_TEST_KEYS_PATH=
IS_STAGING=
35 changes: 35 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# TBA
name: Backend

on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v2

# Node.js (for package scripts)
- uses: actions/setup-node@v4
with:
node-version: lts/*

# Python
- uses: actions/setup-python@v4
with:
python-version: "3.10"

- uses: snok/install-poetry@v1
with:
version: "1.7.1"
virtualenvs-create: true
virtualenvs-in-project: false
virtualenvs-path: ~/my-custom-path
installer-parallel: true

# Install backend dependencies
- run: yarn install:backend

# Run backend
# - run: yarn dev:backend
50 changes: 50 additions & 0 deletions .github/workflows/common_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "Common Checks"
on:
push:
branches:
- develop
- main
pull_request:
jobs:
linter_checks:
continue-on-error: False
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.10.9"]
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@master
with:
python-version: ${{ matrix.python-version }}
- uses: actions/setup-go@v3
with:
go-version: "1.17.7"
- name: Install dependencies
run: |
sudo apt-get update --fix-missing
sudo apt-get autoremove
sudo apt-get autoclean
pip install tomte[tox]==0.2.15
pip install --user --upgrade setuptools
sudo npm install -g markdown-spellcheck
- name: Security checks
run: |
tox -p -e bandit -e safety
- name: Code style check
run: |
tox -p -e black-check -e isort-check
- name: Flake7
run: |
tox -e flake8
- name: Pylint
run: tox -e pylint
- name: Static type check
run: tox -e mypy
# - name: Check spelling
# run: tox -e spell-check
# - name: License compatibility check
# run: tox -e liccheck
# tox -p -e vulture -e darglint
22 changes: 22 additions & 0 deletions .github/workflows/gitleaks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Gitleaks
on:
pull_request:
push:
branches:
- main
jobs:
scan:
name: gitleaks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: "1.17.7"
- run: |
wget https://github.com/zricethezav/gitleaks/releases/download/v8.10.1/gitleaks_8.10.1_linux_x64.tar.gz && \
tar -xzf gitleaks_8.10.1_linux_x64.tar.gz && \
sudo install gitleaks /usr/bin && \
gitleaks detect --report-format json --report-path leak_report -v
135 changes: 135 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Release

# This workflow is triggered on pushing a tag BE CAREFUL this application AUTO UPDATES !!!
# git tag vX.Y.Z
# git push origin tag vX.Y.Z

on:
push:
tags:
- 'v*.*.*'

jobs:
build-macos-pyinstaller:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-14, macos-14-large ]

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: '1.4.0'
virtualenvs-create: true
virtualenvs-in-project: false
virtualenvs-path: ~/my-custom-path
installer-parallel: true

- name: Install dependencies
run: poetry install

- name: Set arch environment variable for macos-latest-large
if: contains(matrix.os, 'large')
run: echo "OS_ARCH=x64" >> $GITHUB_ENV

- name: Set arch environment variable for other macOS versions
if: ${{ !contains(matrix.os, 'large') }}
run: echo "OS_ARCH=arm64" >> $GITHUB_ENV

- name: Get trader bin
run: |
trader_version=$(poetry run python -c "import yaml; config = yaml.safe_load(open('templates/trader.yaml')); print(config['service_version'])")
echo $trader_version
mkdir dist && curl -L -o dist/aea_bin "https://github.com/valory-xyz/trader/releases/download/${trader_version}/trader_bin_${{ env.OS_ARCH }}"
- name: Build with PyInstaller
run: |
poetry run pyinstaller operate/services/utils/tendermint.py --onefile
poetry run pyinstaller --collect-data eth_account --collect-all aea --collect-all autonomy --collect-all operate --collect-all aea_ledger_ethereum --collect-all aea_ledger_cosmos --collect-all aea_ledger_ethereum_flashbots --hidden-import aea_ledger_ethereum --hidden-import aea_ledger_cosmos --hidden-import aea_ledger_ethereum_flashbots operate/pearl.py --add-binary dist/aea_bin:. --add-binary dist/tendermint:. --onefile --name pearl_${{ env.OS_ARCH }}
- name: Upload Release Assets
uses: actions/upload-artifact@v2
with:
name: pearl_${{ env.OS_ARCH }}
path: dist/pearl_${{ env.OS_ARCH }}

release-operate:
runs-on: macos-latest
needs:
- "build-macos-pyinstaller"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: pearl_x64
path: electron/bins/
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: pearl_arm64
path: electron/bins/
- name: Add exec permissions
run: chmod +x electron/bins/pearl_x64 && chmod +x electron/bins/pearl_arm64
- uses: snok/install-poetry@v1
with:
version: "1.7.1"
virtualenvs-create: true
virtualenvs-in-project: false
virtualenvs-path: ~/my-custom-path
installer-parallel: true
- run: yarn install-deps
- name: "Build frontend with env vars"
run: yarn build:frontend
env:
NODE_ENV: production
DEV_RPC: https://rpc-gate.autonolas.tech/gnosis-rpc/
IS_STAGING: ${{ github.ref != 'refs/heads/main' && 'true' || 'false' }}
FORK_URL: https://rpc-gate.autonolas.tech/gnosis-rpc/
- run: rm -rf /dist
- name: "Build, notarize, publish"
env:
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLEIDPASS }}
APPLE_ID: ${{ secrets.APPLEID }}
APPLETEAMID: ${{ secrets.APPLETEAMID }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
CSC_LINK: ${{ secrets.CSC_LINK }}
GH_TOKEN: ${{ secrets.github_token}}
NODE_ENV: production
DEV_RPC: https://rpc-gate.autonolas.tech/gnosis-rpc/
FORK_URL: https://rpc-gate.autonolas.tech/gnosis-rpc/
run: node build.js
- name: "Build frontend with dev env vars"
run: yarn build:frontend
env:
NODE_ENV: development
DEV_RPC: https://virtual.gnosis.rpc.tenderly.co/78ca845d-2b24-44a6-9ce2-869a979e8b5b
IS_STAGING: ${{ github.ref != 'refs/heads/main' && 'true' || 'false' }}
FORK_URL: https://virtual.gnosis.rpc.tenderly.co/78ca845d-2b24-44a6-9ce2-869a979e8b5b
- name: "Build, notarize, publish dev build"
env:
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLEIDPASS }}
APPLE_ID: ${{ secrets.APPLEID }}
APPLETEAMID: ${{ secrets.APPLETEAMID }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
CSC_LINK: ${{ secrets.CSC_LINK }}
GH_TOKEN: ${{ secrets.github_token}}
NODE_ENV: development
DEV_RPC: https://virtual.gnosis.rpc.tenderly.co/78ca845d-2b24-44a6-9ce2-869a979e8b5b
FORK_URL: https://virtual.gnosis.rpc.tenderly.co/78ca845d-2b24-44a6-9ce2-869a979e8b5b
run: |
echo "DEV_RPC=https://virtual.gnosis.rpc.tenderly.co/78ca845d-2b24-44a6-9ce2-869a979e8b5b" >> .env
echo -e "FORK_URL=https://virtual.gnosis.rpc.tenderly.co/78ca845d-2b24-44a6-9ce2-869a979e8b5b" >> .env
node build.js
57 changes: 57 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz
frontend/node_modules

# next.js
frontend/.next/
frontend/out/
frontend/.swc/

# production
frontend/build

# local env files
.env
.env*.local
.DS_STORE

# python
.tox/
.operate/
.operate*/
__pycache__/
data/
backend/temp/
backend/tmp/

tmp/
temp/

!operate/data
electron/.next

dist/
build/

cache
leak_report

*.dist
*.build
/electron/bins/

# logs
*.log
/.optimus/

.mech_quickstart/

local_config.json

mech.db

Loading

0 comments on commit 07d3c48

Please sign in to comment.