Split linux installers (#6987)

Move .rpm and .deb installers into individual workflows
This commit is contained in:
nirajpathak13 2021-07-01 23:11:22 -04:00 committed by GitHub
parent 75223a497f
commit 229ff7ab08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 259 additions and 31 deletions

View File

@ -1,4 +1,4 @@
name: Linux installer on Python 3.8
name: Linux .deb installer on Python 3.8
on:
workflow_dispatch:
@ -13,7 +13,7 @@ on:
jobs:
build:
name: Linux installer on Python 3.8
name: Linux .deb installer on Python 3.8
runs-on: ${{ matrix.os }}
timeout-minutes: 40
strategy:
@ -100,10 +100,9 @@ jobs:
with:
node-version: '12.x'
- name: Build .deb and .rpm packages
- name: Build .deb package
run: |
. ./activate
sudo apt-get -y install rpm
ldd --version
cd ./chia-blockchain-gui
git status
@ -130,7 +129,6 @@ jobs:
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
run: |
ls ${{ github.workspace }}/build_scripts/final_installer/
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/*.rpm s3://download-chia-net/builds/
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/*.deb s3://download-chia-net/builds/
- name: Create Checksums
@ -138,8 +136,6 @@ jobs:
env:
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
run: |
ls ${{ github.workspace }}/build_scripts/final_installer/
sha256sum ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm > ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm.sha256
ls ${{ github.workspace }}/build_scripts/final_installer/
sha256sum ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_amd64.deb > ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_amd64.deb.sha256
ls ${{ github.workspace }}/build_scripts/final_installer/
@ -149,12 +145,6 @@ jobs:
run: |
pip3 install py3createtorrent
- name: Create .rpm torrent
if: startsWith(github.ref, 'refs/tags/')
run: |
py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm -o ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm.torrent --webseed https://download-chia-net.s3.us-west-2.amazonaws.com/install/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm
ls
- name: Create .deb torrent
if: startsWith(github.ref, 'refs/tags/')
run: |
@ -167,9 +157,6 @@ jobs:
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_amd64.deb s3://download-chia-net/install/
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_amd64.deb.sha256 s3://download-chia-net/install/
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain_${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}_amd64.deb.torrent s3://download-chia-net/torrents/
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm s3://download-chia-net/install/
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm.sha256 s3://download-chia-net/install/
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm.torrent s3://download-chia-net/torrents/
- name: Get tag name
if: startsWith(github.ref, 'refs/tags/')
@ -181,4 +168,4 @@ jobs:
- name: Mark installer complete
if: startsWith(github.ref, 'refs/tags/')
run: |
curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"chia_ref": "${{ steps.tag-name.outputs.TAG_NAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/${{ steps.tag-name.outputs.REPO_NAME }}/${{ steps.tag-name.outputs.TAG_NAME }}/success/build-linux
curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"chia_ref": "${{ steps.tag-name.outputs.TAG_NAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/${{ steps.tag-name.outputs.REPO_NAME }}/${{ steps.tag-name.outputs.TAG_NAME }}/success/build-linux-deb

View File

@ -0,0 +1,172 @@
name: Linux .rpm installer on Python 3.8
on:
workflow_dispatch:
push:
branches:
- main
tags:
- '**'
pull_request:
branches:
- '**'
jobs:
build:
name: Linux .rpm 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.6
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.6
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-
# Create our own venv outside of the git directory JUST for getting the ACTUAL version so that install can't break it
- name: Get version number
id: version_number
run: |
python3 -m venv ../venv
. ../venv/bin/activate
pip3 install setuptools_scm
echo "::set-output name=CHIA_INSTALLER_VERSION::$(python3 ./build_scripts/installer-version.py)"
deactivate
- 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.INSTALLER_UPLOAD_SECRET }}"
- 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 .rpm package
run: |
. ./activate
sudo apt-get -y install rpm
ldd --version
cd ./chia-blockchain-gui
git status
cd ../build_scripts
sh build_linux_rpm.sh amd64
- name: Upload Linux artifacts
uses: actions/upload-artifact@v2
with:
name: Linux-Installers
path: ${{ github.workspace }}/build_scripts/final_installer/
- name: Configure AWS Credentials
if: steps.check_secrets.outputs.HAS_SECRET
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.INSTALLER_UPLOAD_KEY }}
aws-secret-access-key: ${{ secrets.INSTALLER_UPLOAD_SECRET }}
aws-region: us-west-2
- name: Upload to s3
if: steps.check_secrets.outputs.HAS_SECRET
env:
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
run: |
ls ${{ github.workspace }}/build_scripts/final_installer/
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/*.rpm s3://download-chia-net/builds/
- name: Create Checksums
if: startsWith(github.ref, 'refs/tags/')
env:
CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}
run: |
ls ${{ github.workspace }}/build_scripts/final_installer/
sha256sum ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm > ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm.sha256
ls ${{ github.workspace }}/build_scripts/final_installer/
- name: Install py3createtorrent
if: startsWith(github.ref, 'refs/tags/')
run: |
pip3 install py3createtorrent
- name: Create .rpm torrent
if: startsWith(github.ref, 'refs/tags/')
run: |
py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm -o ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm.torrent --webseed https://download-chia-net.s3.us-west-2.amazonaws.com/install/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm
ls
- name: Upload Release Files
if: steps.check_secrets.outputs.HAS_SECRET && startsWith(github.ref, 'refs/tags/')
run: |
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm s3://download-chia-net/install/
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm.sha256 s3://download-chia-net/install/
aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/chia-blockchain-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}-1.x86_64.rpm.torrent s3://download-chia-net/torrents/
- name: Get tag name
if: startsWith(github.ref, 'refs/tags/')
id: tag-name
run: |
echo "::set-output name=TAG_NAME::$(echo ${{ github.ref }} | cut -d'/' -f 3)"
echo "::set-output name=REPO_NAME::$(echo ${{ github.repository }} | cut -d'/' -f 2)"
- name: Mark installer complete
if: startsWith(github.ref, 'refs/tags/')
run: |
curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"chia_ref": "${{ steps.tag-name.outputs.TAG_NAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/${{ steps.tag-name.outputs.REPO_NAME }}/${{ steps.tag-name.outputs.TAG_NAME }}/success/build-linux-rpm

View File

@ -5,7 +5,6 @@ if [ ! "$1" ]; then
exit 1
elif [ "$1" = "amd64" ]; then
PLATFORM="$1"
REDHAT_PLATFORM="x86_64"
DIR_NAME="chia-blockchain-linux-x64"
else
PLATFORM="$1"
@ -27,7 +26,6 @@ echo "Chia Installer Version is: $CHIA_INSTALLER_VERSION"
echo "Installing npm and electron packagers"
npm install electron-packager -g
npm install electron-installer-debian -g
npm install electron-installer-redhat -g
echo "Create dist/"
rm -rf dist
@ -80,16 +78,4 @@ if [ "$LAST_EXIT_CODE" -ne 0 ]; then
exit $LAST_EXIT_CODE
fi
if [ "$REDHAT_PLATFORM" = "x86_64" ]; then
echo "Create chia-blockchain-$CHIA_INSTALLER_VERSION.rpm"
electron-installer-redhat --src dist/$DIR_NAME/ --dest final_installer/ \
--arch "$REDHAT_PLATFORM" --options.version $CHIA_INSTALLER_VERSION \
--license ../LICENSE
LAST_EXIT_CODE=$?
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
echo >&2 "electron-installer-redhat failed!"
exit $LAST_EXIT_CODE
fi
fi
ls final_installer/

View File

@ -0,0 +1,83 @@
#!/bin/bash
if [ ! "$1" ]; then
echo "This script requires either amd64 of arm64 as an argument"
exit 1
elif [ "$1" = "amd64" ]; then
#PLATFORM="$1"
REDHAT_PLATFORM="x86_64"
DIR_NAME="chia-blockchain-linux-x64"
else
#PLATFORM="$1"
DIR_NAME="chia-blockchain-linux-arm64"
fi
pip install setuptools_scm
# The environment variable CHIA_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)
if [ ! "$CHIA_INSTALLER_VERSION" ]; then
echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0."
CHIA_INSTALLER_VERSION="0.0.0"
fi
echo "Chia Installer Version is: $CHIA_INSTALLER_VERSION"
echo "Installing npm and electron packagers"
npm install electron-packager -g
npm install electron-installer-redhat -g
echo "Create dist/"
rm -rf dist
mkdir dist
echo "Create executables with pyinstaller"
pip install pyinstaller==4.2
SPEC_FILE=$(python -c 'import chia; print(chia.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
cd .. || exit
cd chia-blockchain-gui || exit
echo "npm build"
npm install
npm audit fix
npm run build
LAST_EXIT_CODE=$?
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
echo >&2 "npm run build failed!"
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
LAST_EXIT_CODE=$?
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
echo >&2 "electron-packager failed!"
exit $LAST_EXIT_CODE
fi
mv $DIR_NAME ../build_scripts/dist/
cd ../build_scripts || exit
if [ "$REDHAT_PLATFORM" = "x86_64" ]; then
echo "Create chia-blockchain-$CHIA_INSTALLER_VERSION.rpm"
electron-installer-redhat --src dist/$DIR_NAME/ --dest final_installer/ \
--arch "$REDHAT_PLATFORM" --options.version $CHIA_INSTALLER_VERSION \
--license ../LICENSE
LAST_EXIT_CODE=$?
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
echo >&2 "electron-installer-redhat failed!"
exit $LAST_EXIT_CODE
fi
fi
ls final_installer/