Skip to content

Commit be4d5f8

Browse files
committed
Set up CI with Azure Pipelines
[skip ci]
1 parent c49c02d commit be4d5f8

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

azure-pipelines.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Python to Linux Web App on Azure
2+
# Build your Python project and deploy it to Azure as a Linux Web App.
3+
# Change python version to one thats appropriate for your application.
4+
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
5+
6+
trigger:
7+
- master
8+
9+
variables:
10+
# Azure Resource Manager connection created during pipeline creation
11+
azureServiceConnectionId: '46d536ec-5239-4af0-a125-a24f121f9769'
12+
13+
# Web app name
14+
webAppName: 'pyhellonames'
15+
16+
# Agent VM image name
17+
vmImageName: 'ubuntu-latest'
18+
19+
# Environment name
20+
environmentName: 'pyhellonames'
21+
22+
# Project root folder. Point to the folder containing manage.py file.
23+
projectRoot: $(System.DefaultWorkingDirectory)
24+
25+
# Python version: 3.7
26+
pythonVersion: '3.7'
27+
28+
stages:
29+
- stage: Build
30+
displayName: Build stage
31+
jobs:
32+
- job: BuildJob
33+
pool:
34+
vmImage: $(vmImageName)
35+
steps:
36+
- task: UsePythonVersion@0
37+
inputs:
38+
versionSpec: '$(pythonVersion)'
39+
displayName: 'Use Python $(pythonVersion)'
40+
41+
- script: |
42+
python -m venv antenv
43+
source antenv/bin/activate
44+
python -m pip install --upgrade pip
45+
pip install setup
46+
pip install -r requirements.txt
47+
workingDirectory: $(projectRoot)
48+
displayName: "Install requirements"
49+
50+
- task: ArchiveFiles@2
51+
displayName: 'Archive files'
52+
inputs:
53+
rootFolderOrFile: '$(projectRoot)'
54+
includeRootFolder: false
55+
archiveType: zip
56+
archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
57+
replaceExistingArchive: true
58+
59+
- upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
60+
displayName: 'Upload package'
61+
artifact: drop
62+
63+
- stage: Deploy
64+
displayName: 'Deploy Web App'
65+
dependsOn: Build
66+
condition: succeeded()
67+
jobs:
68+
- deployment: DeploymentJob
69+
pool:
70+
vmImage: $(vmImageName)
71+
environment: $(environmentName)
72+
strategy:
73+
runOnce:
74+
deploy:
75+
steps:
76+
77+
- task: UsePythonVersion@0
78+
inputs:
79+
versionSpec: '$(pythonVersion)'
80+
displayName: 'Use Python version'
81+
82+
- task: AzureWebApp@1
83+
displayName: 'Deploy Azure Web App : pyhellonames'
84+
inputs:
85+
azureSubscription: $(azureServiceConnectionId)
86+
appName: $(webAppName)
87+
package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip

0 commit comments

Comments
 (0)