Skip to content

Commit

Permalink
win insaller cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Yostra authored and wjblanke committed Jun 1, 2020
1 parent 2f8c62e commit 6c2d93b
Show file tree
Hide file tree
Showing 18 changed files with 551 additions and 48 deletions.
42 changes: 9 additions & 33 deletions .github/workflows/windows-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,19 @@ jobs:
python-version: "3.7"

- name: curl miniupnpc and setproctitle
working-directory: ${{ github.workspace }}\electron-wix\blockchain
working-directory: ${{ github.workspace }}\build_scripts
run: |
curl -OL --show-error --fail https://download.chia.net/simple/miniupnpc/miniupnpc-2.1-cp37-cp37m-win_amd64.whl
curl -OL --show-error --fail https://download.chia.net/simple/setproctitle/setproctitle-1.1.10-cp37-cp37m-win_amd64.whl
git config --global core.longpaths true
./build_windows.ps1
- name: Collect and Create wheels for chia-blockchain
run: |
python -m pip install --upgrade pip
pip install pep517 wheel
pip wheel --use-pep517 --only-binary cbor2 --extra-index-url https://download.chia.net/simple/ -f ${{ github.workspace }} --wheel-dir=${{ github.workspace }}\electron-wix\blockchain ${{ github.workspace }}\.
- name: Install electron-packager
run: |
npm install electron-packager -g
- name: npm install
working-directory: ${{ github.workspace }}\electron-react
run: |
npm install --runtime=electron --target=1.7.6
- name: curl Visual C++ 2019 redistributable # Windows has curl natively
working-directory: ${{ github.workspace }}\electron-wix\prerequisites\
run: curl -OL --show-error --fail https://aka.ms/vs/16/release/vc_redist.x64.exe

- name: curl Python 3.7.7 Installer
working-directory: ${{ github.workspace }}\electron-wix\prerequisites\
run: curl -OL --show-error --fail https://www.python.org/ftp/python/3.7.7/python-3.7.7-amd64.exe

- name: Build Windows installer with Wix
env:
version: 0.1.13 # TODO Need to create this from setuptools_scm for Windows
working-directory: ${{ github.workspace }}\electron-wix
run: |
.\rebuild-all.ps1
- name: Upload artifacts EXE
uses: actions/upload-artifact@v1
with:
name: Windows-Exe
path: ${{ github.workspace }}\electron-react\Chia-win32-x64

- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: Windows-Installers
path: ${{ github.workspace }}\electron-wix\final
path: ${{ github.workspace }}\electron-react\release-builds\
11 changes: 11 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,19 @@ steps:
py.test tests -s -v
displayName: "pytest"
- script: |
cd build_scripts
sh build_mac.sh
displayName: "Build DMG"
- task: PublishPipelineArtifact@1
inputs:
targetPath: $(System.DefaultWorkingDirectory)/wheels
artifactName: MacOS-wheels
displayName: "Upload MacOS wheels"

- task: PublishPipelineArtifact@1
inputs:
targetPath: $(System.DefaultWorkingDirectory)/build_scripts/Chia.dmg
artifactName: MacOS-DMG
displayName: "Upload MacOS DMG"
7 changes: 4 additions & 3 deletions build_scripts/build_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ sudo pyinstaller daemon.spec
cp -r dist/daemon ../electron-react
cd ..
cd electron-react
npm install
npm run build
electron-packager . chia --overwrite
mv chia-darwin-x64 ../build_scripts/dist/
electron-packager . Chia --overwrite --icon=./src/assets/img/chia.ico
mv Chia-darwin-x64 ../build_scripts/dist/
cd ../build_scripts
electron-installer-dmg dist/chia-darwin-x64/chia.app Chia
electron-installer-dmg dist/Chia-darwin-x64/Chia.app Chia --overwrite
39 changes: 39 additions & 0 deletions build_scripts/build_windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cd ..
mkdir build_scripts\win_build
cd build_scripts\win_build

curl -OL --show-error --fail https://download.chia.net/simple/miniupnpc/miniupnpc-2.1-cp37-cp37m-win_amd64.whl
curl -OL --show-error --fail https://download.chia.net/simple/setproctitle/setproctitle-1.1.10-cp37-cp37m-win_amd64.whl
# C:\curl\curl.exe -OL --show-error --fail https://download.chia.net/simple/setproctitle/setproctitle-1.1.10-cp37-cp37m-win_amd64.whl
# C:\curl\curl.exe -OL --show-error --fail https://download.chia.net/simple/miniupnpc/miniupnpc-2.1-cp37-cp37m-win_amd64.whl

