-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
54 lines (48 loc) · 1.39 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
trigger:
- main
jobs:
- job: Build
displayName: 'Build'
pool:
vmImage: 'ubuntu-latest'
steps:
- script: echo Hello, world!
displayName: 'Run a one-line script'
- job: Test
displayName: 'Run Tests'
dependsOn: Build
condition: succeeded()
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
addToPath: true
- script: |
echo Installing dependencies...
python -m pip install --upgrade pip
pip install -r ./api/requirements.txt
echo Running tests...
python -m pytest ./api/tests
displayName: 'Install dependencies and run tests'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: pytest
testResultsFiles: '**/test-results.xml'
- job: Push
displayName: 'Push'
dependsOn: Test
condition: succeeded()
steps:
- script: |
echo Logging into Docker Hub...
docker login -u $(dockerhub.username) -p $(dockerhub.password)
echo Building and pushing Flask app image...
docker build -t shayawn/devops-assessment-app-api ./api
docker push shayawn/devops-assessment-app-api
echo Building and pushing React app image...
docker build -t shayawn/devops-assessment-app-frontend ./frontend
docker push shayawn/devops-assessment-app-frontend
displayName: 'Build and push Docker images'