Skip to content

Commit 05e873a

Browse files
committed
build agent runner bins
1 parent 86ea334 commit 05e873a

File tree

2 files changed

+83
-136
lines changed

2 files changed

+83
-136
lines changed

.github/workflows/release.yaml

Lines changed: 45 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -4,171 +4,80 @@ on:
44
push:
55
tags:
66
- 'v*.*.*'
7-
workflow_dispatch:
87

98
jobs:
10-
publish-packages:
11-
name: Push Packages
12-
runs-on: ubuntu-20.04
13-
strategy:
14-
matrix:
15-
os: [ubuntu-latest]
16-
python-version: ["3.10"]
17-
steps:
18-
- uses: actions/checkout@v4
19-
- uses: actions/setup-python@v4
20-
with:
21-
python-version: ${{ matrix.python-versions }}
22-
- uses: addnab/docker-run-action@v3
23-
with:
24-
image: valory/open-autonomy-user:latest
25-
options: -v ${{ github.workspace }}:/work
26-
run: |
27-
echo "Pushing Packages"
28-
cd /work
29-
export AUTHOR=$(grep 'service' packages/packages.json | awk -F/ '{print $2}' | head -1)
30-
autonomy init --reset --author $AUTHOR --ipfs --remote
31-
autonomy push-all
32-
publish-images:
33-
name: Publish Docker Images
9+
build-agent-runner:
3410
runs-on: ${{ matrix.os }}
35-
needs:
36-
- "publish-packages"
3711
strategy:
3812
matrix:
39-
os: [ubuntu-latest]
40-
python-version: ["3.10"]
41-
env:
42-
DOCKER_USER: ${{secrets.DOCKER_USER}}
43-
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
13+
os: [windows-latest, macos-14, macos-14-large ]
14+
defaults:
15+
run:
16+
shell: bash
4417
steps:
45-
- uses: actions/checkout@v4
46-
with:
47-
fetch-depth: 0
48-
- name: Set up tag and vars
49-
uses: addnab/docker-run-action@v3
50-
with:
51-
image: valory/open-autonomy-user:latest
52-
options: -v ${{ github.workspace }}:/work
53-
run: |
54-
echo "Setting Tag Images"
55-
cd /work
56-
apt-get update && apt-get install git -y || exit 1
57-
git config --global --add safe.directory /work
58-
export TAG=$(git describe --exact-match --tags $(git rev-parse HEAD)) || exit 1
59-
if [ $? -eq 0 ]; then
60-
export TAG=`echo $TAG | sed 's/^v//'`
61-
else
62-
echo "You are not on a tagged branch"
63-
exit 1
64-
fi
65-
echo VERSION=$TAG> env.sh
66-
echo AUTHOR=$(grep 'service/' packages/packages.json | awk -F/ '{print $2}' | head -1) >> env.sh
67-
echo SERVICE=$(grep 'service/' packages/packages.json | awk -F/ '{print $3}' | head -1) >> env.sh
68-
echo AGENT=$(grep 'agent/' packages/packages.json | awk -F/ '{print $3}' | head -1) >> env.sh
69-
echo DEFAULT_IMAGE_TAG=$(cat packages/packages.json | grep agent/ | awk -F: '{print $2}' | tr -d '", ' | head -n 1) >> env.sh
70-
cat env.sh
71-
72-
- uses: addnab/docker-run-action@v3
73-
name: Build Images
18+
- uses: actions/checkout@v3
19+
# Set up Python with setup-python action and add it to PATH
20+
- uses: actions/setup-python@v5
21+
id: setup-python
7422
with:
75-
image: valory/open-autonomy-user:latest
76-
options: -v ${{ github.workspace }}:/work
77-
shell: bash
78-
run: |
79-
echo "Building Docker Images"
80-
cd /work
81-
pip install --upgrade poetry
82-
poetry install
83-
source env.sh || exit 1
84-
echo "Building images for $AUTHOR for service $SERVICE"
85-
autonomy init --reset --author $AUTHOR --ipfs --remote
86-
autonomy fetch $AUTHOR/$SERVICE --service --local || exit 1
87-
cd $SERVICE || exit 1
88-
autonomy build-image || exit 1
89-
autonomy build-image --version $VERSION || exit 1
23+
python-version: "3.10"
9024

91-
- name: Docker login
25+
- name: Add Python to PATH
9226
run: |
93-
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USER --password-stdin
94-
- name: Docker Push
95-
run: |
96-
source env.sh
97-
98-
echo "Re-tagging $AUTHOR/oar-$AGENT:$VERSION -> $DOCKER_USER/oar-$AGENT:$VERSION"
99-
docker tag $AUTHOR/oar-$AGENT:$VERSION $DOCKER_USER/oar-$AGENT:$VERSION
100-
101-
echo "Pushing $DOCKER_USER/oar-$AGENT:$VERSION"
102-
docker push $DOCKER_USER/oar-$AGENT:$VERSION
103-
104-
echo "Re-tagging $AUTHOR/oar-$AGENT:$DEFAULT_IMAGE_TAG -> $DOCKER_USER/oar-$AGENT:$DEFAULT_IMAGE_TAG"
105-
docker tag $AUTHOR/oar-$AGENT:$DEFAULT_IMAGE_TAG $DOCKER_USER/oar-$AGENT:$DEFAULT_IMAGE_TAG
106-
107-
echo "Pushing $DOCKER_USER/oar-$AGENT:$DEFAULT_IMAGE_TAG"
108-
docker push $DOCKER_USER/oar-$AGENT:$DEFAULT_IMAGE_TAG
109-
110-
111-
build-macos-pyinstaller:
112-
runs-on: ${{ matrix.os }}
113-
strategy:
114-
matrix:
115-
os: [ macos-14, macos-14-large ]
116-
117-
steps:
118-
- uses: actions/checkout@v3
119-
- uses: actions/setup-python@v4
120-
with:
121-
python-version: '3.10'
27+
echo "${{ steps.setup-python.outputs.python-path }}" >> $GITHUB_PATH
12228
12329
- name: Install and configure Poetry
124-
uses: snok/install-poetry@v1
125-
with:
126-
version: '1.4.0'
127-
virtualenvs-create: true
128-
virtualenvs-in-project: false
129-
virtualenvs-path: ~/my-custom-path
130-
installer-parallel: true
131-
132-
- name: Install dependencies
133-
run: poetry install
134-
135-
- name: Set arch environment variable for macos-latest-large
136-
if: contains(matrix.os, 'large')
137-
run: echo "OS_ARCH=x64" >> $GITHUB_ENV
30+
run: pip install poetry
13831

