-
Notifications
You must be signed in to change notification settings - Fork 2
/
azure-pipelines.yml
67 lines (64 loc) · 2.19 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
trigger:
- master
pr:
- master
resources:
- repo: self
stages:
- stage: Build
displayName: Build & QA
jobs:
- job: Build
displayName: Build
pool:
vmImage: ubuntu-latest
steps:
- task: JavaToolInstaller@0
displayName: Ensure Java 11
inputs: # make sure Java 11 is installed and pointed to by JAVA_HOME, since the Sonar Scanner requires this to run
versionSpec: '11'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'
- task: Bash@3
displayName: Build & Code Analysis
inputs:
targetType: 'inline'
script: |
dotnet restore
dotnet tool restore
dotnet tool run dotnet-sonarscanner begin /o:"raimondb" /k:"RaimondB_Detecticam" /d:sonar.login="$(SONAR_TOKEN)" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.branch.name="$(Build.SourceBranchName)"
dotnet test
dotnet tool run dotnet-sonarscanner end /d:sonar.login="$(SONAR_TOKEN)"
env:
SONAR_TOKEN: $(SONAR_TOKEN)
- task: Bash@3
displayName: Integration Tests
inputs:
targetType: 'inline'
script: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker-compose -f DetectiCam/docker-compose.test.yml run sut
env: #provide secrets this way to have them available as an environment variable in a secure way
DOCKER_PASSWORD: $(DOCKER_PASSWORD)
- stage: Release
displayName: Release a new image on Dockerhub
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- job: Build
displayName: Build Docker & Release to DockerHub
pool:
vmImage: ubuntu-latest
steps:
- task: Npm@1
inputs: # Ensure that the semantic-release tool is installed as specified in the package.json
command: 'install'
- task: Bash@3
inputs:
targetType: 'inline'
script: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker build -f DetectiCam/Dockerfile . -t raimondb/detect-i-cam
npx semantic-release
env:
GH_TOKEN: $(GH_TOKEN)
DOCKER_PASSWORD: $(DOCKER_PASSWORD)