forked from plus3it/watchmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
157 lines (152 loc) · 5.56 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: $(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.rr)
trigger:
batch: true
branches:
include:
- main
- refs/tags/*
pr:
branches:
include:
- main
variables:
artifactDir: .pyinstaller
jobs:
- template: ci/azure-pipelines-template.yml
parameters:
tox_version: ''
jobs:
py310_64:
# keep an example of the syntax for building on multiple platforms
# image: [win16, win19]
image: [win19]
architecture: x64
py: "3.10"
py39_64:
image: [win19]
architecture: x64
py: "3.9"
py38_64:
image: [win19]
architecture: x64
py: "3.8"
py37_64:
image: [win19]
architecture: x64
py: "3.7"
py37_32:
image: [win19]
architecture: x86
py: "3.7"
py36_64:
image: [win19]
architecture: x64
py: "3.6"
- job: build
displayName: build standalone
pool:
vmImage: 'windows-2019'
variables:
py: "3.10"
architecture: "x64"
venv: $(System.DefaultWorkingDirectory)\venv
artifactDirFull: $(System.DefaultWorkingDirectory)\$(artifactDir)
steps:
- checkout: self
displayName: checkout source code (with submodules)
submodules: true
- task: UsePythonVersion@0
displayName: ${{ format('provision build python {0} ({1})', variables.py, variables.architecture) }}
inputs:
versionSpec: $(py)
architecture: $(architecture)
name: buildPython
- pwsh: |
$releaseVersion = (Select-String -Path setup.cfg -Pattern '^version = ').Line -replace '^(version = )(\d+\.\d+\.\d+).*$', '$2'
$priorVersion = (git describe --abbrev=0 --tags)
$isTag = "$(build.sourceBranch)" -match "refs/tags/"
$isRelease = $releaseVersion -ne $priorVersion
$ver = (git show -s --format=%cd --date=format:'%Y%m%d%H%M%S')
if (-not $isTag -and -not $isRelease) { (Get-Content setup.cfg) -replace '^(version = )(\d+\.\d+\.\d+).*$', ('$1$2.dev' + $ver) | Set-Content setup.cfg }
$BuildVersion = (Select-String -Path setup.cfg -Pattern '^version = ').Line -replace '^(version = )(.*)$', '$2'
echo "version = $BuildVersion"
displayName: mark dev version if needed
- script: $(buildPython.pythonLocation)\python -m pip install -r requirements\pip.txt
displayName: install python pip
- script: $(buildPython.pythonLocation)\python -m pip install -r requirements\basics.txt
displayName: install python basics
- script: $(buildPython.pythonLocation)\python -m virtualenv $(venv)
displayName: setup virtual environment
- pwsh: |
& $(venv)\Scripts\activate
ci/build.ps1
displayName: build standalone
- script: copy requirements\deploy.txt $(artifactDirFull)
displayName: include requirements.txt for deploy
- script: copy setup.cfg $(artifactDirFull)
displayName: include setup.cfg for deploy
- script: dir $(artifactDirFull)
displayName: see directory
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: $(artifactDirFull)
artifactName: $(artifactDir)
displayName: publish standalone artifacts
- deployment: deploy
displayName: deploy standalone to github and s3
dependsOn: build
condition: succeeded()
pool:
vmImage: 'windows-2019'
environment: 'standalone'
variables: # alternate syntax needed when using a group
- group: wam-windows-ci
- name: artifactDirFull
value: $(System.DefaultWorkingDirectory)\$(artifactDir)
strategy:
runOnce:
deploy:
steps:
- checkout: none
- download: none
- task: DownloadBuildArtifacts@1
displayName: download standalone artifacts
inputs:
artifactName: $(artifactDir)
downloadPath: $(System.DefaultWorkingDirectory)
- script: |
cd
dir $(artifactDir)
displayName: check artifacts
- task: S3Upload@1
displayName: upload dev standalone binaries to s3 (dev)
condition: eq(variables['build.sourceBranch'], 'refs/heads/main')
inputs:
awsCredentials: dev-lab
targetFolder: $(keyPrefix)
bucketName: $(devBucket)
sourceFolder: $(artifactDirFull)\dist\
- task: S3Upload@1
displayName: upload standalone binaries to s3 (release)
condition: startsWith(variables['build.sourceBranch'], 'refs/tags/')
inputs:
awsCredentials: dev-lab
targetFolder: $(keyPrefix)
bucketName: $(releaseBucket)
sourceFolder: $(artifactDirFull)\dist\
- pwsh: |
$ErrorActionPreference = "Stop"
$APP_VERSION = (Select-String -Path "$(artifactDirFull)\setup.cfg" -Pattern '^version = ').Line -replace '^(version = )(.*)$', '$2'
$APP_NAME = "watchmaker"
$env:SATS_SLUG = "plus3it/watchmaker"
$env:SATS_TAG = $APP_VERSION
$env:SATS_COMMITTISH = $env:BUILD_SOURCEVERSION
$env:SATS_BODY = "* [${APP_NAME} v${APP_VERSION} CHANGELOG](https://github.com/plus3it/${APP_NAME}/blob/${APP_VERSION}/CHANGELOG.md)\n* [${APP_NAME} v${APP_VERSION} SCAP REPORTS](https://watchmaker.cloudarmor.io/list.html#releases/${APP_VERSION}/scans/)"
$env:SATS_REL_NAME = "Release v${APP_VERSION}"
$env:SATS_FILES_FILE = "$(artifactDirFull)\satsuki-files.json"
python -m pip install -r "$(artifactDirFull)\deploy.txt"
satsuki
displayName: deploy to github with satsuki
condition: startsWith(variables['build.sourceBranch'], 'refs/tags/')
env:
SATS_TOKEN: $(githubToken)