139-
- name: Set arch environment variable for other macOS versions
140-
if: ${{ !contains(matrix.os, 'large') }}
141-
run: echo "OS_ARCH=arm64" >> $GITHUB_ENV
142-
143-
- name: Build with PyInstaller
32+
- name: Build Agent Runner
14433
run: |
145-
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 --collect-all twikit --collect-all twitter_text_parser --collect-all textblob --onefile pyinstaller/memeooorr_bin.py --name memeooorr_bin_${{env.OS_ARCH}}
146-
- name: Upload Release Assets
34+
make build-agent-runner
35+
36+
- name: rename the file
37+
if: runner.os != 'Windows'
38+
run: |
39+
export FILENAME=`echo -n agent_runner_${{runner.os}}_${{runner.arch}}|tr '[:upper:]' '[:lower:]'`
40+
echo "FILENAME=$FILENAME" >> $GITHUB_ENV;
41+
mv dist/agent_runner_bin dist/${FILENAME}
42+
43+
- name: rename the file
44+
if: runner.os == 'Windows'
45+
run: |
46+
export FILENAME=`echo -n agent_runner_${{runner.os}}_${{runner.arch}}.exe|tr '[:upper:]' '[:lower:]'`
47+
echo "FILENAME=$FILENAME" >> $GITHUB_ENV;
48+
mv dist/agent_runner_bin.exe dist/${FILENAME}
49+
50+
- name: Upload Release Assets Windows
14751
uses: actions/upload-artifact@v4
14852
with:
149-
name: memeooorr_bin_${{env.OS_ARCH}}
150-
path: dist/memeooorr_bin_${{env.OS_ARCH}}
53+
name: ${{env.FILENAME}}
54+
path: dist/${{env.FILENAME}}
15155

15256
upload-assets:
153-
needs: build-macos-pyinstaller
57+
needs: build-agent-runner
15458
runs-on: ubuntu-latest
155-
15659
steps:
15760
- name: Download artifacts
15861
uses: actions/download-artifact@v4
15962
with:
160-
name: memeooorr_bin_x64
63+
name: agent_runner_macos_x64
16164
path: ./dist/
65+
16266
- name: Download artifacts
16367
uses: actions/download-artifact@v4
16468
with:
165-
name: memeooorr_bin_arm64
69+
name: agent_runner_macos_arm64
16670
path: ./dist/
167-
71+
- name: Download artifacts
72+
uses: actions/download-artifact@v4
73+
with:
74+
name: agent_runner_windows_x64.exe
75+
path: ./dist/
76+
- name: List files
77+
run: ls ./dist/
16878
- name: Publish Release
16979
uses: softprops/action-gh-release@v2
17080
if: startsWith(github.ref, 'refs/tags/')
17181
with:
17282
files: |
173-
./dist/memeooorr_bin_x64
174-
./dist/memeooorr_bin_arm64
83+
./dist/agent_runner*

Makefile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,41 @@ bump-packages:
142142

143143

144144
v := $(shell pip -V | grep virtualenvs)
145+
146+
147+
148+
.PHONY: build-agent-runner
149+
build-agent-runner:
150+
poetry lock
151+
poetry install
152+
poetry run pyinstaller \
153+
--collect-data eth_account \
154+
--collect-all aea \
155+
--collect-all aea_ledger_ethereum \
156+
--collect-all aea_ledger_cosmos \
157+
--collect-all aea_ledger_ethereum_flashbots \
158+
--collect-all asn1crypto \
159+
--collect-all autonomy \
160+
--collect-all backports.tarfile \
161+
--collect-all google.protobuf \
162+
--collect-all openapi_core \
163+
--collect-all openapi_spec_validator \
164+
--collect-all google.generativeai \
165+
--collect-all js2py \
166+
--collect-all peewee \
167+
--collect-all textblob \
168+
--collect-all twikit \
169+
--collect-all twitter_text \
170+
--collect-all twitter_text_parser \
171+
--hidden-import aea_ledger_ethereum \
172+
--hidden-import aea_ledger_cosmos \
173+
--hidden-import aea_ledger_ethereum_flashbots \
174+
--hidden-import grpc \
175+
--hidden-import openapi_core \
176+
--hidden-import py_ecc \
177+
--hidden-import pytz \
178+
--onefile pyinstaller/memeooorr_bin.py \
179+
--name agent_runner_bin
180+
181+
./dist/agent_runner_bin 1>/dev/null
182+

0 commit comments

Comments
 (0)