Skip to content

Commit

Permalink
chia: #7244
Browse files Browse the repository at this point in the history
  • Loading branch information
Flora-Network committed Jul 20, 2021
1 parent 7fbb04c commit 8557b3b
Show file tree
Hide file tree
Showing 9 changed files with 298 additions and 61 deletions.
96 changes: 96 additions & 0 deletions .github/workflows/build-linux-installer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Linux installer on Python 3.8

on:
push:
branches:
- main
tags:
- '**'
pull_request:
branches:
- '**'

jobs:
build:
name: Linux installer on Python 3.8
runs-on: ${{ matrix.os }}
timeout-minutes: 40
strategy:
fail-fast: false
max-parallel: 4
matrix:
python-version: [3.8]
os: [ubuntu-18.04]

steps:
- name: Cancel previous runs on the same branch
if: ${{ github.ref != 'refs/heads/main' }}
uses: styfle/cancel-workflow-action@0.9.0
with:
access_token: ${{ github.token }}

- name: Checkout Code
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive

- name: Setup Python environment
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Cache npm
uses: actions/cache@v2.1.5
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache pip
uses: actions/cache@v2.1.5
with:
# Note that new runners may break this https://github.com/actions/cache/issues/292
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Run install script
env:
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
BUILD_VDF_CLIENT: "N"
run: |
sh install.sh
- name: Setup Node 12.x
uses: actions/setup-node@v2.1.5
with:
node-version: '12.x'

- name: Build .deb and .rpm packages
run: |
. ./activate
sudo apt-get -y install rpm
ldd --version
cd ./flora-blockchain-gui
git status
cd ../build_scripts
sh build_linux.sh amd64
- name: Upload Linux artifacts
uses: actions/upload-artifact@v2
with:
name: Linux-Installers
path: ${{ github.workspace }}/build_scripts/final_installer/
115 changes: 115 additions & 0 deletions .github/workflows/build-macos-installer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: MacOS installer on Catalina and Python 3.8

on:
push:
branches:
- main
tags:
- '**'
pull_request:
branches:
- '**'

jobs:
build:
name: MacOS installer on Catalina and Python 3.8
runs-on: ${{ matrix.os }}
timeout-minutes: 40
strategy:
fail-fast: false
max-parallel: 4
matrix:
python-version: [3.9]
os: [macOS-latest]

steps:
- name: Cancel previous runs on the same branch
if: ${{ github.ref != 'refs/heads/main' }}
uses: styfle/cancel-workflow-action@0.9.0
with:
access_token: ${{ github.token }}

- name: Checkout Code
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive

- name: Setup Python environment
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Cache npm
uses: actions/cache@v2.1.5
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache pip
uses: actions/cache@v2.1.5
with:
# Note that new runners may break this https://github.com/actions/cache/issues/292
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Test for secrets access
id: check_secrets
shell: bash
run: |
unset HAS_SECRET
if [ -n "$SECRET" ]; then HAS_SECRET='true' ; fi
echo ::set-output name=HAS_SECRET::${HAS_SECRET}
env:
SECRET: "${{ secrets.APPLE_DEV_ID_APP }}"

- name: Import Apple app signing certificate
if: steps.check_secrets.outputs.HAS_SECRET
uses: Apple-Actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.APPLE_DEV_ID_APP }}
p12-password: ${{ secrets.APPLE_DEV_ID_APP_PASS }}

- name: Run install script
env:
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
BUILD_VDF_CLIENT: "N"
run: |
sh install.sh
- name: Setup Node 12.x
uses: actions/setup-node@v2.1.5
with:
node-version: '12.x'

- name: Build MacOS DMG in Catalina
env:
NOTARIZE: ${{ steps.check_secrets.outputs.HAS_SECRET }}
APPLE_NOTARIZE_USERNAME: "${{ secrets.APPLE_NOTARIZE_USERNAME }}"
APPLE_NOTARIZE_PASSWORD: "${{ secrets.APPLE_NOTARIZE_PASSWORD }}"
run: |
. ./activate
cd ./flora-blockchain-gui
git status
cd ../build_scripts
sh build_macos.sh
- name: Upload MacOS artifacts
uses: actions/upload-artifact@v2
with:
name: Flora-Installer-on-MacOS-10.15-dmg
path: ${{ github.workspace }}/build_scripts/final_installer/
36 changes: 18 additions & 18 deletions build_scripts/build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ if [ ! "$1" ]; then
elif [ "$1" = "amd64" ]; then
PLATFORM="$1"
REDHAT_PLATFORM="x86_64"
DIR_NAME="chia-blockchain-linux-x64"
DIR_NAME="flora-blockchain-linux-x64"
else
PLATFORM="$1"
DIR_NAME="chia-blockchain-linux-arm64"
DIR_NAME="flora-blockchain-linux-arm64"
fi

