blob: d419033988c27dc4d014ec86f9a14537d27f8003 [file] [log] [blame]
Sam Elliottd2028282020-06-02 18:18:54 +01001# Copyright lowRISC contributors.
2# Licensed under the Apache License, Version 2.0, see LICENSE for details.
3# SPDX-License-Identifier: Apache-2.0
4#
lowRISC Contributors802543a2019-08-31 12:12:56 +01005# Azure Pipelines CI build configuration
6# Documentation at https://aka.ms/yaml
7
8variables:
Rupert Swarbrickdf237122021-04-20 14:43:48 +01009 #
Alphan Ulusoye2205892021-05-13 09:36:17 -040010 # If updating VERILATOR_VERSION, OPENOCD_VERSION, TOOLCHAIN_VERSION or RUST_VERSION
11 # update the definitions in util/container/Dockerfile as well.
Rupert Swarbrickdf237122021-04-20 14:43:48 +010012 #
Philipp Wagnerb27f72d2021-07-23 14:41:20 +010013 VERILATOR_VERSION: 4.210
Philipp Wagnerb02d9c82021-02-24 15:00:54 +000014 OPENOCD_VERSION: 0.11.0
Miguel Osorio88179fc2019-09-19 23:37:48 -070015 TOOLCHAIN_PATH: /opt/buildcache/riscv
Michael Schaffner6c1f1da2022-04-19 12:40:58 -070016 VERIBLE_VERSION: v0.0-2135-gb534c1fe
Jon Flatleyaa91c772022-02-16 17:00:27 -050017 RUST_VERSION: 1.58.0
Miguel Osorio88179fc2019-09-19 23:37:48 -070018 # Release tag from https://github.com/lowRISC/lowrisc-toolchains/releases
Luís Marques01b2cac2022-02-10 21:48:11 +000019 TOOLCHAIN_VERSION: 20220210-1
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -060020 # This controls where builds happen, and gets picked up by build_consts.sh.
21 BUILD_ROOT: $(Build.ArtifactStagingDirectory)
Philipp Wagnerb8b053f2021-05-25 09:26:34 +010022 VIVADO_VERSION: "2020.2"
lowRISC Contributors802543a2019-08-31 12:12:56 +010023
24trigger:
lowRISC Contributors802543a2019-08-31 12:12:56 +010025 batch: true
26 branches:
27 include:
Philipp Wagnerf565b662020-07-22 14:04:40 +010028 - "*"
Philipp Wagnerdd1706e2020-03-15 14:39:59 +000029 tags:
30 include:
31 - "*"
32pr:
33 branches:
34 include:
Philipp Wagnerf565b662020-07-22 14:04:40 +010035 - "*"
lowRISC Contributors802543a2019-08-31 12:12:56 +010036
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000037jobs:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060038- job: lint
Sam Elliott67e30fa2020-10-06 18:08:05 +010039 displayName: Run code quality checks (quick lint)
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000040 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +010041 vmImage: ubuntu-18.04
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000042 steps:
43 - bash: |
Garret Kellyf5608d02019-11-01 16:28:11 -040044 sudo apt-get remove -y clang-6.0 libclang-common-6.0-dev libclang1-6.0 libllvm6.0
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060045 displayName: Remove existing Clang installation
46 - template: ci/install-package-dependencies.yml
Rupert Swarbrick105df012021-01-29 11:33:13 +000047 ## !!!
48 ##
49 ## The steps below here are duplicated in ci/jobs/quick-lint.sh
50 ## to allow developers to "run CI" locally. Keep them in sync.
51 ##
52 ## !!!
53 - bash: ci/scripts/show-env.sh
Philipp Wagner99862392020-07-22 13:32:34 +010054 displayName: Display environment information
Rupert Swarbrick105df012021-01-29 11:33:13 +000055 - bash: ci/scripts/lint-commits.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Philipp Wagner93cdcef2021-01-19 14:31:47 +000056 condition: eq(variables['Build.Reason'], 'PullRequest')
57 displayName: Check commit metadata
Rupert Swarbrick105df012021-01-29 11:33:13 +000058 - bash: ci/scripts/check-licence-headers.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Philipp Wagner93cdcef2021-01-19 14:31:47 +000059 condition: eq(variables['Build.Reason'], 'PullRequest')
60 displayName: Check Licence Headers
Rupert Swarbrickf0d5b0c2021-03-26 11:48:42 +000061 - bash: ci/scripts/exec-check.sh
62 condition: eq(variables['Build.Reason'], 'PullRequest')
63 displayName: Check executable bits
Rupert Swarbrick5dc62b02021-04-28 09:39:18 +010064 - bash: ci/scripts/check-ascii.sh
65 condition: eq(variables['Build.Reason'], 'PullRequest')
66 displayName: Check for non-ASCII characters in source code
Rupert Swarbrick105df012021-01-29 11:33:13 +000067 - bash: ci/scripts/python-lint.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Rupert Swarbrickfb9fdb62021-02-01 17:30:48 +000068 condition: eq(variables['Build.Reason'], 'PullRequest')
Rupert Swarbrick746f9b12021-03-26 17:19:00 +000069 displayName: Run Python lint (flake8)
Rupert Swarbrick2d70c752020-03-24 17:23:40 +000070 continueOnError: true
Rupert Swarbrick746f9b12021-03-26 17:19:00 +000071 - bash: ci/scripts/mypy.sh
72 condition: eq(variables['Build.Reason'], 'PullRequest')
73 displayName: Run Python lint (mypy)
Rupert Swarbrick105df012021-01-29 11:33:13 +000074 - bash: ci/scripts/check-generated.sh
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060075 displayName: Ensure all generated files are clean and up-to-date
Rupert Swarbrick105df012021-01-29 11:33:13 +000076 - bash: ci/scripts/clang-format.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000077 condition: eq(variables['Build.Reason'], 'PullRequest')
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060078 displayName: Use clang-format to check C/C++ coding style
Michał Mazureka7f3bad2022-04-22 20:35:58 +020079 - bash: ci/scripts/rust-format.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
80 condition: eq(variables['Build.Reason'], 'PullRequest')
81 displayName: Use rustfmt to check Rust coding style
Rupert Swarbrick105df012021-01-29 11:33:13 +000082 - bash: ci/scripts/include-guard.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Miguel Young de la Sotab23dc8c2020-01-14 13:52:33 -050083 condition: eq(variables['Build.Reason'], 'PullRequest')
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060084 displayName: Check formatting on header guards
Miguel Young de la Sotacf77e212022-04-21 12:03:48 -040085 - bash: ci/scripts/whitespace.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
86 condition: eq(variables['Build.Reason'], 'PullRequest')
87 displayName: Check trailing whitespace
Rupert Swarbrick105df012021-01-29 11:33:13 +000088 - bash: ci/scripts/build-docs.sh
Philipp Wagner93cdcef2021-01-19 14:31:47 +000089 displayName: Render documentation
Rupert Swarbrick105df012021-01-29 11:33:13 +000090 - bash: ci/scripts/build-site.sh
Philipp Wagner93cdcef2021-01-19 14:31:47 +000091 displayName: Render landing site
Rupert Swarbrickfb9fdb62021-02-01 17:30:48 +000092 - bash: ci/scripts/get-build-type.sh "$SYSTEM_PULLREQUEST_TARGETBRANCH" "$(Build.Reason)"
Greg Chadwick99fe0642020-08-04 15:42:45 +010093 displayName: Check what kinds of changes the PR contains
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000094 name: DetermineBuildType
Philipp Wagner1e643552019-09-04 15:39:14 +010095
Sam Elliott67e30fa2020-10-06 18:08:05 +010096- job: slow_lints
97 displayName: Run code quality checks (in-depth lint)
98 dependsOn: lint
99 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100100 vmImage: ubuntu-18.04
Sam Elliott67e30fa2020-10-06 18:08:05 +0100101 steps:
102 - template: ci/install-package-dependencies.yml
Miguel Young de la Sota369e0272022-04-21 13:14:23 -0400103 - bash: ci/bazelisk.sh run buildifier_check
Drew Macrae932a70a2022-04-18 16:34:13 -0400104 displayName: Use buildifier to check Bazel coding style
Rupert Swarbrick2aff11b2021-02-16 17:11:37 +0000105 - bash: ci/scripts/check-vendoring.sh
Sam Elliott67e30fa2020-10-06 18:08:05 +0100106 displayName: Check vendored directories are up-to-date
Miles Daid10f3112022-05-10 10:48:17 -0400107 - bash: ci/scripts/verible-lint.sh rtl
108 condition: eq(variables['Build.Reason'], 'PullRequest')
109 displayName: Style-Lint RTL Verilog source files with Verible
110 - bash: ci/scripts/verible-lint.sh dv
111 condition: eq(variables['Build.Reason'], 'PullRequest')
112 displayName: Style-Lint DV Verilog source files with Verible
113 - bash: ci/scripts/verible-lint.sh fpv
114 condition: eq(variables['Build.Reason'], 'PullRequest')
115 displayName: Style-Lint FPV Verilog source files with Verible
Sam Elliott67e30fa2020-10-06 18:08:05 +0100116
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600117- job: sw_build
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100118 displayName: Build Software for Earl Grey toplevel design
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000119 dependsOn: lint
Philipp Wagner9d20ee62019-11-29 14:27:28 +0000120 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
Miles Dai9125a782022-04-13 11:35:09 -0400121 pool: ci-public
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000122 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600123 - template: ci/install-package-dependencies.yml
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000124 - bash: |
125 set -x
126 sudo util/get-toolchain.py \
Srikrishna Iyer98333ba2020-11-16 23:12:29 -0800127 --install-dir="$TOOLCHAIN_PATH" \
Sam Elliotteb8ace42020-06-03 17:47:55 +0100128 --release-version="$TOOLCHAIN_VERSION" \
Philipp Wagner1c514412019-11-27 14:48:47 +0000129 --update
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600130 displayName: Install toolchain
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000131 - bash: |
Miguel Young de la Sota63793572019-11-13 14:18:51 -0600132 . util/build_consts.sh
Miguel Young de la Sota4a4946d2019-11-21 10:44:18 -0600133 ./meson_init.sh -A
Miguel Young de la Sota76526c32020-01-28 10:24:41 -0500134 ninja -C "$OBJ_DIR" all
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600135 displayName: Build embedded targets
Miguel Young de la Sota9d20b3d2020-02-03 16:35:31 -0500136 - bash: |
137 . util/build_consts.sh
138 ninja -C "$OBJ_DIR" test
Sam Elliotteb8ace42020-06-03 17:47:55 +0100139 displayName: Run unit tests
140 - template: ci/upload-artifacts-template.yml
Miguel Young de la Sotab4df8602019-11-21 12:44:11 -0600141 parameters:
Philipp Wagner5aa7ed32021-02-02 18:53:36 +0000142 includePatterns:
143 - "/sw/***"
lowRISC Contributors802543a2019-08-31 12:12:56 +0100144
Greg Chadwickb045dd82022-02-15 11:29:24 +0000145- job: cw310_sw_build
146 displayName: Build Software required for CW310 FPGA synthesis
147 dependsOn: lint
148 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
149 pool:
150 vmImage: ubuntu-18.04
151 steps:
152 - template: ci/install-package-dependencies.yml
153 - bash: |
154 set -x
155 sudo util/get-toolchain.py \
156 --install-dir="$TOOLCHAIN_PATH" \
157 --release-version="$TOOLCHAIN_VERSION" \
158 --update
159 displayName: Install toolchain
160 - bash: |
161 . util/build_consts.sh
162 ./meson_init.sh -A
163 ninja -C "$OBJ_DIR" \
164 sw/device/otp_img/otp_img_export_fpga_cw310 \
165 sw/device/lib/testing/test_rom/test_rom_export_fpga_cw310
166 displayName: Build embedded targets
167 - template: ci/upload-artifacts-template.yml
168 parameters:
169 includePatterns:
170 - "/sw/***"
171
Pirmin Vogel18d8e132021-08-03 14:35:29 +0200172# Software targeting the English Breakfast top level is produced by patching
173# the source tree before building. This builds a selected subset of software
174# only.
175# TODO: This is a rather ugly hack, which will go away once we properly support
176# building more than one top-level design with different parametrizations.
177# Work towards this goal is tracked in issue #4669.
178- job: sw_build_englishbreakfast
179 displayName: Build Software for English Breakfast toplevel design
180 dependsOn: lint
181 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
182 pool:
183 vmImage: ubuntu-18.04
184 steps:
185 - template: ci/install-package-dependencies.yml
186 - bash: |
187 set -x
188 sudo util/get-toolchain.py \
189 --install-dir="$TOOLCHAIN_PATH" \
190 --release-version="$TOOLCHAIN_VERSION" \
191 --update
192 displayName: Install toolchain
193 - bash: |
194 . util/build_consts.sh
195 ./meson_init.sh -A
196 # Patch software.
197 ./hw/top_englishbreakfast/util/prepare_sw.py
198 # Build FPGA boot ROM and aes_serial binary for FPGA SCA.
Timothy Trippel961b2cd2021-12-14 22:28:58 +0000199 ninja -C "$OBJ_DIR" sw/device/lib/testing/test_rom/test_rom_export_fpga_nexysvideo
Pirmin Vogel18d8e132021-08-03 14:35:29 +0200200 ninja -C "$OBJ_DIR" sw/device/sca/aes_serial_export_fpga_nexysvideo
201 # Build binaries for Verilator simulation.
Timothy Trippel961b2cd2021-12-14 22:28:58 +0000202 ninja -C "$OBJ_DIR" sw/device/lib/testing/test_rom/test_rom_export_sim_verilator
Timothy Trippel0703f962021-09-02 21:08:20 +0000203 ninja -C "$OBJ_DIR" sw/device/tests/aes_smoketest_export_sim_verilator
Pirmin Vogel18d8e132021-08-03 14:35:29 +0200204 ninja -C "$OBJ_DIR" sw/device/examples/hello_world/hello_world_export_sim_verilator
205 displayName: Build embedded targets
206 - template: ci/upload-artifacts-template.yml
207 parameters:
208 includePatterns:
209 - "/sw/device/***"
210
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700211- job: chip_englishbreakfast_verilator
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100212 displayName: Build Verilator simulation of the English Breakfast toplevel design
213 dependsOn: lint
214 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
215 pool:
216 vmImage: ubuntu-18.04
217 steps:
218 - template: ci/install-package-dependencies.yml
219 - bash: |
220 python3 --version
221 fusesoc --version
222 verilator --version
223 verible-verilog-lint --version
224 displayName: Display environment
Rupert Swarbricke77e2f12021-09-03 18:09:53 +0100225 - bash: ci/scripts/build-chip-verilator.sh englishbreakfast
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100226 displayName: Build simulation with Verilator
227 - template: ci/upload-artifacts-template.yml
228 parameters:
Philipp Wagner5aa7ed32021-02-02 18:53:36 +0000229 includePatterns:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700230 - "/hw/top_englishbreakfast/Vchip_englishbreakfast_verilator"
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100231
Miles Dai5533c052022-05-11 18:46:32 -0400232- job: execute_verilated_tests
Miles Dai276d2dc2022-05-04 18:21:52 -0400233 displayName: Build and run fast tests on sim_verilator
Philipp Wagnera4b89b92021-05-20 22:25:42 +0100234 pool: ci-public
Miles Dai276d2dc2022-05-04 18:21:52 -0400235 timeoutInMinutes: 200
236 dependsOn: lint
Timothy Chen7d1436d2019-12-04 17:26:14 -0800237 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600238 - template: ci/install-package-dependencies.yml
Miles Dai276d2dc2022-05-04 18:21:52 -0400239 - task: DownloadSecureFile@1
240 condition: eq(variables['Build.SourceBranchName'], 'master')
241 name: bazelCacheGcpKey
242 inputs:
243 secureFile: "bazel_cache_gcp_key.json"
244 - bash: echo "##vso[task.setvariable variable=bazelCacheGcpKeyPath]$(bazelCacheGcpKey.secureFilePath)"
245 condition: eq(variables['Build.SourceBranchName'], 'master')
246 displayName: Set the remote cache GCP key path
Timothy Chen7d1436d2019-12-04 17:26:14 -0800247 - bash: |
Miles Dai276d2dc2022-05-04 18:21:52 -0400248 export GCP_BAZEL_CACHE_KEY=$(bazelCacheGcpKeyPath)
Miles Dai5533c052022-05-11 18:46:32 -0400249 ci/scripts/run-verilator-tests.sh
Miles Dai276d2dc2022-05-04 18:21:52 -0400250 displayName: Build and execute tests
Miles Dai56caf6b2022-05-11 15:25:58 -0400251 continueOnError: true # Temporary workaround for #12603
Miles Dai276d2dc2022-05-04 18:21:52 -0400252 # TODO: build and cache the verilator model to avoid building twice (#12574)
253 - bash: |
Timothy Chen7d1436d2019-12-04 17:26:14 -0800254 . util/build_consts.sh
Miles Dai276d2dc2022-05-04 18:21:52 -0400255 mkdir -p "$BIN_DIR/hw/top_earlgrey/"
256 cp $(find bazel-out/* -name Vchip_sim_tb) \
257 "$BIN_DIR/hw/top_earlgrey/Vchip_earlgrey_verilator"
258 displayName: Copy //hw:verilator to $BIN_DIR
259 - template: ci/upload-artifacts-template.yml
260 parameters:
261 includePatterns:
262 - "/hw/top_earlgrey/Vchip_earlgrey_verilator"
263
Pirmin Vogel18d8e132021-08-03 14:35:29 +0200264- job: execute_verilated_tests_englishbreakfast
265 displayName: Execute tests on the Verilated English Breakfast toplevel design
266 pool: ci-public
267 dependsOn:
268 - chip_englishbreakfast_verilator
269 - sw_build_englishbreakfast
270 steps:
271 - template: ci/install-package-dependencies.yml
272 - template: ci/download-artifacts-template.yml
273 parameters:
274 downloadPartialBuildBinFrom:
275 - chip_englishbreakfast_verilator
276 - sw_build_englishbreakfast
277 - bash: |
278 # Install an additional pytest dependency for result upload.
279 pip3 install pytest-azurepipelines
280
281 . util/build_consts.sh
282 pytest --version
283 pytest test/systemtest/englishbreakfast/test_sim_verilator.py \
284 -m "not slow" \
285 --log-cli-level=DEBUG \
286 --test-run-title="Run English Breakfast system tests with Verilator simulation" \
287 --napoleon-docstrings
288 displayName: Execute tests
289
Greg Chadwick99fe0642020-08-04 15:42:45 +0100290- job: otbn_standalone_tests
291 displayName: Run OTBN Smoke Test
292 dependsOn: lint
Philipp Wagner8d3e5632020-08-19 14:31:39 +0100293 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100294 vmImage: ubuntu-18.04
Philipp Wagnerbf0ab0a2020-12-15 12:03:42 +0000295 timeoutInMinutes: 10
Greg Chadwick99fe0642020-08-04 15:42:45 +0100296 steps:
297 - template: ci/install-package-dependencies.yml
298 - bash: |
299 set -x
300 sudo util/get-toolchain.py \
Srikrishna Iyer98333ba2020-11-16 23:12:29 -0800301 --install-dir="$TOOLCHAIN_PATH" \
Greg Chadwick99fe0642020-08-04 15:42:45 +0100302 --release-version="$TOOLCHAIN_VERSION" \
303 --update
Rupert Swarbrick54278382020-08-25 12:45:47 +0100304 echo "##vso[task.prependpath]$TOOLCHAIN_PATH/bin"
Greg Chadwick99fe0642020-08-04 15:42:45 +0100305 displayName: Install toolchain
306 - bash: |
Greg Chadwick99fe0642020-08-04 15:42:45 +0100307 python3 --version
308 fusesoc --version
309 verilator --version
310 displayName: Display environment
311 - bash: |
Rupert Swarbrick7bd2a372020-10-02 12:36:12 +0100312 make -C hw/ip/otbn/dv/otbnsim test
313 displayName: OTBN ISS Test
314 - bash: |
Greg Chadwick99fe0642020-08-04 15:42:45 +0100315 ./hw/ip/otbn/dv/smoke/run_smoke.sh
316 displayName: OTBN Smoke Test
Rupert Swarbrick54278382020-08-25 12:45:47 +0100317 - bash: |
Rupert Swarbrick7087ed82020-11-13 18:16:46 +0000318 make -C hw/ip/otbn/util asm-check
Rupert Swarbrick54278382020-08-25 12:45:47 +0100319 displayName: Assemble and link code snippets
Greg Chadwick99fe0642020-08-04 15:42:45 +0100320
Pirmin Vogelad2afea2021-05-20 10:43:40 +0200321- job: chip_earlgrey_cw310
322 displayName: Build CW310 variant of the Earl Grey toplevel design using Vivado
323 dependsOn:
324 - lint
325 # The bootrom is built into the FPGA image at synthesis time.
Greg Chadwickb045dd82022-02-15 11:29:24 +0000326 - cw310_sw_build
Pirmin Vogelad2afea2021-05-20 10:43:40 +0200327 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'), eq(dependencies.lint.outputs['DetermineBuildType.onlyDvChanges'], '0'))
328 pool: ci-public
Drew Macraebcebd572022-05-18 13:02:06 -0400329 timeoutInMinutes: 180
Pirmin Vogelad2afea2021-05-20 10:43:40 +0200330 steps:
331 - template: ci/install-package-dependencies.yml
332 - template: ci/download-artifacts-template.yml
333 parameters:
334 downloadPartialBuildBinFrom:
Greg Chadwickb045dd82022-02-15 11:29:24 +0000335 - cw310_sw_build
Pirmin Vogelad2afea2021-05-20 10:43:40 +0200336 - bash: |
337 set -e
Pirmin Vogelad2afea2021-05-20 10:43:40 +0200338 module load "xilinx/vivado/$(VIVADO_VERSION)"
Rupert Swarbrickd9b83ce2022-04-07 14:27:59 +0100339 ci/scripts/build-bitstream-vivado.sh top_earlgrey cw310
Pirmin Vogelad2afea2021-05-20 10:43:40 +0200340 displayName: Build bitstream with Vivado
341 - bash: |
342 . util/build_consts.sh
343 echo Synthesis log
344 cat $OBJ_DIR/hw/synth-vivado/lowrisc_systems_chip_earlgrey_cw310_0.1.runs/synth_1/runme.log || true
345
346 echo Implementation log
347 cat $OBJ_DIR/hw/synth-vivado/lowrisc_systems_chip_earlgrey_cw310_0.1.runs/impl_1/runme.log || true
348 condition: always()
349 displayName: Display synthesis and implementation logs
350 - template: ci/upload-artifacts-template.yml
351 parameters:
352 includePatterns:
Miguel Osorio45e08ff2021-11-30 20:39:32 -0800353 - "/hw/***"
Philipp Wagner9b37c342021-02-01 16:21:38 +0000354 - publish: "$(Build.ArtifactStagingDirectory)"
355 artifact: chip_earlgrey_cw310-build-out
356 displayName: Upload all Vivado artifacts for CW310
357 condition: failed()
Pirmin Vogelad2afea2021-05-20 10:43:40 +0200358
Miguel Osorio45e08ff2021-11-30 20:39:32 -0800359- job: chip_earlgrey_cw310_splice_mask_rom
360 displayName: Splice mask ROM binary into CW310 bitstream using Vivado
361 dependsOn:
362 - chip_earlgrey_cw310
363 - sw_build
364 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'), eq(dependencies.lint.outputs['DetermineBuildType.onlyDvChanges'], '0'))
365 pool: ci-public
366 timeoutInMinutes: 10
367 steps:
368 - template: ci/install-package-dependencies.yml
369 - template: ci/download-artifacts-template.yml
370 parameters:
371 downloadPartialBuildBinFrom:
372 - chip_earlgrey_cw310
373 - sw_build
374 - bash: |
375 set -e
376 . util/build_consts.sh
377
378 module load "xilinx/vivado/$(VIVADO_VERSION)"
379
380 util/fpga/splice_rom.sh -t cw310 -T earlgrey -b PROD
381
382 displayName: Splicing bitstream with Vivado
383 - template: ci/upload-artifacts-template.yml
384 parameters:
385 includePatterns:
386 - "/hw/***"
Miles Daica6be0f2022-04-06 15:27:05 -0400387 - ${{ if eq(variables['Build.SourceBranchName'], 'master') }}:
388 - template: ci/gcp-upload-bitstream-template.yml
389 parameters:
390 parentDir: "$BIN_DIR/hw/top_earlgrey"
391 includeFiles:
392 - "lowrisc_systems_chip_earlgrey_cw310_0.1.bit.orig"
393 - "lowrisc_systems_chip_earlgrey_cw310_0.1.bit.splice"
394 gcpKeyFile: "gcpkey.json"
395 bucketURI: "gs://opentitan-bitstreams/master"
Miguel Osorio45e08ff2021-11-30 20:39:32 -0800396 - publish: "$(Build.ArtifactStagingDirectory)"
397 artifact: chip_earlgrey_cw310-splice-mask-rom-build-out
398 displayName: Upload all Vivado artifacts for CW310
399 condition: failed()
400
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700401- job: chip_englishbreakfast_cw305
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100402 displayName: Build CW305 variant of the English Breakfast toplevel design using Vivado
403 dependsOn:
404 - lint
Pirmin Vogel18d8e132021-08-03 14:35:29 +0200405 - sw_build_englishbreakfast
Timothy Chen64f6a5a2021-02-05 17:04:40 -0800406 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'), eq(dependencies.lint.outputs['DetermineBuildType.onlyDvChanges'], '0'))
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100407 pool: ci-public
408 timeoutInMinutes: 120 # 2 hours
409 steps:
410 - template: ci/install-package-dependencies.yml
411 - template: ci/download-artifacts-template.yml
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000412 parameters:
413 downloadPartialBuildBinFrom:
Pirmin Vogel18d8e132021-08-03 14:35:29 +0200414 - sw_build_englishbreakfast
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100415 - bash: |
416 set -e
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100417 module load "xilinx/vivado/$(VIVADO_VERSION)"
Rupert Swarbrickd9b83ce2022-04-07 14:27:59 +0100418 ci/scripts/build-bitstream-vivado.sh top_englishbreakfast cw305
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100419 displayName: Build bitstream with Vivado
420 - template: ci/upload-artifacts-template.yml
421 parameters:
Philipp Wagner5aa7ed32021-02-02 18:53:36 +0000422 includePatterns:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700423 - "/hw/top_englishbreakfast/lowrisc_systems_chip_englishbreakfast_cw305_0.1.bit"
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100424
Pirmin Vogelad2afea2021-05-20 10:43:40 +0200425- job: execute_fpga_tests_cw310
426 displayName: Execute tests on ChipWhisperer CW310 FPGA board
427 pool: FPGA
Drew Macrae484fb5d2022-05-10 14:47:38 -0400428 timeoutInMinutes: 24
Pirmin Vogelad2afea2021-05-20 10:43:40 +0200429 dependsOn:
430 - chip_earlgrey_cw310
Pirmin Vogelad2afea2021-05-20 10:43:40 +0200431 - sw_build
432 steps:
433 - template: ci/install-package-dependencies.yml
434 - template: ci/download-artifacts-template.yml
435 parameters:
436 downloadPartialBuildBinFrom:
437 - chip_earlgrey_cw310
Pirmin Vogelad2afea2021-05-20 10:43:40 +0200438 - sw_build
439 - bash: |
440 set -e
Drew Macraed2a4b712022-05-05 13:34:04 -0400441 set -x
Pirmin Vogelad2afea2021-05-20 10:43:40 +0200442 . util/build_consts.sh
Drew Macraed2a4b712022-05-05 13:34:04 -0400443 SHA=$(git rev-parse HEAD)
444 BITCACHE_DIR=~/.cache/opentitan-bitstreams/cache/${SHA}
445 mkdir -p $BITCACHE_DIR
446 BITCACHE_FILE=$BITCACHE_DIR/lowrisc_systems_chip_earlgrey_cw310_0.1.bit.orig
447 cp $BIN_DIR/hw/top_earlgrey/lowrisc_systems_chip_earlgrey_cw310_0.1.bit ${BITCACHE_FILE}
448 echo "" >> ${BITCACHE_DIR}/lowrisc_systems_chip_earlgrey_cw310_0.1.bit.splice
Drew Macrae3024b9b2022-05-19 12:11:52 -0400449 echo -n ${SHA} > ${BITCACHE_DIR}/../../latest.txt
450 export BITSTREAM="--offline --list ${SHA}"
451 ci/bazelisk.sh test \
Drew Macraed2a4b712022-05-05 13:34:04 -0400452 --define DISABLE_VERILATOR_BUILD=true \
453 --test_tag_filters=cw310,-broken \
Drew Macrae8a57dd32022-05-19 07:35:39 -0400454 --test_output=all \
Drew Macraed2a4b712022-05-05 13:34:04 -0400455 --build_tests_only \
Drew Macraeff40eb22022-05-18 10:06:16 -0400456 --flaky_test_attempts=4 \
Drew Macraeae58e6d2022-05-16 17:37:49 -0400457 --define cw310=lowrisc \
Drew Macrae699b7272022-05-10 09:23:55 -0400458 $(./bazelisk.sh query 'rdeps(//sw/...,@bitstreams//:bitstream_test_rom)') \
459 # All the tests that depend on the test rom
Pirmin Vogelad2afea2021-05-20 10:43:40 +0200460 displayName: Execute tests
461
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600462- job: deploy_release_artifacts
463 displayName: Package and deploy release distribution
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000464 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100465 vmImage: ubuntu-18.04
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000466 dependsOn:
467 - lint
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600468 - sw_build
Miles Dai5533c052022-05-11 18:46:32 -0400469 - execute_verilated_tests
Philipp Wagnera0a35a52021-08-04 16:39:35 +0100470 - chip_earlgrey_cw310
Timothy Chen64f6a5a2021-02-05 17:04:40 -0800471 condition: and(eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'), eq(dependencies.lint.outputs['DetermineBuildType.onlyDvChanges'], '0'))
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000472 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600473 - template: ci/install-package-dependencies.yml
474 - template: ci/download-artifacts-template.yml
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000475 parameters:
476 downloadPartialBuildBinFrom:
477 - sw_build
Miles Dai5533c052022-05-11 18:46:32 -0400478 - execute_verilated_tests
Philipp Wagnera0a35a52021-08-04 16:39:35 +0100479 - chip_earlgrey_cw310
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700480 - chip_englishbreakfast_verilator
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600481 - bash: |
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600482 . util/build_consts.sh
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600483
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600484 util/make_distribution.sh
Philipp Wagner542e2202019-10-30 13:10:16 +0000485
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600486 tar --list -f $BIN_DIR/opentitan-*.tar.xz
487 # Put the resulting tar file into a directory the |publish| step below can reference.
488 mkdir "$BUILD_ROOT/dist-final"
489 mv $BIN_DIR/opentitan-*.tar.xz "$BUILD_ROOT/dist-final"
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600490 displayName: Create final dist directory out of partial ones
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000491 - publish: $(Build.ArtifactStagingDirectory)/dist-final
492 artifact: opentitan-dist
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600493 displayName: Upload release artifacts as Azure artifact
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000494 - task: GithubRelease@0
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600495 displayName: Upload to GitHub releases (only tags)
Philipp Wagner0b20f5d2019-11-01 16:24:52 +0000496 condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000497 inputs:
498 gitHubConnection: opentitan-release-upload
499 repositoryName: lowrisc/opentitan
500 addChangeLog: false
501 assets: |
502 $(Build.ArtifactStagingDirectory)/dist-final/*
Sam Elliotte257cd02020-09-10 13:49:38 +0100503
504
505- job: build_docker_containers
506 displayName: "Build Docker Containers"
507 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100508 vmImage: ubuntu-18.04
Sam Elliotte257cd02020-09-10 13:49:38 +0100509 dependsOn:
510 - lint
511 steps:
512 - task: Docker@2
513 displayName: Build Developer Utility Container
514 inputs:
515 command: build
516 Dockerfile: ./util/container/Dockerfile
517 buildContext: .
518 - task: Docker@2
519 displayName: Build Documentation Builder Container
520 inputs:
521 command: build
522 tags: gcr.io/active-premise-257318/builder
523 Dockerfile: ./site/docs/builder.Dockerfile
524 buildContext: .
525 - task: Docker@2
526 displayName: Build Documentation Redirector Container
527 inputs:
528 command: build
529 Dockerfile: ./site/redirector/Dockerfile
530 buildContext: ./site/redirector
Drew Macrae8a358142022-01-26 07:20:04 -0800531
Drew Macraeb90a49c2022-04-05 12:17:49 -0400532- job: bazel_test
533 displayName: Bazel Software Build and Test
Miles Dai28acbee2022-04-22 16:52:17 -0400534 timeoutInMinutes: 120
Drew Macraeb90a49c2022-04-05 12:17:49 -0400535 dependsOn: lint
536 pool:
537 vmImage: ubuntu-18.04
Miles Dai1c42d292022-04-16 00:33:23 -0400538 variables:
539 - name: bazelCacheGcpKeyPath
540 value: ''
Drew Macraeb90a49c2022-04-05 12:17:49 -0400541 steps:
542 - template: ci/install-package-dependencies.yml
Miles Dai1c42d292022-04-16 00:33:23 -0400543 - task: DownloadSecureFile@1
544 condition: eq(variables['Build.SourceBranchName'], 'master')
545 name: bazelCacheGcpKey
546 inputs:
547 secureFile: "bazel_cache_gcp_key.json"
548 - bash: echo "##vso[task.setvariable variable=bazelCacheGcpKeyPath]$(bazelCacheGcpKey.secureFilePath)"
549 condition: eq(variables['Build.SourceBranchName'], 'master')
550 displayName: Set the remote cache GCP key path
Miguel Young de la Sota369e0272022-04-21 13:14:23 -0400551 - bash: |
552 # This command builds all software and runs all unit tests that run on
553 # the host.
554 export GCP_BAZEL_CACHE_KEY=$(bazelCacheGcpKeyPath)
555 ci/bazelisk.sh test \
556 --build_tests_only=false \
Miguel Young de la Sota634aceb2022-04-21 13:38:37 -0400557 --define DISABLE_VERILATOR_BUILD=true \
Miguel Young de la Sota369e0272022-04-21 13:14:23 -0400558 --test_tag_filters=-broken,-cw310,-verilator,-dv \
Timothy Trippel0e9fbea2022-05-19 12:48:31 -0700559 --build_tag_filters=-verilator,-cw310,-dv \
Miguel Young de la Sota369e0272022-04-21 13:14:23 -0400560 //sw/...
561 displayName: "Build and Unit Test Software with Bazel"