-
Notifications
You must be signed in to change notification settings - Fork 2
170 lines (148 loc) · 6.49 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: Release
# Triggered on pushing a tag
on:
push:
tags:
- "v*.*.*"
jobs:
# PyInstaller job for both x64 and arm64 binaries
build-macos-pyinstaller:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-14, macos-14-large]
steps:
- uses: actions/checkout@v3
# Setup Python
- uses: actions/setup-python@v4
with:
python-version: "3.10"
# Install Poetry and its dependencies
- 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
# Set architecture for macos-latest-large as x64 and arm64 for other versions
- name: Set architecture environment variable
run: |
if [ "${{ matrix.os }}" == "macos-14-large" ]; then echo "OS_ARCH=x64" >> $GITHUB_ENV; else echo "OS_ARCH=arm64" >> $GITHUB_ENV; fi
# Cache Poetry dependencies with unique key for each environment and architecture
- name: Cache Poetry dependencies
uses: actions/cache@v3
with:
path: |
~/.cache/pypoetry
~/.cache/pip
~/.venv
key: poetry-${{ env.OS_ARCH }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-${{ env.OS_ARCH }}-
- name: Install dependencies
run: poetry install
# Download and build with PyInstaller
- 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@v4
with:
name: pearl_${{ env.OS_ARCH }}
path: dist/pearl_${{ env.OS_ARCH }}
# Jobs for production and development, running separately for x64 and arm64
build-release:
runs-on: macos-latest
strategy:
matrix:
env: [production, development]
arch: [arm64, x64]
needs: build-macos-pyinstaller
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: "20.x"
# Download the appropriate architecture artifact
- name: Download Pearl binary for architecture
uses: actions/download-artifact@v4
with:
name: pearl_${{ matrix.arch }}
path: electron/bins/
# Add execution permissions to the binaries
- name: Add exec permissions
run: chmod +x electron/bins/pearl_${{ matrix.arch }}
# Cache node_modules with unique key for each environment and architecture
- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: |
node_modules
frontend/node_modules
key: node-modules-${{ matrix.env }}-${{ matrix.arch }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
node-modules-${{ matrix.env }}-${{ matrix.arch }}-
# Install dependencies
- name: Install dependencies
run: |
yarn install
yarn install:frontend
# Build frontend for production
- name: Build frontend for production
if: matrix.env == 'production'
run: yarn build:frontend
env:
NODE_ENV: ${{ matrix.env }}
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/
# Build frontend for development
- name: Build frontend for development
if: matrix.env == 'development'
run: yarn build:frontend
env:
NODE_ENV: ${{ matrix.env }}
DEV_RPC: https://virtual.gnosis.rpc.tenderly.co/7e67e659-9a8a-4830-b430-76203f1abde8
IS_STAGING: ${{ github.ref != 'refs/heads/main' && 'true' || 'false' }}
FORK_URL: https://virtual.gnosis.rpc.tenderly.co/7e67e659-9a8a-4830-b430-76203f1abde8
# Run the build and notarization process for production
- name: Build, notarize, and publish (Production)
if: matrix.env == 'production'
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: ${{ matrix.env }}
ARCH: ${{ matrix.arch }}
DEV_RPC: https://rpc-gate.autonolas.tech/gnosis-rpc/
FORK_URL: https://rpc-gate.autonolas.tech/gnosis-rpc/
run: node build.js
# Run the build and notarization process for development
- name: Build, notarize, and publish (Development)
if: matrix.env == 'development'
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: ${{ matrix.env }}
ARCH: ${{ matrix.arch }}
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 "FORK_URL=https://virtual.gnosis.rpc.tenderly.co/78ca845d-2b24-44a6-9ce2-869a979e8b5b" >> .env
node build.js