mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-11-13 12:09:25 +03:00
d6f495145e
Upload installer binaries to S3 whenever main is updated
150 lines
6.1 KiB
YAML
150 lines
6.1 KiB
YAML
# Python package
|
|
# Create and test a Python package on multiple Python versions.
|
|
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
|
|
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
|
|
|
|
trigger:
|
|
branches:
|
|
include:
|
|
- "*"
|
|
tags:
|
|
include:
|
|
- "*"
|
|
|
|
pool:
|
|
vmImage: "macOS-10.15"
|
|
strategy:
|
|
matrix:
|
|
Mojave DMG:
|
|
python.version: "3.9"
|
|
|
|
variables:
|
|
- group: Apple-Notarize-Variables
|
|
- group: AWS-Upload-Credentials
|
|
- group: GlueVariables
|
|
|
|
steps:
|
|
- checkout: self # self represents the repo where the initial Azure Pipelines YAML file was found
|
|
submodules: recursive
|
|
fetchDepth: 0
|
|
displayName: "Checkout code"
|
|
|
|
- task: UsePythonVersion@0
|
|
inputs:
|
|
versionSpec: "$(python.version)"
|
|
displayName: "Use Python $(python.version)"
|
|
|
|
# Install Apple certificate
|
|
# Install an Apple certificate required to build on a macOS agent machine
|
|
- task: InstallAppleCertificate@2
|
|
inputs:
|
|
certSecureFile: 'chia-apple-dev-id-app.p12'
|
|
certPwd: $(CHIA_APPLE_DEV_ID_APP_PASS)
|
|
keychain: temp
|
|
deleteCert: true
|
|
|
|
- script: |
|
|
python -m venv venv
|
|
ln -s venv/bin/activate .
|
|
. ./activate
|
|
python -m pip install --upgrade pip
|
|
pip install wheel pep517 setuptools_scm
|
|
node -v
|
|
pip install -i https://pypi.chia.net/simple/ miniupnpc==2.2.2
|
|
cd build_scripts
|
|
touch $(System.DefaultWorkingDirectory)/build_scripts/version.txt
|
|
python -m installer-version > $(System.DefaultWorkingDirectory)/build_scripts/version.txt
|
|
displayName: "Install dependencies"
|
|
|
|
- script: |
|
|
. ./activate
|
|
clang --version
|
|
pip wheel --use-pep517 --extra-index-url https://pypi.chia.net/simple/ --wheel-dir=wheels .
|
|
pip install --no-index --find-links=./wheels/ chia-blockchain
|
|
displayName: "Build and install wheels"
|
|
|
|
- task: NodeTool@0
|
|
inputs:
|
|
versionSpec: '14.x'
|
|
displayName: "Setup Node 14.x"
|
|
|
|
- bash: |
|
|
. ./activate
|
|
APPLE_NOTARIZE_USERNAME="$(APPLE_NOTARIZE_USERNAME)"
|
|
export APPLE_NOTARIZE_USERNAME
|
|
APPLE_NOTARIZE_PASSWORD="$(APPLE_NOTARIZE_PASSWORD)"
|
|
export APPLE_NOTARIZE_PASSWORD
|
|
if [ "$(APPLE_NOTARIZE_PASSWORD)" ]; then NOTARIZE="true"; export NOTARIZE; fi
|
|
git submodule update --init --recursive
|
|
cd build_scripts || exit
|
|
sh build_macos.sh
|
|
displayName: "Build DMG with build_scripts/build_macos.sh"
|
|
|
|
- task: PublishPipelineArtifact@1
|
|
inputs:
|
|
targetPath: $(System.DefaultWorkingDirectory)/wheels
|
|
artifactName: MacOS-wheels
|
|
displayName: "Upload MacOS wheels"
|
|
|
|
- task: PublishPipelineArtifact@1
|
|
inputs:
|
|
targetPath: $(System.DefaultWorkingDirectory)/build_scripts/final_installer/
|
|
artifactName: MacOS-DMG
|
|
displayName: "Upload MacOS DMG"
|
|
|
|
- bash: |
|
|
ls $(System.DefaultWorkingDirectory)/build_scripts/final_installer/
|
|
cd $(System.DefaultWorkingDirectory)/build_scripts/
|
|
export CHIA_VERSION="Chia-"$(<version.txt)
|
|
shasum -a 256 $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$CHIA_VERSION.dmg > $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$CHIA_VERSION.dmg.sha256
|
|
ls $(System.DefaultWorkingDirectory)/build_scripts/final_installer/
|
|
displayName: "Create Checksums"
|
|
|
|
- bash: |
|
|
export AWS_ACCESS_KEY_ID=$(AccessKey)
|
|
export AWS_SECRET_ACCESS_KEY=$(SecretKey)
|
|
export AWS_DEFAULT_REGION=us-west-2
|
|
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/*.dmg s3://download-chia-net/builds/
|
|
displayName: "Upload to S3"
|
|
|
|
- bash: |
|
|
cd $(System.DefaultWorkingDirectory)/build_scripts/
|
|
export CHIA_VERSION="Chia-"$(<version.txt)
|
|
|
|
pip3 install py3createtorrent
|
|
py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$CHIA_VERSION.dmg -o $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$CHIA_VERSION.dmg.torrent --webseed https://download-chia-net.s3.us-west-2.amazonaws.com/install/$CHIA_VERSION.dmg
|
|
ls
|
|
displayName: "Create torrent file"
|
|
condition: and(succeeded(), contains(variables['build.sourceBranch'], 'refs/tags/'))
|
|
|
|
- bash: |
|
|
export AWS_ACCESS_KEY_ID=$(AccessKey)
|
|
export AWS_SECRET_ACCESS_KEY=$(SecretKey)
|
|
export AWS_DEFAULT_REGION=us-west-2
|
|
cd $(System.DefaultWorkingDirectory)/build_scripts/
|
|
export CHIA_VERSION="Chia-"$(<version.txt)
|
|
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$CHIA_VERSION.dmg s3://download-chia-net/beta/Chia-intel_latest_beta.dmg
|
|
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$CHIA_VERSION.dmg.sha256 s3://download-chia-net/beta/Chia-intel_latest_beta.dmg.sha256
|
|
displayName: "Upload Beta Files"
|
|
condition: and(succeeded(), contains(variables['build.sourceBranch'], 'refs/heads/main'))
|
|
|
|
- bash: |
|
|
export AWS_ACCESS_KEY_ID=$(AccessKey)
|
|
export AWS_SECRET_ACCESS_KEY=$(SecretKey)
|
|
export AWS_DEFAULT_REGION=us-west-2
|
|
cd $(System.DefaultWorkingDirectory)/build_scripts/
|
|
export CHIA_VERSION="Chia-"$(<version.txt)
|
|
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$CHIA_VERSION.dmg s3://download-chia-net/install/
|
|
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$CHIA_VERSION.dmg.sha256 s3://download-chia-net/install/
|
|
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$CHIA_VERSION.dmg.torrent s3://download-chia-net/torrents/
|
|
displayName: "Upload Release Files"
|
|
condition: and(succeeded(), contains(variables['build.sourceBranch'], 'refs/tags/'))
|
|
|
|
- bash: |
|
|
cd $(System.DefaultWorkingDirectory)/build_scripts/
|
|
export CHIA_TAG=$(<version.txt)
|
|
export REPO_NAME=$(echo $(Build.Repository.Name) | cut -d'/' -f 2)
|
|
curl -s -XPOST -H "Authorization: Bearer $(GLUE_ACCESS_TOKEN)" --data "{\"chia_ref\": \"$CHIA_TAG\"}" $(GLUE_API_URL)/api/v1/${REPO_NAME}/${CHIA_TAG}/success/build-macos
|
|
displayName: "Mark installer complete"
|
|
condition: and(succeeded(), contains(variables['build.sourceBranch'], 'refs/tags/'))
|