Skip to content

Commit

Permalink
Merge pull request #538 from valory-xyz/fix/dedicated-executables-for…
Browse files Browse the repository at this point in the history
…-backend

extract aea_bin and tendermint exec from the pearl exec
  • Loading branch information
solarw authored Dec 5, 2024
2 parents d01cd6d + f0103bc commit fcbb415
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 17 deletions.
36 changes: 33 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,34 @@ jobs:

- name: Build with PyInstaller
run: |
poetry run pyinstaller operate/services/utils/tendermint.py --onefile --name tendermint_mac
poetry run pyinstaller operate/services/utils/tendermint.py --onefile
cp dist/tendermint dist/tendermint_bin
# patch open aea in place
rm -fr ./open-aea
git clone https://github.com/valory-xyz/open-aea.git -b fix/1.5.2_encoding
poetry run pip install ./open-aea/
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_mac:. --onefile --name pearl_${{ env.OS_ARCH }}
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 --onefile --name pearl_${{ env.OS_ARCH }}
- name: Upload Release Assets
uses: actions/upload-artifact@v4
with:
name: pearl_${{ env.OS_ARCH }}
path: dist/pearl_${{ env.OS_ARCH }}

- name: Upload Tendermint
uses: actions/upload-artifact@v4
with:
name: tendermint_${{ env.OS_ARCH }}
path: dist/tendermint_bin

- name: Upload aea
uses: actions/upload-artifact@v4
with:
name: aea_bin_${{ env.OS_ARCH }}
path: ./dist/aea_bin

# Jobs for production and development, running separately for x64 and arm64
build-release:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -121,6 +134,23 @@ jobs:
with:
name: pearl_${{ env.OS_ARCH }}
path: electron/bins/

- name: Download aea binary for architecture
uses: actions/download-artifact@v4
with:
name: aea_bin_${{ env.OS_ARCH }}
path: electron/bins/

- name: Download tendermint binary for architecture
uses: actions/download-artifact@v4
with:
name: tendermint_${{ env.OS_ARCH }}
path: electron/bins/

# Configure Yarn network settings for timeout, retries, and reduced concurrency
- name: Configure Yarn network settings
run: |
ls electron/bins/
# download TM
- name: Set architecture environment variable
Expand All @@ -138,7 +168,7 @@ jobs:
# Add execution permissions to the binaries
- name: Add exec permissions
run: chmod +x electron/bins/pearl_${{ env.OS_ARCH }}
run: chmod +x electron/bins/*

# Cache electron node_modules with unique key for each environment and architecture
- name: Restore electron node_modules cache
Expand Down
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ endef
pwd
git clone https://github.com/valory-xyz/trader.git

./dist/aea_win.exe: ./trader/
./dist/aea_win.exe: ./electron/bins/ ./trader/
mkdir -p dist
cd trader && poetry install && rm -fr ./open-aea && git clone https://github.com/valory-xyz/open-aea.git -b fix/1.5.2_encoding && poetry run pip install ./open-aea/ && 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 --hidden-import grpc --hidden-import openapi_core --collect-all google.protobuf --collect-all openapi_core --collect-all openapi_spec_validator --collect-all asn1crypto --hidden-import py_ecc --hidden-import pytz --onefile pyinstaller/trader_bin.py --name trader_win
cp -f trader/dist/trader_win.exe ./dist/aea_win.exe
cp -f trader/dist/trader_win.exe ./electron/bins/aea_win.exe
pwd


Expand All @@ -25,14 +26,15 @@ endef
pwd


./dist/tendermint_win.exe: ./operate/
./dist/tendermint_win.exe: ./electron/bins/ ./operate/
pwd
poetry install && poetry run pyinstaller operate/services/utils/tendermint.py --onefile --name tendermint_win
cp dist/tendermint_win.exe ./electron/bins/tendermint_win.exe


./dist/pearl_win.exe: ./operate/ ./dist/aea_win.exe ./dist/tendermint_win.exe
pwd
poetry install && rm -fr ./open-aea && git clone https://github.com/valory-xyz/open-aea.git -b fix/1.5.2_encoding && poetry run pip install ./open-aea/ && poetry run pyinstaller --collect-data eth_account --collect-all aea --collect-all coincurve --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_win.exe:. --add-binary dist/tendermint_win.exe:. --onefile --name pearl_win
poetry install && rm -fr ./open-aea && git clone https://github.com/valory-xyz/open-aea.git -b fix/1.5.2_encoding && poetry run pip install ./open-aea/ && poetry run pyinstaller --collect-data eth_account --collect-all aea --collect-all coincurve --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 --onefile --name pearl_win


./electron/bins/:
Expand Down
13 changes: 4 additions & 9 deletions operate/services/deployment_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,13 @@ class PyInstallerHostDeploymentRunner(BaseDeploymentRunner):
@property
def _aea_bin(self) -> str:
"""Return aea_bin path."""
abin = str(Path(sys._MEIPASS) / "aea_bin") # type: ignore # pylint: disable=protected-access
abin = str(Path(os.path.dirname(sys.executable)) / "aea_bin") # type: ignore # pylint: disable=protected-access
return abin

@property
def _tendermint_bin(self) -> str:
"""Return tendermint path."""
return str(Path(sys._MEIPASS) / "tendermint") # type: ignore # pylint: disable=protected-access
return str(Path(os.path.dirname(sys.executable)) / "tendermint_bin") # type: ignore # pylint: disable=protected-access

def _start_agent(self) -> None:
"""Start agent process."""
Expand Down Expand Up @@ -303,25 +303,20 @@ def _start_tendermint(self) -> None:
class PyInstallerHostDeploymentRunnerMac(PyInstallerHostDeploymentRunner):
"""Mac deployment runner."""

@property
def _tendermint_bin(self) -> str:
"""Return tendermint path."""
return str(Path(sys._MEIPASS) / "tendermint_mac") # type: ignore # pylint: disable=protected-access


class PyInstallerHostDeploymentRunnerWindows(PyInstallerHostDeploymentRunner):
"""Windows deployment runner."""

@property
def _aea_bin(self) -> str:
"""Return aea_bin path."""
abin = str(Path(sys._MEIPASS) / "aea_win.exe") # type: ignore # pylint: disable=protected-access
abin = str(Path(os.path.dirname(sys.executable)) / "aea_win.exe") # type: ignore # pylint: disable=protected-access
return abin

@property
def _tendermint_bin(self) -> str:
"""Return tendermint path."""
return str(Path(sys._MEIPASS) / "tendermint_win.exe") # type: ignore # pylint: disable=protected-access
return str(Path(os.path.dirname(sys.executable)) / "tendermint_win.exe") # type: ignore # pylint: disable=protected-access


class HostPythonHostDeploymentRunner(BaseDeploymentRunner):
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@
"download-binaries": "sh download_binaries.sh",
"build:pearl": "sh build_pearl.sh"
},
"version": "0.1.0-rc209"
"version": "0.1.0-rc212"
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "olas-operate-middleware"
version = "0.1.0-rc209"
version = "0.1.0-rc212"
description = ""
authors = ["David Vilela <[email protected]>", "Viraj Patel <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit fcbb415

Please sign in to comment.