-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
175 lines (171 loc) · 6.23 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- main
pr:
- main
pool:
vmImage: ubuntu-latest
parameters:
- name: bricks
type: object
default:
- name: handler-http
parameters: >
-p HOST='0.0.0.0' -p PORT=8080
run_tests: false
run_smoke_test: true
- name: handler-grpc
parameters: >
-p HOST='0.0.0.0' -p PORT=50051
run_tests: false
run_smoke_test: true
- name: repo-in-memory
parameters: ""
run_tests: false
run_smoke_test: true
- name: observability-structured-logging
parameters: >
-p STRUCTURED_LOG_FIELDS='{"level","message"}'
run_tests: false
run_smoke_test: true
- name: testing-catch2
parameters: ""
run_tests: true
run_smoke_test: true
- name: security-openid
parameters: >
-p OPENID_DEFAULT_URL='https://www.example.com/.well-known/openid-configuration'
run_tests: true
run_smoke_test: false
- name: security-jwt-auth
parameters: >
-p OPENID_DEFAULT_URL='https://www.example.com/.well-known/openid-configuration' -p JWT_AUTH_AUDIENCE='https://www.example.com' -p JWT_AUTH_REQUIRED_CLAIMS='{"scope"}'
run_tests: true
run_smoke_test: false
- name: repo-postgres
parameters: >
-p POSTGRES_CONNECTION_STRING='postgres://postgres:my_password@localhost:5432'
run_tests: true
run_smoke_test: false
- name: notifier-http
parameters: >
-p NOTIFIER_CONNECTION_STRING='http://localhost:8080' -p NOTIFIER_MAX_RETRY_COUNT=3 -p NOTIFIER_FIRST_RETRY_INTERVAL_MS=100
run_tests: false
run_smoke_test: true
- name: deploy-docker
parameters: >
-p PORT='8080' -p DOCKER_BASE_IMAGE='ubuntu:latest'
run_tests: false
run_smoke_test: true
- name: deploy-kubernetes
parameters: >
-p PORT='8080' -p DOCKER_BASE_IMAGE='ubuntu:latest' -p KUBERNETES_REPLICAS=3
run_tests: false
run_smoke_test: false
- name: repo-google-cloud-storage
parameters: >
-p PORT='8080' -p CLOUD_STORAGE_BUCKET='sapper-test-bucket' -p GOOGLE_APPLICATION_CREDENTIALS='key.json'
run_tests: false
run_smoke_test: false
- name: notifier-google-pubsub
parameters: >
-p GOOGLE_APPLICATION_CREDENTIALS='key.json' -p PUBSUB_TOPIC='my-topic' -p GOOGLE_PROJECT='my-project'
run_tests: false
run_smoke_test: false
- name: handler-google-pubsub
parameters: >
-p GOOGLE_APPLICATION_CREDENTIALS='key.json' -p PUBSUB_SUBSCRIPTION='my-subscription' -p GOOGLE_PROJECT='my-project'
run_tests: false
run_smoke_test: false
- name: handler-cli
parameters: ""
run_tests: false
run_smoke_test: false
- name: observability-opentelemetry-tracing
parameters: >
-p OPENTELEMETRY_HOST='localhost' -p OPENTELEMETRY_PORT='4318' -p OPENTELEMETRY_PROPAGATION_TYPE='B3_SingleHeader'
run_tests: false
run_smoke_test: false
- name: repo-redis
parameters: >
-p REDIS_CONNECTION_STRING='redis://default:my_password@localhost:6379/0'
run_tests: false
run_smoke_test: false
steps:
- task: GoTool@0
inputs:
version: '1.20.1'
- script: |
export GOBIN=/usr/local/bin/
go env -w GOPRIVATE=github.com/seboste/*
go install github.com/seboste/sapper@latest
sapper remote add current $PWD --insert=0
sapper remote remove sapper-bricks
displayName: 'install & configure sapper'
- script: |
pip install conan==1.60.1
conan profile new default --detect
conan profile update settings.compiler.libcxx=libstdc++11 default
displayName: install conan
- ${{ each brick in parameters.bricks }}:
- script: |
mkdir -p $(Agent.TempDirectory)/services
sapper service add $(Agent.TempDirectory)/services/${{ brick.name }}-service -p VERSION=1.0.0
if [ $? -ne 0 ]; then
exit 1
fi
sapper brick add ${{ brick.name }} --service $(Agent.TempDirectory)/services/${{ brick.name }}-service ${{ brick.parameters }}
if [ $? -ne 0 ]; then
exit 1
fi
sapper service build $(Agent.TempDirectory)/services/${{ brick.name }}-service
if [ $? -ne 0 ]; then
exit 1
fi
displayName: 'build ${{ brick.name }}-service'
condition: always()
- script: |
mkdir -p $(Agent.TempDirectory)/build_logs/${{ brick.name }}-service
mv /tmp/sapper_build_log_*.log $(Agent.TempDirectory)/build_logs/${{ brick.name }}-service || true
displayName: 'copy build logs ${{ brick.name }}-service'
condition: always()
- script: |
sapper service test $(Agent.TempDirectory)/services/${{ brick.name }}-service
displayName: 'test ${{ brick.name }}-service'
condition: eq(${{ brick.run_tests }}, true)
- script: |
mkdir -p $(Agent.TempDirectory)/test_reports/${{ brick.name }}-service
mv $(Agent.TempDirectory)/services/${{ brick.name }}-service/build/tests/test_report.xml $(Agent.TempDirectory)/test_reports/${{ brick.name }}-service/test_report.xml || true
displayName: 'move test report ${{ brick.name }}-service'
condition: eq(${{ brick.run_tests }}, true)
- script: |
sapper service run --stop-after 15s $(Agent.TempDirectory)/services/${{ brick.name }}-service
displayName: 'smoke test ${{ brick.name }}-service'
condition: eq(${{ brick.run_smoke_test }}, true)
- script: |
rm -rf $(Agent.TempDirectory)/services/${{ brick.name }}-service/build/src
displayName: 'cleanup ${{ brick.name }}-service'
condition: always()
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Agent.TempDirectory)/build_logs'
artifactType: 'pipeline'
artifactName: 'build_logs'
displayName: 'publish build logs'
condition: always()
- task: PublishTestResults@2
condition: always()
displayName: 'publish test results'
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '$(Agent.TempDirectory)/test_reports/**/test_report.xml'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Agent.TempDirectory)/services'
artifactType: 'pipeline'
artifactName: 'services'
displayName: 'publish services'
condition: always()