release: shift appveyor to new process

In the process also move to InstallBuilder 18.2
This commit is contained in:
Aldo Cortesi 2018-03-07 14:05:26 +13:00
parent 780ff05f12
commit f8cce32562
4 changed files with 47 additions and 52 deletions

View File

@ -9,22 +9,8 @@ environment:
CI_DEPS: codecov>=2.0.5 CI_DEPS: codecov>=2.0.5
CI_COMMANDS: codecov CI_COMMANDS: codecov
matrix: matrix:
- PYTHON: "C:\\Python35" - PYTHON: "C:\\Python36"
TOXENV: "py35" TOXENV: "py36"
# TODO: ENABLE WHEN AVAILABLE
# - PYTHON: "C:\\Python36"
# TOXENV: "py36"
SNAPSHOT_HOST:
secure: NeTo57s2rJhCd/mjKHetXVxCFd3uhr8txnjnAXD1tUI=
SNAPSHOT_PORT:
secure: TiJPtg60/edYTH8RnoBErg==
SNAPSHOT_USER:
secure: 6yBwmO5gv4vAwoFYII8qjQ==
SNAPSHOT_PASS:
secure: LPjrtFrWxYhOVGXzfPRV1GjtZE/wHoKq9m/PI6hSalfysUK5p2DxTG9uHlb4Q9qV
RTOOL_KEY:
secure: 0a+UUNbA+JjquyAbda4fd0JmiwL06AdG6torRPdCvbPDbKHnaW/BHHp1nRPytOKM
install: install:
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
@ -36,17 +22,10 @@ test_script:
- ps: | - ps: |
$Env:VERSION = $(python -m mitmproxy.version) $Env:VERSION = $(python -m mitmproxy.version)
$Env:SKIP_MITMPROXY = "python -c `"print('skip mitmproxy')`"" $Env:SKIP_MITMPROXY = "python -c `"print('skip mitmproxy')`""
tox -e rtool -- wheel tox -e cibuild -- build
tox -e rtool -- bdist
- ps: | - ps: |
if( if($Env:RTOOL_KEY) {
($Env:TOXENV -match "py35") -and !$Env:APPVEYOR_PULL_REQUEST_NUMBER -and $ibVersion = "18.2.0"
(($Env:APPVEYOR_REPO_BRANCH -In ("master", "pyinstaller")) -or ($Env:APPVEYOR_REPO_TAG -match "true"))
) {
echo "Decrypt license..."
tox -e rtool -- decrypt release\installbuilder\license.xml.enc release\installbuilder\license.xml
$ibVersion = "17.12.0"
$ibSetup = "C:\projects\mitmproxy\release\installbuilder-installer.exe" $ibSetup = "C:\projects\mitmproxy\release\installbuilder-installer.exe"
$ibCli = "C:\Program Files (x86)\BitRock InstallBuilder Enterprise $ibVersion\bin\builder-cli.exe" $ibCli = "C:\Program Files (x86)\BitRock InstallBuilder Enterprise $ibVersion\bin\builder-cli.exe"
if (!(Test-Path $ibSetup)) { if (!(Test-Path $ibSetup)) {
@ -58,8 +37,8 @@ test_script:
} }
echo "Install InstallBuilder..." echo "Install InstallBuilder..."
Start-Process $ibSetup "--mode unattended --unattendedmodeui none" -PassThru -NoNewWindow -Wait Start-Process $ibSetup "--mode unattended --unattendedmodeui none" -PassThru -NoNewWindow -Wait
# Wait until executable exists - no idea why this is necessary. echo "Decrypt license..."
while (!(Test-Path $ibCli)) { Start-Sleep 0.1 } tox -e cibuild -- decrypt release\installbuilder\license.xml.enc release\installbuilder\license.xml
echo "Run InstallBuilder..." echo "Run InstallBuilder..."
&$ibCli ` &$ibCli `
build ` build `
@ -73,15 +52,7 @@ test_script:
} }
deploy_script: deploy_script:
# we build binaries on every run, but we only upload them for master snapshots or tags. ps: tox -e cibuild -- upload
ps: |
if(
($Env:TOXENV -match "py35") -and
(($Env:APPVEYOR_REPO_BRANCH -In ("master", "pyinstaller")) -or ($Env:APPVEYOR_REPO_TAG -match "true"))
) {
tox -e rtool -- decrypt release\known_hosts.enc release\known_hosts
tox -e rtool -- upload-snapshot --bdist --wheel --installer
}
cache: cache:
- C:\projects\mitmproxy\release\installbuilder-installer.exe -> .appveyor.yml - C:\projects\mitmproxy\release\installbuilder-installer.exe -> .appveyor.yml

