6
6
- ' v*.*.*'
7
7
8
8
jobs :
9
- publish-packages :
10
- name : Push Packages
11
- runs-on : ubuntu-20.04
12
- strategy :
13
- matrix :
14
- os : [ubuntu-latest]
15
- python-version : ["3.10"]
16
- steps :
17
- - uses : actions/checkout@v4
18
- - uses : actions/setup-python@v4
19
- with :
20
- python-version : ${{ matrix.python-versions }}
21
- - uses : addnab/docker-run-action@v3
22
- with :
23
- image : valory/open-autonomy-user:latest
24
- options : -v ${{ github.workspace }}:/work
25
- run : |
26
- echo "Pushing Packages"
27
- cd /work
28
- export AUTHOR=$(grep 'service' packages/packages.json | awk -F/ '{print $2}' | head -1)
29
- autonomy init --reset --author $AUTHOR --ipfs --remote
30
- autonomy push-all
31
- publish-images :
32
- name : Publish Docker Images
33
- runs-on : ${{ matrix.os }}
34
- needs :
35
- - " publish-packages"
36
- strategy :
37
- matrix :
38
- os : [ubuntu-latest]
39
- python-version : ["3.10"]
40
- env :
41
- DOCKER_USER : ${{secrets.DOCKER_USER}}
42
- DOCKER_PASSWORD : ${{secrets.DOCKER_PASSWORD}}
43
- steps :
44
- - uses : actions/checkout@v4
45
- with :
46
- fetch-depth : 0
47
- - name : Set up tag and vars
48
- uses : addnab/docker-run-action@v3
49
- with :
50
- image : valory/open-autonomy-user:latest
51
- options : -v ${{ github.workspace }}:/work
52
- run : |
53
- echo "Setting Tag Images"
54
- cd /work
55
- apt-get update && apt-get install git -y || exit 1
56
- git config --global --add safe.directory /work
57
- export TAG=$(git describe --exact-match --tags $(git rev-parse HEAD)) || exit 1
58
- if [ $? -eq 0 ]; then
59
- export TAG=`echo $TAG | sed 's/^v//'`
60
- else
61
- echo "You are not on a tagged branch"
62
- exit 1
63
- fi
64
- echo VERSION=$TAG> env.sh
65
- echo AUTHOR=$(grep 'service/' packages/packages.json | awk -F/ '{print $2}' | head -1) >> env.sh
66
- echo SERVICE=$(grep 'service/' packages/packages.json | awk -F/ '{print $3}' | head -1) >> env.sh
67
- echo AGENT=$(grep 'agent/' packages/packages.json | awk -F/ '{print $3}' | head -1) >> env.sh
68
- echo DEFAULT_IMAGE_TAG=$(cat packages/packages.json | grep agent/ | awk -F: '{print $2}' | tr -d '", ' | head -n 1) >> env.sh
69
- cat env.sh
70
-
71
- - uses : addnab/docker-run-action@v3
72
- name : Build Images
73
- with :
74
- image : valory/open-autonomy-user:latest
75
- options : -v ${{ github.workspace }}:/work
76
- shell : bash
77
- run : |
78
- echo "Building Docker Images"
79
- cd /work
80
- pip install --upgrade poetry
81
- poetry install
82
- source env.sh || exit 1
83
- echo "Building images for $AUTHOR for service $SERVICE"
84
- autonomy init --reset --author $AUTHOR --ipfs --remote
85
- autonomy fetch $AUTHOR/$SERVICE --service --local || exit 1
86
- cd $SERVICE || exit 1
87
- autonomy build-image || exit 1
88
- autonomy build-image --version $VERSION || exit 1
89
-
90
- - name : Docker login
91
- run : |
92
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USER --password-stdin
93
- - name : Docker Push
94
- run : |
95
- source env.sh
96
- echo "Pushing $DOCKER_USER/oar-$AGENT:$VERSION"
97
- echo "Pushing $DOCKER_USER/oar-$AGENT:$DEFAULT_IMAGE_TAG"
98
- docker push $DOCKER_USER/oar-$AGENT:$VERSION
99
- docker push $DOCKER_USER/oar-$AGENT:$DEFAULT_IMAGE_TAG
100
-
101
- deploy-service-on-propel :
102
- name : Deploy service on propel
103
- environment : production
104
- needs :
105
- - " publish-packages"
106
- - " publish-images"
9
+ build-agent-runner :
107
10
runs-on : ${{ matrix.os }}
108
11
strategy :
109
12
matrix :
110
- os : [ubuntu -latest]
111
- python-version : ["3.10"]
112
- env :
113
- CMD : " propel -U ${{ vars.PROPEL_BASE_URL }} "
13
+ os : [windows -latest, macos-14, macos-14-large ]
14
+ defaults :
15
+ run :
16
+ shell : bash
114
17
steps :
115
- - uses : actions/checkout@master
116
- - uses : actions/setup-python@v3
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
117
22
with :
118
- python-version : ${{ matrix.python-versions }}
119
- - name : Install dependencies
120
- run : |
121
- sudo apt-get update --fix-missing
122
- sudo apt-get autoremove
123
- sudo apt-get autoclean
124
- python -m pip install --upgrade pip
125
- pip install propel-client open-autonomy
126
-
127
- - name : Make use proxy instead of actual nlb by dns override
128
- run : |
129
- # for staging
130
- export IP_ADDR=$(dig +short balancer.tcp.propel.staging.autonolas.tech)
131
- echo -e "\n$IP_ADDR\tapp.propel.staging.valory.xyz\n" | sudo tee -a /etc/hosts
132
-
133
- # for prod
134
- export IP_ADDR=$(dig +short balancer.tcp.propel.autonolas.tech)
135
- echo -e "\n$IP_ADDR\tapp.propel.valory.xyz\n" | sudo tee -a /etc/hosts
23
+ python-version : " 3.10"
136
24
137
- - name : Login to propel
25
+ - name : Add Python to PATH
138
26
run : |
139
- $CMD login -u '${{ vars.PROPEL_USERNAME }}' -p '${{ secrets.PROPEL_PASSWORD }}'
140
-
141
- - name : Do a deployment
142
- run : |
143
- # determine ipfs hash id
144
- export IPFS_HASH=$(jq '.dev | to_entries[] | select(.key | startswith("service"))| .value' -r ./packages/packages.json | head -n1)
145
- export SERVICE_PATH=service_for_propel
146
-
147
- # fetch service file and check it published
148
- autonomy init --reset --author ci --ipfs --remote
149
- autonomy fetch $IPFS_HASH --service --alias $SERVICE_PATH
150
-
151
- # get env vars from github actions
152
- echo '${{ toJSON(secrets) }}' | jq -r 'to_entries|map("export \(.key)=\(.value|tojson)")|.[]' > github.vars
153
- echo >> github.vars
154
- echo '${{ toJSON(vars) }}' | jq -r 'to_entries|map("export \(.key)=\(.value|tojson)")|.[]' >> github.vars
155
- source github.vars
156
- $CMD service deploy --name '${{ vars.SERVICE_NAME }}' --service-dir $SERVICE_PATH --service-ipfs-hash $IPFS_HASH --ingress-enabled true --keys '${{ vars.SERVICE_KEYS }}' --timeout 320
157
-
158
- build-macos-pyinstaller :
159
- runs-on : ${{ matrix.os }}
160
- strategy :
161
- matrix :
162
- os : [ macos-14, macos-14-large ]
163
-
164
- steps :
165
- - uses : actions/checkout@v3
166
- - uses : actions/setup-python@v4
167
- with :
168
- python-version : ' 3.10'
27
+ echo "${{ steps.setup-python.outputs.python-path }}" >> $GITHUB_PATH
169
28
170
29
- name : Install and configure Poetry
171
- uses : snok/install-poetry@v1
172
- with :
173
- version : ' 1.4.0'
174
- virtualenvs-create : true
175
- virtualenvs-in-project : false
176
- virtualenvs-path : ~/my-custom-path
177
- installer-parallel : true
178
-
179
- - name : Install dependencies
180
- run : poetry install
30
+ run : pip install poetry
181
31
182
- - name : Set arch environment variable for macos-latest-large
183
- if : contains(matrix.os, 'large')
184
- run : echo "OS_ARCH=x64" >> $GITHUB_ENV
185
-
186
- - name : Set arch environment variable for other macOS versions
187
- if : ${{ !contains(matrix.os, 'large') }}
188
- run : echo "OS_ARCH=arm64" >> $GITHUB_ENV
189
-
190
- - name : Build with PyInstaller
32
+ - name : Build Agent Runner
191
33
run : |
192
- 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_bin_${{env.OS_ARCH}}
193
- - name : Upload Release Assets
194
- uses : actions/upload-artifact@v2
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
51
+ uses : actions/upload-artifact@v4
195
52
with :
196
- name : trader_bin_ ${{env.OS_ARCH }}
197
- path : dist/trader_bin_ ${{env.OS_ARCH }}
53
+ name : ${{env.FILENAME }}
54
+ path : dist/${{env.FILENAME }}
198
55
199
56
upload-assets :
200
- needs : build-macos-pyinstaller
57
+ needs : build-agent-runner
201
58
runs-on : ubuntu-latest
202
-
203
59
steps :
204
60
- name : Download artifacts
205
- uses : actions/download-artifact@v2
61
+ uses : actions/download-artifact@v4
206
62
with :
207
- name : trader_bin_x64
63
+ name : agent_runner_macos_x64
208
64
path : ./dist/
65
+
209
66
- name : Download artifacts
210
- uses : actions/download-artifact@v2
67
+ uses : actions/download-artifact@v4
211
68
with :
212
- name : trader_bin_arm64
69
+ name : agent_runner_macos_arm64
213
70
path : ./dist/
214
-
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/
215
78
- name : Publish Release
216
79
uses : softprops/action-gh-release@v2
217
80
if : startsWith(github.ref, 'refs/tags/')
218
81
with :
219
82
files : |
220
- ./dist/trader_bin_x64
221
- ./dist/trader_bin_arm64
83
+ ./dist/agent_runner*
0 commit comments