pip install setuptools_scm
# The environment variable CHIA_INSTALLER_VERSION needs to be defined
# The environment variable FLORA_INSTALLER_VERSION needs to be defined
# If the env variable NOTARIZE and the username and password variables are
# set, this will attempt to Notarize the signed DMG
CHIA_INSTALLER_VERSION=$(python installer-version.py)
FLORA_INSTALLER_VERSION=$(python installer-version.py)

if [ ! "$CHIA_INSTALLER_VERSION" ]; then
echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0."
CHIA_INSTALLER_VERSION="0.0.0"
if [ ! "$FLORA_INSTALLER_VERSION" ]; then
echo "WARNING: No environment variable FLORA_INSTALLER_VERSION set. Using 0.0.0."
FLORA_INSTALLER_VERSION="0.0.0"
fi
echo "Chia Installer Version is: $CHIA_INSTALLER_VERSION"
echo "Flora Installer Version is: $FLORA_INSTALLER_VERSION"

echo "Installing npm and electron packagers"
npm install electron-packager -g
Expand All @@ -35,17 +35,17 @@ mkdir dist

echo "Create executables with pyinstaller"
pip install pyinstaller==4.2
SPEC_FILE=$(python -c 'import chia; print(chia.PYINSTALLER_SPEC_PATH)')
SPEC_FILE=$(python -c 'import flora; print(flora.PYINSTALLER_SPEC_PATH)')
pyinstaller --log-level=INFO "$SPEC_FILE"
LAST_EXIT_CODE=$?
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
echo >&2 "pyinstaller failed!"
exit $LAST_EXIT_CODE
fi

cp -r dist/daemon ../chia-blockchain-gui
cp -r dist/daemon ../flora-blockchain-gui
cd .. || exit
cd chia-blockchain-gui || exit
cd flora-blockchain-gui || exit

echo "npm build"
npm install
Expand All @@ -57,9 +57,9 @@ if [ "$LAST_EXIT_CODE" -ne 0 ]; then
exit $LAST_EXIT_CODE
fi

electron-packager . chia-blockchain --asar.unpack="**/daemon/**" --platform=linux \
--icon=src/assets/img/Chia.icns --overwrite --app-bundle-id=net.chia.blockchain \
--appVersion=$CHIA_INSTALLER_VERSION
electron-packager . flora-blockchain --asar.unpack="**/daemon/**" --platform=linux \
--icon=src/assets/img/Flora.icns --overwrite --app-bundle-id=net.flora.blockchain \
--appVersion=$FLORA_INSTALLER_VERSION
LAST_EXIT_CODE=$?
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
echo >&2 "electron-packager failed!"
Expand All @@ -69,21 +69,21 @@ fi
mv $DIR_NAME ../build_scripts/dist/
cd ../build_scripts || exit

echo "Create chia-$CHIA_INSTALLER_VERSION.deb"
echo "Create flora-$FLORA_INSTALLER_VERSION.deb"
rm -rf final_installer
mkdir final_installer
electron-installer-debian --src dist/$DIR_NAME/ --dest final_installer/ \
--arch "$PLATFORM" --options.version $CHIA_INSTALLER_VERSION
--arch "$PLATFORM" --options.version $FLORA_INSTALLER_VERSION
LAST_EXIT_CODE=$?
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
echo >&2 "electron-installer-debian failed!"
exit $LAST_EXIT_CODE
fi

if [ "$REDHAT_PLATFORM" = "x86_64" ]; then
echo "Create chia-blockchain-$CHIA_INSTALLER_VERSION.rpm"
echo "Create flora-blockchain-$FLORA_INSTALLER_VERSION.rpm"
electron-installer-redhat --src dist/$DIR_NAME/ --dest final_installer/ \
--arch "$REDHAT_PLATFORM" --options.version $CHIA_INSTALLER_VERSION \
--arch "$REDHAT_PLATFORM" --options.version $FLORA_INSTALLER_VERSION \
--license ../LICENSE
LAST_EXIT_CODE=$?
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
Expand Down
Loading

0 comments on commit 8557b3b

Please sign in to comment.