View File

@ -10,6 +10,7 @@ import tarfile
import zipfile import zipfile
from os.path import join, abspath, dirname, exists, basename from os.path import join, abspath, dirname, exists, basename
import cryptography.fernet
import click import click
# https://virtualenv.pypa.io/en/latest/userguide.html#windows-notes # https://virtualenv.pypa.io/en/latest/userguide.html#windows-notes
@ -70,14 +71,17 @@ TOOLS = [
for tool in tools for tool in tools
] ]
if os.environ.get("TRAVIS_TAG", None): TAG = os.environ.get("TRAVIS_TAG", os.environ.get("APPVEYOR_REPO_TAG_NAME", None))
VERSION = os.environ["TRAVIS_TAG"] BRANCH = os.environ.get("TRAVIS_BRANCH", os.environ.get("APPVEYOR_REPO_BRANCH", None))
elif os.environ.get("TRAVIS_BRANCH", None) in SNAPSHOT_BRANCHES: if TAG:
VERSION = os.environ["TRAVIS_BRANCH"] VERSION = TAG
elif BRANCH in SNAPSHOT_BRANCHES:
VERSION = BRANCH
else: else:
print("Branch %s is not buildabranch - exiting." % os.environ.get("TRAVIS_BRANCH", None)) print("Branch %s is not build branch - exiting." % BRANCH)
sys.exit(0) sys.exit(0)
print("BUILD VERSION=%s" % VERSION) print("BUILD VERSION=%s" % VERSION)
@ -206,15 +210,25 @@ def upload():
""" """
Upload snapshot to snapshot server Upload snapshot to snapshot server
""" """
subprocess.check_call( if "AWS_ACCESS_KEY_ID" in os.environ:
[ subprocess.check_call(
"aws", "s3", "cp", [
"--acl", "public-read", "aws", "s3", "cp",
DIST_DIR + "/", "--acl", "public-read",
"s3://snapshots.mitmproxy.org/%s/" % VERSION, DIST_DIR + "/",
"--recursive", "s3://snapshots.mitmproxy.org/%s/" % VERSION,
] "--recursive",
) ]
)
@cli.command("decrypt")
@click.argument('infile', type=click.File('rb'))
@click.argument('outfile', type=click.File('wb'))
@click.argument('key', envvar='RTOOL_KEY')
def decrypt(infile, outfile, key):
f = cryptography.fernet.Fernet(key.encode())
outfile.write(f.decrypt(infile.read()))
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -11,6 +11,7 @@ import tarfile
import zipfile import zipfile
from os.path import join, abspath, dirname from os.path import join, abspath, dirname
import cryptography.fernet
import click import click
# https://virtualenv.pypa.io/en/latest/userguide.html#windows-notes # https://virtualenv.pypa.io/en/latest/userguide.html#windows-notes
@ -179,5 +180,14 @@ def homebrew_pr():
]) ])
@cli.command("encrypt")
@click.argument('infile', type=click.File('rb'))
@click.argument('outfile', type=click.File('wb'))
@click.argument('key', envvar='RTOOL_KEY')
def encrypt(infile, outfile, key):
f = cryptography.fernet.Fernet(key.encode())
outfile.write(f.encrypt(infile.read()))
if __name__ == "__main__": if __name__ == "__main__":
cli() cli()

View File

@ -46,7 +46,7 @@ commands =
pathoc --version pathoc --version
[testenv:cibuild] [testenv:cibuild]
passenv = TRAVIS_TAG TRAVIS_BRANCH AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY passenv = TRAVIS_TAG TRAVIS_BRANCH AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY APPVEYOR_REPO_TAG_NAME APPVEYOR_REPO_TAG APPVEYOR_REPO_BRANCH RTOOL_KEY
deps = deps =
-rrequirements.txt -rrequirements.txt
pyinstaller==3.3.1 pyinstaller==3.3.1