batch-shipyard/appveyor.yml

186 строки
6.2 KiB
YAML
Исходник Обычный вид История

version: '{branch}-{build}'
clone_depth: 5
cache:
2017-11-04 00:27:44 +03:00
- '%LOCALAPPDATA%\pip\Cache'
environment:
2017-11-04 00:27:44 +03:00
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
PYTHON: "C:\\Python27-x64"
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "64"
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6"
PYTHON_ARCH: "64"
BLOBXFER_STORAGE_ACCOUNT_KEY:
secure: kc+BqqjCZH3FGmN+4ngtNa8p4p2CR93gTGB9ecXvAZBdeOC3aaQoAV1JSSxXemfYF1I8B8rWM6gp6YyFusqfkpH4KMTZAyI8pTzV9l8dDaKhTBfE21kYlXgsRpV+JUnj
BLOBXFER_STORAGE_ACCOUNT:
secure: Dlu9Wk8y1Mo4eGjx6cH6ex+35JEB2g7kpsK15bSZeAI=
2017-11-04 00:27:44 +03:00
DOCKER_USERNAME:
secure: S8n3Geq7JUkN7ZQKXo8CLg==
DOCKER_PASSWORD:
secure: BcI2Fs6IJeTfPq8cAD4KEQ==
DOCKER_IMAGE_TAG_PREFIX: "alfpark/batch-shipyard:"
init:
2017-11-04 00:27:44 +03:00
- echo %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%
install:
2017-11-04 00:27:44 +03:00
- pip install -r requirements.txt
- pip install --no-deps -r req_nodeps.txt
2017-11-04 00:27:44 +03:00
- pip install flake8
- pip list --format=columns --outdated
build: off
test_script:
2017-11-04 00:27:44 +03:00
- flake8 --statistics shipyard.py convoy\\*.py
- IF "%PYTHON_VERSION%"=="3.6" (
flake8 --statistics cascade\\*.py cargo\\*.py
)
after_test:
2017-11-04 00:27:44 +03:00
- echo is pr %APPVEYOR_PULL_REQUEST_NUMBER% is commit tag %APPVEYOR_REPO_TAG% name %APPVEYOR_REPO_TAG_NAME% branch %APPVEYOR_REPO_BRANCH%
- IF "%APPVEYOR_REPO_TAG%"=="true" IF "%PYTHON_VERSION%"=="3.6" (
2017-11-13 09:45:19 +03:00
set UPLOAD_NUGET=1&
2017-11-06 02:58:29 +03:00
echo %APPVEYOR_REPO_TAG_NAME%> site-extension\\version.txt &
nuget pack site-extension\\batch-shipyard.nuspec -Version %APPVEYOR_REPO_TAG_NAME% &
7z l batch-shipyard.*.nupkg &
appveyor PushArtifact batch-shipyard.%APPVEYOR_REPO_TAG_NAME%.nupkg || set UPLOAD_NUGET=0)
2017-11-04 00:27:44 +03:00
- ps: >-
if (!($env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null)) {
Write-Host "Build is from a PR, not creating binary"
2017-11-04 00:27:44 +03:00
return
}
if (!($env:PYTHON_VERSION -eq "3.6")) {
Write-Host "Python environment is not 3.6, not creating binary"
return
}
if ($env:APPVEYOR_REPO_TAG -eq "true") {
$env:BATCH_SHIPYARD_CLI_ARITFACT = "batch-shipyard-" + $env:APPVEYOR_REPO_TAG_NAME + "-cli-win-amd64.exe"
$env:UPLOAD_PATH="releases/" + $env:APPVEYOR_REPO_TAG_NAME
}
else {
if ($env:APPVEYOR_REPO_BRANCH -eq "master" -Or $env:APPVEYOR_REPO_BRANCH -eq "develop") {
$env:BATCH_SHIPYARD_CLI_ARITFACT = "batch-shipyard-" + $env:APPVEYOR_REPO_BRANCH + "-" + $env:APPVEYOR_BUILD_NUMBER + "-cli-win-amd64.exe"
$env:UPLOAD_PATH="builds/" + $env:APPVEYOR_REPO_BRANCH
}
else {
Write-Host "Invalid tag or branch $env:APPVEYOR_REPO_BRANCH to build binary"
return
}
}
- IF "%BATCH_SHIPYARD_CLI_ARITFACT%"=="" (
echo "Batch Shipyard CLI artifact not defined"
) ELSE (
echo "Batch Shipyard CLI is %BATCH_SHIPYARD_CLI_ARITFACT% upload path %UPLOAD_PATH%" &&
virtualenv -p "%PYTHON%\\python.exe" pyi &&
pyi\\Scripts\\activate.bat &&
pip install pyinstaller &&
pip install --upgrade -r requirements.txt &&
pip install --upgrade --no-deps -r req_nodeps.txt &&
pyinstaller -F -n "%BATCH_SHIPYARD_CLI_ARITFACT%" -p batch-shipyard --add-data schemas;schemas --add-data scripts;scripts --exclude-module future.tests --exclude-module future.backports.test --exclude-module future.moves.test --distpath bin shipyard.py &&
pyi\\Scripts\\deactivate.bat &&
appveyor PushArtifact "bin\\%BATCH_SHIPYARD_CLI_ARITFACT%" &&
pip install --upgrade blobxfer &&
blobxfer upload --remote-path %UPLOAD_PATH% --local-path bin\\%BATCH_SHIPYARD_CLI_ARITFACT% --strip-components 1 --file-md5 --overwrite
)
- ps: >-
if (!($env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null)) {
Write-Host "Build is from a PR, not creating a Docker image for cargo"
return
}
if (!($env:PYTHON_VERSION -eq "3.6")) {
Write-Host "Python environment is not 3.6, not creating a Docker image for cargo"
return
}
$DOCKER_IMAGE_TAG_SUFFIX = $null
if ($env:APPVEYOR_REPO_TAG -eq "true") {
$DOCKER_IMAGE_TAG_SUFFIX = $env:APPVEYOR_REPO_TAG_NAME + '-cargo-windows'
}
if ($DOCKER_IMAGE_TAG_SUFFIX -eq $null) {
Write-Host "Image tag suffix is null, not creating a Docker image for cargo"
return
}
$DOCKER_IMAGE_TAG = $env:DOCKER_IMAGE_TAG_PREFIX + $DOCKER_IMAGE_TAG_SUFFIX
Write-Host "Creating Docker image for cargo with tag: $DOCKER_IMAGE_TAG"
docker version
pushd docker\\windows\\cargo
docker build --build-arg GIT_BRANCH=$env:APPVEYOR_REPO_BRANCH --build-arg GIT_COMMIT=$env:APPVEYOR_REPO_COMMIT -t $DOCKER_IMAGE_TAG .
docker login -u="$env:DOCKER_USERNAME" -p="$env:DOCKER_PASSWORD"
docker push $DOCKER_IMAGE_TAG
popd
- ps: >-
if (!($env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null)) {
Write-Host "Build is from a PR, not creating a Docker image for CLI"
return
}
if (!($env:PYTHON_VERSION -eq "3.6")) {
Write-Host "Python environment is not 3.6, not creating a Docker image for CLI"
2017-11-04 00:27:44 +03:00
return
}
2017-11-04 00:27:44 +03:00
$DOCKER_IMAGE_TAG_SUFFIX = $null
if ($env:APPVEYOR_REPO_TAG -eq "true") {
$DOCKER_IMAGE_TAG_SUFFIX = $env:APPVEYOR_REPO_TAG_NAME + '-cli-windows'
2017-11-04 00:27:44 +03:00
}
if ($DOCKER_IMAGE_TAG_SUFFIX -eq $null) {
Write-Host "Image tag suffix is null, not creating a Docker image for CLI"
2017-11-04 00:27:44 +03:00
return
}
$DOCKER_IMAGE_TAG = $env:DOCKER_IMAGE_TAG_PREFIX + $DOCKER_IMAGE_TAG_SUFFIX
Write-Host "Creating Docker image for CLI with tag: $DOCKER_IMAGE_TAG"
2017-11-04 00:27:44 +03:00
docker version
pushd docker\\windows\\cli
2017-11-04 00:27:44 +03:00
docker build --build-arg GIT_BRANCH=$env:APPVEYOR_REPO_BRANCH --build-arg GIT_COMMIT=$env:APPVEYOR_REPO_COMMIT -t $DOCKER_IMAGE_TAG .
docker login -u="$env:DOCKER_USERNAME" -p="$env:DOCKER_PASSWORD"
docker push $DOCKER_IMAGE_TAG
popd
deploy:
- provider: NuGet
server: https://www.siteextensions.net
api_key:
secure: 7rnRHiBwGPW086Rgcn+acev2aG53VmVFnoklGqr589FJtHaMfJBL8gz/R35ZLh3+
skip_symbols: true
artifact: /.*\.nupkg/
on:
appveyor_repo_tag: true
PYTHON_VERSION: "3.6"
2017-11-06 02:58:29 +03:00
UPLOAD_NUGET: "1"
- provider: GitHub
tag: $(APPVEYOR_REPO_TAG_NAME)
description: 'Batch Shipyard release'
auth_token:
secure: +f4N6Qsv3HvJyii0Bs+8qBx3YS7+7FJUWbFSiAdEIUDubFQnNkJgFnBw0Ew2SLkv
artifact: /.*\.exe/
draft: true
prerelease: true
force_update: true
on:
appveyor_repo_tag: true
PYTHON_VERSION: "3.6"