aboutsummaryrefslogtreecommitdiffstats
path: root/.ci/uhd-build-docker-container.yml
blob: 9a3e5082fe29f77c61aa92ac893655cbf2474686 (plain)
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#
# Copyright 2021 Ettus Research, a National Instruments Brand
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#
trigger:
  branches:
    include:
    - master
  paths:
    include:
    - .ci/docker
    - .ci/uhd-build-docker-container.yml
pr:
  branches:
    include:
    - master
  paths:
    include:
    - .ci/docker
    - .ci/uhd-build-docker-container.yml

schedules:
- cron: "0 18 * * SAT"
  displayName: Weekly Docker Build master branch
  branches:
    include:
    - master
  always: true
- cron: "0 22 * * SAT"
  displayName: Weekly Docker Build UHD-4.1 branch
  branches:
    include:
    - UHD-4.1
  always: true

variables:
- template: uhd-pipeline-vars.yml
- name: linuxDockerImages
  value:
    "{'Fedora-33-builder':{'dockerOSName':'fedora33','dockerImageName':'uhd-builder-fedora33'},
    'Fedora-34-builder':{'dockerOSName':'fedora34','dockerImageName':'uhd-builder-fedora34'},
    'Ubuntu-1804-builder':{'dockerOSName':'ubuntu1804','dockerImageName':'uhd-builder-ubuntu1804'},
    'Ubuntu-2004-builder':{'dockerOSName':'ubuntu2004','dockerImageName':'uhd-builder-ubuntu2004'}}"
- name: winDockerImages
  value:
    "{'VS2017-x86-builder':{'dockerOSName':'win-vs17-v141-x86','dockerImageName':'uhd-builder-vs2017-v141-x86','cmakeCompiler':'Visual Studio 15 2017','cmakeArch':'Win32','vsArch':'x86','vsYear':'2017'},
    'VS2017-x64-builder':{'dockerOSName':'win-vs17-v141-x64','dockerImageName':'uhd-builder-vs2017-v141-x64','cmakeCompiler':'Visual Studio 15 2017','cmakeArch':'x64','vsArch':'x64','vsYear':'2017'},
    'VS2019-x86-builder':{'dockerOSName':'win-vs19-v142-x86','dockerImageName':'uhd-builder-vs2019-v142-x86','cmakeCompiler':'Visual Studio 16 2019','cmakeArch':'Win32','vsArch':'x86','vsYear':'2019'},
    'VS2019-x64-builder':{'dockerOSName':'win-vs19-v142-x64','dockerImageName':'uhd-builder-vs2019-v142-x64','cmakeCompiler':'Visual Studio 16 2019','cmakeArch':'x64','vsArch':'x64','vsYear':'2019'}}"

- name: ubuntuDebDockerImages
  # Match with Ubuntu images in linuxDockerImages
  value:
    "{'Ubuntu-1804-builder':{'dockerOSName':'ubuntu1804','dockerImageName':'uhd-builder-ubuntu1804','ubuntuReleaseName':'bionic'},
    'Ubuntu-2004-builder':{'dockerOSName':'ubuntu2004','dockerImageName':'uhd-builder-ubuntu2004','ubuntuReleaseName':'focal'}}"

- name: dockerImagePrefix
  value: 'rfsdr/'

jobs:
- job: build_image_linux
  displayName: Build Docker Image
  pool:
    name: Drivers-NIBuildFarm-RFMIBUILD
    demands:
      - agent.os -equals Linux
      - docker
  strategy:
    matrix: $[ variables.linuxDockerImages ]
  steps:
  - checkout: self
    clean: true
  - task: Docker@2
    displayName: Build Image
    inputs:
      command: 'build'
      Dockerfile: '$(Build.SourcesDirectory)/.ci/docker/$(dockerImageName).Dockerfile'
      containerRegistry: 'Docker / Artifactory - rnd-builds-local'
      repository: '$(dockerImagePrefix)$(dockerImageName)'
      tags: $(Build.BuildNumber)
      arguments: --no-cache --pull
  - task: Docker@2
    displayName: Push Image
    inputs:
      command: 'push'
      containerRegistry: 'Docker / Artifactory - rnd-builds-local'
      repository: '$(dockerImagePrefix)$(dockerImageName)'
      tags: $(Build.BuildNumber)

