Skip to content

Commit

Permalink
Fix (CI): Build image from support autonomy version
Browse files Browse the repository at this point in the history
Signed-off-by: OjusWiZard <[email protected]>
  • Loading branch information
OjusWiZard committed Dec 6, 2024
1 parent f3f25e6 commit c1507fb
Showing 1 changed file with 157 additions and 156 deletions.
313 changes: 157 additions & 156 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@ on:
- 'v*.*.*'

jobs:
publish-packages:
name: Push Packages
runs-on: ubuntu-20.04
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-versions }}
- uses: addnab/docker-run-action@v3
with:
image: valory/open-autonomy-user:latest
options: -v ${{ github.workspace }}:/work
run: |
echo "Pushing Packages"
cd /work
export AUTHOR=$(grep 'service' packages/packages.json | awk -F/ '{print $2}' | head -1)
autonomy init --reset --author $AUTHOR --ipfs --remote
autonomy push-all
# publish-packages:
# name: Push Packages
# runs-on: ubuntu-20.04
# strategy:
# matrix:
# os: [ubuntu-latest]
# python-version: ["3.10"]
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-versions }}
# - uses: addnab/docker-run-action@v3
# with:
# image: valory/open-autonomy-user:latest
# options: -v ${{ github.workspace }}:/work
# run: |
# echo "Pushing Packages"
# cd /work
# export AUTHOR=$(grep 'service' packages/packages.json | awk -F/ '{print $2}' | head -1)
# autonomy init --reset --author $AUTHOR --ipfs --remote
# autonomy push-all
publish-images:
name: Publish Docker Images
runs-on: ${{ matrix.os }}
needs:
- "publish-packages"
# needs:
# - "publish-packages"
strategy:
matrix:
os: [ubuntu-latest]
Expand Down Expand Up @@ -76,6 +76,7 @@ jobs:
shell: bash
run: |
echo "Building Docker Images"
poetry install
cd /work
source env.sh || exit 1
echo "Building images for $AUTHOR for service $SERVICE"
Expand All @@ -85,135 +86,135 @@ jobs:
autonomy build-image || exit 1
autonomy build-image --version $VERSION || exit 1
- name: Docker login
run: |
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USER --password-stdin
- name: Docker Push
run: |
source env.sh
echo "Pushing $DOCKER_USER/oar-$AGENT:$VERSION"
echo "Pushing $DOCKER_USER/oar-$AGENT:$DEFAULT_IMAGE_TAG"
docker push $DOCKER_USER/oar-$AGENT:$VERSION
docker push $DOCKER_USER/oar-$AGENT:$DEFAULT_IMAGE_TAG
deploy-service-on-propel:
name: Deploy service on propel
environment: production
needs:
- "publish-packages"
- "publish-images"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.10"]
env:
CMD: "propel -U ${{ vars.PROPEL_BASE_URL }}"
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-versions }}
- name: Install dependencies
run: |
sudo apt-get update --fix-missing
sudo apt-get autoremove
sudo apt-get autoclean
python -m pip install --upgrade pip
pip install propel-client open-autonomy
- name: Make use proxy instead of actual nlb by dns override
run: |
# for staging
export IP_ADDR=$(dig +short balancer.tcp.propel.staging.autonolas.tech)
echo -e "\n$IP_ADDR\tapp.propel.staging.valory.xyz\n" | sudo tee -a /etc/hosts
# for prod
export IP_ADDR=$(dig +short balancer.tcp.propel.autonolas.tech)
echo -e "\n$IP_ADDR\tapp.propel.valory.xyz\n" | sudo tee -a /etc/hosts
- name: Login to propel
run: |
$CMD login -u '${{ vars.PROPEL_USERNAME }}' -p '${{ secrets.PROPEL_PASSWORD }}'
- name: Do a deployment
run: |
# determine ipfs hash id
export IPFS_HASH=$(jq '.dev | to_entries[] | select(.key | startswith("service"))| .value' -r ./packages/packages.json | head -n1)
export SERVICE_PATH=service_for_propel
# fetch service file and check it published
autonomy init --reset --author ci --ipfs --remote
autonomy fetch $IPFS_HASH --service --alias $SERVICE_PATH
# get env vars from github actions
echo '${{ toJSON(secrets) }}' | jq -r 'to_entries|map("export \(.key)=\(.value|tojson)")|.[]' > github.vars
echo >> github.vars
echo '${{ toJSON(vars) }}' | jq -r 'to_entries|map("export \(.key)=\(.value|tojson)")|.[]' >> github.vars
source github.vars
$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
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: Build with PyInstaller
run: |
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}}
- name: Upload Release Assets
uses: actions/upload-artifact@v2
with:
name: trader_bin_${{env.OS_ARCH}}
path: dist/trader_bin_${{env.OS_ARCH}}

