-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
109 lines (106 loc) · 2.8 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
trigger:
- dev-testing
resources:
- repo: self
variables:
tag: 'testing'
stages:
- stage: Build
displayName: Build and push images
jobs:
- job: Build
displayName: Build
pool:
vmImage: ubuntu-latest
steps:
- task: Docker@2
displayName: Build API
inputs:
command: build
repository: 'backend_api'
buildContext: '.'
containerRegistry: 'docker'
arguments: '--build-arg service=api'
dockerfile: 'Dockerfile'
tags: |
$(tag)
- task: Docker@2
displayName: Build statistic
inputs:
command: build
repository: 'backend_statistic'
buildContext: '.'
containerRegistry: 'docker'
arguments: '--build-arg service=statistic'
dockerfile: 'Dockerfile'
tags: |
$(tag)
- task: Docker@2
displayName: Push API
inputs:
command: push
repository: 'backend_api'
containerRegistry: 'docker'
tags: |
$(tag)
- task: Docker@2
displayName: Push statistic
inputs:
command: push
repository: 'backend_statistic'
containerRegistry: 'docker'
tags: |
$(tag)
- stage: Test
displayName: Test
jobs:
- job: Test
displayName: Test
pool:
vmImage: ubuntu-latest
steps:
- task: NodeTool@0
inputs:
versionSpec: '18.x'
displayName: 'Install Node.js'
- script: |
corepack enable pnpm
displayName: "Enable pnpm"
- script: |
pnpm install
displayName: "Install dependencies"
- script: |
pnpm test:ci
displayName: "Run tests and coverage"
- task: PublishTestResults@2
displayName: 'Publish test results'
condition: succeededOrFailed()
inputs:
testResultsFiles: 'junit.xml'
- task: PublishCodeCoverageResults@1
displayName: 'Publish coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: 'coverage/cobertura-coverage.xml'
- stage: Deploy
jobs:
- deployment: Deploy
displayName: Deploy
pool:
vmImage: 'ubuntu-latest'
environment: 'development'
strategy:
runOnce:
deploy:
steps:
- task: SSH@0
inputs:
sshEndpoint: 'development'
runOptions: 'inline'
inline: |
cd ~/infra/animakuro
docker compose pull backend_dev_api 2>&1
docker compose up -d backend_dev_api 2>&1
docker compose pull backend_dev_statistic 2>&1
docker compose up -d backend_dev_statistic 2>&1
readyTimeout: '20000'