- job: test_image_linux
  displayName: Test Docker Image
  dependsOn: build_image_linux
  pool:
    name: Drivers-NIBuildFarm-RFMIBUILD
    demands:
      - agent.os -equals Linux
      - docker
  strategy:
    matrix: $[ variables.linuxDockerImages ]
  container:
    image: '$(dockerImagePrefix)$(dockerImageName):$(Build.BuildNumber)'
    endpoint: 'Docker / Artifactory - rnd-builds-local'
  workspace:
    clean: outputs
  steps:
  - checkout: self
    clean: true
  - script: |
        cd $(Build.BinariesDirectory)
        mkdir -p uhddev/build
        cd uhddev/build
        cmake $(Build.SourcesDirectory)/host
    displayName: Test image with cmake uhd
  - script: |
        cd $(Build.BinariesDirectory)
        mkdir -p uhddev/build-ninja
        cd uhddev/build-ninja
        cmake -G Ninja $(Build.SourcesDirectory)/host
    displayName: Test image with cmake ninja uhd

- job: build_image_win
  displayName: Build Docker Image Windows
  timeoutInMinutes: 120
  pool:
    name: de-dre-lab
    demands:
      - agent.os -equals Windows_NT
      - docker
  strategy:
    matrix: $[ variables.winDockerImages ]
    maxParallel: 2
  steps:
  - checkout: self
    clean: true
  - task: Docker@2
    displayName: Build Image
    inputs:
      command: 'build'
      Dockerfile: '$(Build.SourcesDirectory)/.ci/docker/$(dockerImageName).Dockerfile'
      containerRegistry: 'Docker / Artifactory - rnd-builds-local'
      repository: '$(dockerImagePrefix)$(dockerImageName)'
      tags: $(Build.BuildNumber)
      buildContext: $(Build.SourcesDirectory)
      arguments: --no-cache --pull
  - task: Docker@2
    displayName: Push Image
    inputs:
      command: 'push'
      containerRegistry: 'Docker / Artifactory - rnd-builds-local'
      repository: '$(dockerImagePrefix)$(dockerImageName)'
      tags: $(Build.BuildNumber)

- job: test_image_win
  displayName: Test Docker Image Windows
  dependsOn: build_image_win
  pool:
    name: de-dre-lab
    demands:
      - agent.os -equals Windows_NT
      - docker
  strategy:
    matrix: $[ variables.winDockerImages ]
  container:
    image: '$(dockerImagePrefix)$(dockerImageName):$(Build.BuildNumber)'
    endpoint: 'Docker / Artifactory - rnd-builds-local'
  workspace:
    clean: outputs
  steps:
  - checkout: self
    clean: true
  - script: |
        cd $(Build.BinariesDirectory)
        mkdir uhddev\build
        cd uhddev\build
        cmake $(Build.SourcesDirectory)/host ^
          -DVCPKG_TARGET_TRIPLET=uhd-$(vsArch)-windows-static-md ^
          -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALL_DIR%\scripts\buildsystems\vcpkg.cmake ^
          -G "$(cmakeCompiler)" -A $(cmakeArch)
    displayName: Test image with cmake uhd
  - script: |
        cd $(Build.BinariesDirectory)
        cd uhddev\build
        "C:\Program Files (x86)\Microsoft Visual Studio\$(vsYear)\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" $(vsArch)
    displayName: Load Visual C++ Env

- job: export_build_number
  displayName: Export Image List to Artifacts
  pool:
    name: Drivers-NIBuildFarm-RFMIBUILD
    demands: sh
  steps:
  - checkout: none
  - script: |
      cd $(Build.ArtifactStagingDirectory)
      touch $(UHDPipelineDockerImageArtifactName)
      echo "$(Build.BuildNumber)" > $(UHDPipelineDockerImageArtifactName)
      echo "${{ variables.dockerImagePrefix }}" >> $(UHDPipelineDockerImageArtifactName)
      echo "${{ variables.linuxDockerImages }}" >> $(UHDPipelineDockerImageArtifactName)
      echo "${{ variables.winDockerImages }}" >> $(UHDPipelineDockerImageArtifactName)
      echo "${{ variables.ubuntuDebDockerImages }}" >> $(UHDPipelineDockerImageArtifactName)
    displayName: Generate created image list
  - task: PublishPipelineArtifact@1
    inputs:
      targetPath: $(Build.ArtifactStagingDirectory)
      artifactName: $(UHDPipelineDockerImageArtifactName)
    displayName: Upload image list artifact