mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-09-20 16:08:51 +03:00
64c433b615
* Make sure to fail CI when unable to get madMAx version * fail more
154 lines
6.7 KiB
YAML
154 lines
6.7 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
|
|
- group: GitHub
|
|
|
|
steps:
|
|
- checkout: self # self represents the repo where the initial Azure Pipelines YAML file was found
|
|
submodules: recursive
|
|
fetchDepth: 0
|
|
displayName: "Checkout code"
|
|
|
|
- script: |
|
|
git config --global url."https://github.com/".insteadOf ssh://git@github.com/
|
|
displayName: "Use https for git instead of ssh"
|
|
|
|
- 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: |
|
|
python3 -m venv ../venv
|
|
. ../venv/bin/activate
|
|
pip install setuptools_scm
|
|
touch $(System.DefaultWorkingDirectory)/build_scripts/version.txt
|
|
python ./build_scripts/installer-version.py > $(System.DefaultWorkingDirectory)/build_scripts/version.txt
|
|
cat $(System.DefaultWorkingDirectory)/build_scripts/version.txt
|
|
deactivate
|
|
displayName: Create installer version number
|
|
|
|
- script: |
|
|
set -o errexit -o pipefail
|
|
MADMAX_VERSION=$(curl -u "$(GithubUsername):$(GithubToken)" --fail --silent "https://api.github.com/repos/Chia-Network/chia-plotter-madmax/releases/latest" | jq -r '.tag_name')
|
|
|
|
mkdir "$(System.DefaultWorkingDirectory)/madmax"
|
|
wget -O "$(System.DefaultWorkingDirectory)/madmax/chia_plot" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${MADMAX_VERSION}/chia_plot-${MADMAX_VERSION}-macos-intel
|
|
wget -O "$(System.DefaultWorkingDirectory)/madmax/chia_plot_k34" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${MADMAX_VERSION}/chia_plot_k34-${MADMAX_VERSION}-macos-intel
|
|
chmod +x "$(System.DefaultWorkingDirectory)/madmax/chia_plot"
|
|
chmod +x "$(System.DefaultWorkingDirectory)/madmax/chia_plot_k34"
|
|
displayName: "Get latest madmax release"
|
|
|
|
- script: |
|
|
sh install.sh
|
|
displayName: "Install dependencies"
|
|
|
|
- task: NodeTool@0
|
|
inputs:
|
|
versionSpec: '16.x'
|
|
displayName: "Setup Node 16.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"; else NOTARIZE="false"; fi
|
|
export NOTARIZE
|
|
cd build_scripts || exit
|
|
sh build_macos.sh
|
|
displayName: "Build DMG with build_scripts/build_macos.sh"
|
|
|
|
- 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/'))
|