upload-assets:
needs: build-macos-pyinstaller
runs-on: ubuntu-latest

steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: trader_bin_x64
path: ./dist/
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: trader_bin_arm64
path: ./dist/

- name: Publish Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
./dist/trader_bin_x64
./dist/trader_bin_arm64
# - name: Docker login
# run: |
# echo $DOCKER_PASSWORD | docker login -u $DOCKER_USER --password-stdin
# - name: Docker Push
# run: |
# source env.sh
# echo "Pushing $DOCKER_USER/oar-$AGENT:$VERSION"
# echo "Pushing $DOCKER_USER/oar-$AGENT:$DEFAULT_IMAGE_TAG"
# docker push $DOCKER_USER/oar-$AGENT:$VERSION
# docker push $DOCKER_USER/oar-$AGENT:$DEFAULT_IMAGE_TAG

# deploy-service-on-propel:
# name: Deploy service on propel
# environment: production
# needs:
# - "publish-packages"
# - "publish-images"
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ubuntu-latest]
# python-version: ["3.10"]
# env:
# CMD: "propel -U ${{ vars.PROPEL_BASE_URL }}"
# steps:
# - uses: actions/checkout@master
# - uses: actions/setup-python@v3
# with:
# python-version: ${{ matrix.python-versions }}
# - name: Install dependencies
# run: |
# sudo apt-get update --fix-missing
# sudo apt-get autoremove
# sudo apt-get autoclean
# python -m pip install --upgrade pip
# pip install propel-client open-autonomy

# - name: Make use proxy instead of actual nlb by dns override
# run: |
# # for staging
# export IP_ADDR=$(dig +short balancer.tcp.propel.staging.autonolas.tech)
# echo -e "\n$IP_ADDR\tapp.propel.staging.valory.xyz\n" | sudo tee -a /etc/hosts

# # for prod
# export IP_ADDR=$(dig +short balancer.tcp.propel.autonolas.tech)
# echo -e "\n$IP_ADDR\tapp.propel.valory.xyz\n" | sudo tee -a /etc/hosts

# - name: Login to propel
# run: |
# $CMD login -u '${{ vars.PROPEL_USERNAME }}' -p '${{ secrets.PROPEL_PASSWORD }}'

# - name: Do a deployment
# run: |
# # determine ipfs hash id
# export IPFS_HASH=$(jq '.dev | to_entries[] | select(.key | startswith("service"))| .value' -r ./packages/packages.json | head -n1)
# export SERVICE_PATH=service_for_propel

# # fetch service file and check it published
# autonomy init --reset --author ci --ipfs --remote
# autonomy fetch $IPFS_HASH --service --alias $SERVICE_PATH

# # get env vars from github actions
# echo '${{ toJSON(secrets) }}' | jq -r 'to_entries|map("export \(.key)=\(.value|tojson)")|.[]' > github.vars
# echo >> github.vars
# echo '${{ toJSON(vars) }}' | jq -r 'to_entries|map("export \(.key)=\(.value|tojson)")|.[]' >> github.vars
# source github.vars
# $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

# 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: Build with PyInstaller
# run: |
# 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}}
# - name: Upload Release Assets
# uses: actions/upload-artifact@v2
# with:
# name: trader_bin_${{env.OS_ARCH}}
# path: dist/trader_bin_${{env.OS_ARCH}}

# upload-assets:
# needs: build-macos-pyinstaller
# runs-on: ubuntu-latest

# steps:
# - name: Download artifacts
# uses: actions/download-artifact@v2
# with:
# name: trader_bin_x64
# path: ./dist/
# - name: Download artifacts
# uses: actions/download-artifact@v2
# with:
# name: trader_bin_arm64
# path: ./dist/

# - name: Publish Release
# uses: softprops/action-gh-release@v2
# if: startsWith(github.ref, 'refs/tags/')
# with:
# files: |
# ./dist/trader_bin_x64
# ./dist/trader_bin_arm64

0 comments on commit c1507fb

Please sign in to comment.