Write-Output "checkpoint 1";
cd ..\..
python -m pip install --upgrade pip
pip install pep517 wheel
pip wheel --use-pep517 --only-binary cbor2 --extra-index-url https://download.chia.net/simple/ -f . --wheel-dir=.\build_scripts\win_build .
Write-Output "checkpoint 2";

python -m venv venv
. .\venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
cd build_scripts
python install_win.py
Write-Output "checkpoint 3";

pip install pywin32
pip install pyinstaller
pyinstaller daemon_windows.spec
Write-Output "checkpoint 4";

cp -r dist/daemon ../electron-react/
cd ../electron-react

Write-Output "checkpoint 5";

npm install --save-dev electron-winstaller
npm install -g electron-packager
npm install
npm run build
electron-packager . Chia --asar.unpack="**/daemon/**" --overwrite --icon=./src/assets/img/chia.ico
node winstaller.js
2 changes: 1 addition & 1 deletion build_scripts/daemon.spec
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ full_node = Analysis([f"{root}/src/server/start_full_node.py"],
wallet = Analysis([f"{root}/src/wallet/websocket_server.py"],
pathex=[f"{root}/venv/lib/python3.7/site-packages/aiter/", f"{root}"],
binaries = [],
datas=[(f"{root}/src/util/bip39/english.txt", f"."), version_data ],
datas=[(f"{root}/src/util/bip39/english.txt", f"./src/util/bip39/"), version_data ],
hiddenimports=subcommand_modules,
hookspath=[],
runtime_hooks=[],
Expand Down
262 changes: 262 additions & 0 deletions build_scripts/daemon_windows.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
# -*- mode: python ; coding: utf-8 -*-
#from src.cmds.chia import SUBCOMMANDS
import pathlib

from PyInstaller.utils.hooks import collect_submodules, copy_metadata

keyring_imports = collect_submodules('keyring.backends')

# keyring uses entrypoints to read keyring.backends from metadata file entry_points.txt.
keyring_datas = copy_metadata('keyring')[0]

from pkg_resources import get_distribution

build = pathlib.Path().absolute()
root = build.parent

from PyInstaller.utils.hooks import copy_metadata
version_data = copy_metadata(get_distribution("chia-blockchain"))[0]

SUBCOMMANDS = [
"init",
"keys",
"show",
"start",
"stop",
"version",
"netspace",
"run_daemon",
]
block_cipher = None
subcommand_modules = [f"{root}/src.cmds.%s" % _ for _ in SUBCOMMANDS]
other = ["aiter.active_aiter", "aiter.aiter_forker", "aiter.aiter_to_iter", "aiter.azip", "aiter.flatten_aiter", "aiter.gated_aiter",
"aiter.iter_to_aiter", "aiter.join_aiters", "aiter.map_aiter", "aiter.map_filter_aiter", "aiter.preload_aiter",
"aiter.push_aiter", "aiter.sharable_aiter", "aiter.stoppable_aiter","src.wallet.websocket_server", "win32cred", "pywintypes", "win32ctypes.pywin32"]

entry_points = ["aiohttp", "aiohttp.aiohttp",
"src.cmds.check_plots",
"src.cmds.create_plots",
"src.wallet.websocket_server",
"src.server.start_full_node",
"src.server.start_harvester",
"src.server.start_farmer",
"src.server.start_introducer",
"src.server.start_timelord",
"src.timelord_launcher",
"src.simulator.start_simulator",
"src.util.bip32"]

subcommand_modules.extend(other)
subcommand_modules.extend(entry_points)
subcommand_modules.extend(keyring_imports)

daemon = Analysis([f"{root}/src/daemon/server.py"],
pathex=[f"{root}/venv/lib/python3.7/site-packages/aiter/", f"{root}"],
binaries = [(f"{root}/venv\Lib\site-packages\\*dll", '.')],
datas=[keyring_datas, version_data, (f"../src/util/initial-config.yaml", f"./src/util/"),
(f"../src/util/initial-plots.yaml", f"./src/util/") ],
hiddenimports=subcommand_modules,
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)

full_node = Analysis([f"{root}/src/server/start_full_node.py"],
pathex=[f"{root}/venv/lib/python3.7/site-packages/aiter/", f"{root}"],
binaries = [],
datas=[version_data],
hiddenimports=subcommand_modules,
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)

wallet = Analysis([f"{root}/src/wallet/websocket_server.py"],
pathex=[f"{root}/venv/lib/python3.7/site-packages/aiter/", f"{root}"],
binaries = [],
datas=[(f"{root}/src/util/bip39/english.txt", f"./src/util/bip39/"), version_data ],
hiddenimports=subcommand_modules,
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)

plotter = Analysis([f"{root}/src/cmds/create_plots.py"],
pathex=[f"{root}/venv/lib/python3.7/site-packages/aiter/", f"{root}"],
binaries = [],
datas=[version_data],
hiddenimports=subcommand_modules,
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)

farmer = Analysis([f"{root}/src/server/start_farmer.py"],
pathex=[f"{root}/venv/lib/python3.7/site-packages/aiter/", f"{root}"],
binaries = [],
datas=[version_data],
hiddenimports=subcommand_modules,
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)

harvester = Analysis([f"{root}/src/server/start_harvester.py"],
pathex=[f"{root}/venv/lib/python3.7/site-packages/aiter/", f"{root}"],
binaries = [],
datas=[version_data],
hiddenimports=subcommand_modules,
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)

check_plots = Analysis([f"{root}/src/cmds/check_plots.py"],
pathex=[f"{root}/venv/lib/python3.7/site-packages/aiter/", f"{root}"],
binaries = [],
datas=[version_data],
hiddenimports=subcommand_modules,
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)

daemon_pyz = PYZ(daemon.pure, daemon.zipped_data,
cipher=block_cipher)
full_node_pyz = PYZ(full_node.pure, full_node.zipped_data,
cipher=block_cipher)
wallet_pyz = PYZ(wallet.pure, wallet.zipped_data,
cipher=block_cipher)
plotter_pyz = PYZ(plotter.pure, plotter.zipped_data,
cipher=block_cipher)
farmer_pyz = PYZ(farmer.pure, farmer.zipped_data,
cipher=block_cipher)
harvester_pyz = PYZ(harvester.pure, harvester.zipped_data,
cipher=block_cipher)
check_plots_pyz = PYZ(check_plots.pure, check_plots.zipped_data,
cipher=block_cipher)

daemon_exe = EXE(daemon_pyz,
daemon.scripts,
[],
exclude_binaries=True,
name='daemon',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True )

full_node_exe = EXE(full_node_pyz,
full_node.scripts,
[],
exclude_binaries=True,
name='start_full_node',
debug=False,
bootloader_ignore_signals=False,
strip=False)

wallet_exe = EXE(wallet_pyz,
wallet.scripts,
[],
exclude_binaries=True,
name='websocket_server',
debug=False,
bootloader_ignore_signals=False,
strip=False)

plotter_exe = EXE(plotter_pyz,
plotter.scripts,
[],
exclude_binaries=True,
name='create_plots',
debug=False,
bootloader_ignore_signals=False,
strip=False)

farmer_exe = EXE(farmer_pyz,
farmer.scripts,
[],
exclude_binaries=True,
name='start_farmer',
debug=False,
bootloader_ignore_signals=False,
strip=False)

harvester_exe = EXE(harvester_pyz,
farmer.scripts,
[],
exclude_binaries=True,
name='start_harvester',
debug=False,
bootloader_ignore_signals=False,
strip=False)

check_plots_exe = EXE(check_plots_pyz,
check_plots.scripts,
[],
exclude_binaries=True,
name='start_harvester',
debug=False,
bootloader_ignore_signals=False,
strip=False)

coll = COLLECT(daemon_exe,
daemon.binaries,
daemon.zipfiles,
daemon.datas,

full_node_exe,
full_node.binaries,
full_node.zipfiles,
full_node.datas,

wallet_exe,
wallet.binaries,
wallet.zipfiles,
wallet.datas,

plotter_exe,
plotter.binaries,
plotter.zipfiles,
plotter.datas,

farmer_exe,
farmer.binaries,
farmer.zipfiles,
farmer.datas,

harvester_exe,
harvester.binaries,
harvester.zipfiles,
harvester.datas,

check_plots_exe,
check_plots.binaries,
check_plots.zipfiles,
check_plots.datas,
strip = False,
upx_exclude = [],
name = 'daemon'
)
Loading

0 comments on commit 6c2d93b

Please sign in to comment.