forked from SupermanPea/peas-blockchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
143 lines (124 loc) · 5.6 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# 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: 'peas-apple-dev-id-app.p12'
certPwd: $(PEAS_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.peas.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.peas.net/simple/ --wheel-dir=wheels .
pip install --no-index --find-links=./wheels/ peas-blockchain
displayName: "Build and install wheels"
- task: NodeTool@0
inputs:
versionSpec: '12.x'
displayName: "Setup Node 12.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/
cat $(System.DefaultWorkingDirectory)/build_scripts/version.txt
displayName: "list files in dir"
- bash: |
ls $(System.DefaultWorkingDirectory)/build_scripts/final_installer/
cd $(System.DefaultWorkingDirectory)/build_scripts/
export PEAS_VERSION="Peas-"$(<version.txt)
shasum -a 256 $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$PEAS_VERSION.dmg > $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$PEAS_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-peas-net/builds/
displayName: "Upload to S3"
- bash: |
cd $(System.DefaultWorkingDirectory)/build_scripts/
export PEAS_VERSION="Peas-"$(<version.txt)
pip3 install py3createtorrent
py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$PEAS_VERSION.dmg -o $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$PEAS_VERSION.dmg.torrent --webseed https://download-peas-net.s3.us-west-2.amazonaws.com/install/$PEAS_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 PEAS_VERSION="Peas-"$(<version.txt)
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$PEAS_VERSION.dmg s3://download-peas-net/install/
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$PEAS_VERSION.dmg.sha256 s3://download-peas-net/install/
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$PEAS_VERSION.dmg.torrent s3://download-peas-net/torrents/
displayName: "Upload Release Files"
condition: and(succeeded(), contains(variables['build.sourceBranch'], 'refs/tags/'))
- bash: |
cd $(System.DefaultWorkingDirectory)/build_scripts/
export PEAS_TAG=$(<version.txt)
export REPO_NAME=$(echo $(Build.Repository.Name) | cut -d'/' -f 2)
curl -s -XPOST -H "Authorization: Bearer $(GLUE_ACCESS_TOKEN)" --data "{\"peas_ref\": \"$PEAS_TAG\"}" $(GLUE_API_URL)/api/v1/${REPO_NAME}/${PEAS_TAG}/success/build-macos
displayName: "Mark installer complete"
condition: and(succeeded(), contains(variables['build.sourceBranch'], 'refs/tags/'))