forked from monicahq/monica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
159 lines (147 loc) · 4.38 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
158
159
# PHP
# Test and package your PHP project.
# Add steps that run tests, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/php
trigger:
batch: 'true'
branches:
include:
- master
exclude:
- 'l10n_master*'
tags:
include:
- '*'
pr:
autoCancel: 'true'
branches:
include:
- '*'
exclude:
- 'l10n_master*'
variables:
phpVersion: 7.2
COMPOSER_HOME: $(Agent.BuildDirectory)/.composer
stages:
- stage: build
displayName: 'Build'
jobs:
- template: .azure/build-job.yml
- job: tests
pool:
vmImage: 'ubuntu-latest'
strategy:
parallel: 4
steps:
- template: .azure/prepare-environment-step.yml
- template: .azure/composer-install-step.yml
- template: .azure/remove-xdebug-step.yml
- template: .azure/prepare-db-step.yml
- template: .azure/seed-test-db-step.yml
- template: .azure/unit-tests-step.yml
- job: psalm
pool:
vmImage: 'ubuntu-latest'
steps:
- template: .azure/prepare-environment-step.yml
- template: .azure/composer-install-step.yml
- bash: vendor/bin/psalm --show-info=false
displayName: 'Run psalm'
- job: phpstan
pool:
vmImage: 'ubuntu-latest'
steps:
- template: .azure/prepare-environment-step.yml
- template: .azure/composer-install-step.yml
- bash: php artisan code:analyse
displayName: 'Run phpstan'
- template: .azure/test-browser-job.yml
- job: reporting
dependsOn:
- tests
- tests_browser
pool:
vmImage: 'ubuntu-latest'
steps:
- template: .azure/prepare-environment-step.yml
- template: .azure/composer-install-step.yml
- task: DownloadPipelineArtifact@1
inputs:
artifactName: 'results'
downloadPath: $(System.DefaultWorkingDirectory)/results
- task: DownloadPipelineArtifact@1
inputs:
artifactName: 'results1'
downloadPath: $(System.DefaultWorkingDirectory)/results
- task: DownloadPipelineArtifact@1
inputs:
artifactName: 'results2'
downloadPath: $(System.DefaultWorkingDirectory)/results
- task: DownloadPipelineArtifact@1
inputs:
artifactName: 'results3'
downloadPath: $(System.DefaultWorkingDirectory)/results
- task: DownloadPipelineArtifact@1
inputs:
artifactName: 'results4'
downloadPath: $(System.DefaultWorkingDirectory)/results
- bash: |
yarn global add junit-merge
$(yarn global bin)/junit-merge --recursive --dir results/junit --out results/results.xml
ls results/results.xml
displayName: 'Merge junit files'
- template: .azure/runsonar-step.yml
- stage: deploy
displayName: 'Deploy'
dependsOn: build
condition: in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI')
jobs:
- job: deployAssets
pool:
vmImage: 'ubuntu-latest'
steps:
- bash: make assets
- bash: make push_bintray_assets
env:
BINTRAY_USER: $(BINTRAY_USER)
BINTRAY_APIKEY: $(BINTRAY_APIKEY)
- job: deploy_dist
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
pool:
vmImage: 'ubuntu-latest'
steps:
- template: .azure/composer-install-step.yml
parameters:
no_dev: 'true'
- bash: make dist
- bash: make push_bintray_dist
env:
BINTRAY_USER: $(BINTRAY_USER)
BINTRAY_APIKEY: $(BINTRAY_APIKEY)
- job: deploy_docker_master
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
pool:
vmImage: 'ubuntu-latest'
steps:
- template: .azure/prepare-environment-step.yml
- template: .azure/docker-build-step.yml
- template: .azure/docker-push-bintray-step.yml
- job: deploy_docker
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
pool:
vmImage: 'ubuntu-latest'
steps:
- template: .azure/prepare-environment-step.yml
- template: .azure/docker-build-step.yml
- template: .azure/docker-push-bintray-step.yml
- bash: |
echo $DOCKER_LOGIN | docker login -u $DOCKER_USER --password-stdin
make docker_tag
make docker_push
# notify microbadger to update
# https://microbadger.com/images/monicahq/monicahq
curl -X POST $MICROBADGER_WEBHOOK
displayName: 'Publish docker image'
env:
MICROBADGER_WEBHOOK: $(MICROBADGER_WEBHOOK)
DOCKER_LOGIN: $(DOCKER_LOGIN)