forked from lowRISC/opentitan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
174 lines (168 loc) · 5.98 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
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
#
# Azure Pipelines CI build configuration
# Documentation at https://aka.ms/yaml
variables:
#
# If updating VERILATOR_VERSION, TOOLCHAIN_VERSION, update the
# definitions in util/container/Dockerfile as well.
#
VERILATOR_VERSION: 4.210
TOOLCHAIN_PATH: /opt/buildcache/riscv
VERIBLE_VERSION: v0.0-3622-g07b310a3
# Release tag from https://github.com/lowRISC/lowrisc-toolchains/releases
TOOLCHAIN_VERSION: 20220210-1
# This controls where builds happen, and gets picked up by build_consts.sh.
BUILD_ROOT: $(Build.ArtifactStagingDirectory)
VIVADO_VERSION: "2021.1"
trigger:
batch: true
branches:
include:
- "*"
# Don't run workflow on auto-created backport branches (PR workflow will be run)
exclude:
- "backport-*"
tags:
include:
- "*"
pr:
branches:
include:
- "*"
jobs:
- job: checkout
displayName: Checkout repository
pool:
vmImage: ubuntu-20.04
steps:
- checkout: self
path: opentitan-repo
- bash: |
tar -C $(Pipeline.Workspace)/opentitan-repo -czf $(Pipeline.Workspace)/opentitan-repo.tar.gz .
displayName: Pack up repository
- publish: $(Pipeline.Workspace)/opentitan-repo.tar.gz
artifact: opentitan-repo
displayName: Upload repository
- job: lint
displayName: Quality (quick lint)
# Run code quality checks (quick lint)
dependsOn: checkout
pool: ci-public
steps:
- template: ci/checkout-template.yml
- template: ci/install-package-dependencies.yml
## !!!
##
## The steps below here are duplicated in ci/jobs/quick-lint.sh
## to allow developers to "run CI" locally. Keep them in sync.
##
## !!!
- bash: ci/scripts/show-env.sh
displayName: Environment Info
# Display environment information
- bash: ci/scripts/lint-commits.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
condition: eq(variables['Build.Reason'], 'PullRequest')
displayName: Commit metadata
- bash: ci/scripts/check-licence-headers.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
condition: eq(variables['Build.Reason'], 'PullRequest')
displayName: Licence Headers
- bash: ci/scripts/exec-check.sh
condition: eq(variables['Build.Reason'], 'PullRequest')
displayName: Executable Bits
- bash: ci/scripts/check-ascii.sh
condition: eq(variables['Build.Reason'], 'PullRequest')
displayName: ASCII Chars
# Check for non-ASCII characters in source code
- bash: ci/scripts/python-lint.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
condition: eq(variables['Build.Reason'], 'PullRequest')
displayName: flake8 (Python lint)
# Run Python lint (flake8)
- bash: ci/scripts/mypy.sh
condition: eq(variables['Build.Reason'], 'PullRequest')
displayName: mypy (Python lint)
# Run Python lint (mypy)
- bash: ci/scripts/clang-format.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
condition: eq(variables['Build.Reason'], 'PullRequest')
displayName: clang-format (C/C++ lint)
# Validate testplans with schema (json schema)
- bash: ci/scripts/validate_testplans.sh
condition: eq(variables['Build.Reason'], 'PullRequest')
displayName: Validate testplans with schema
# Use clang-format to check C/C++ coding style
- bash: ci/scripts/rust-format.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
condition: eq(variables['Build.Reason'], 'PullRequest')
displayName: rustfmt
- bash: |
ci/bazelisk.sh test //quality:shellcheck_check || {
echo -n "##vso[task.logissue type=error]"
echo "Shellcheck failed. Run util/sh/scripts/run-shellcheck.sh to see errors."
exit 1
}
displayName: shellcheck
- bash: ci/scripts/include-guard.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
condition: eq(variables['Build.Reason'], 'PullRequest')
displayName: Header guards
# Check formatting on header guards
- bash: ci/scripts/whitespace.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
condition: eq(variables['Build.Reason'], 'PullRequest')
displayName: Check trailing whitespace
- bash: ci/scripts/check-links.sh
displayName: Check File Links
- bash: ci/scripts/check-cmdgen.sh
displayName: Check CMDGEN Blocks
- bash: ci/scripts/get-build-type.sh "$SYSTEM_PULLREQUEST_TARGETBRANCH" "$(Build.Reason)"
displayName: Type of change
# Check what kinds of changes the PR contains
name: DetermineBuildType
- bash: ci/scripts/check-no-bazelrc-site.sh
condition: eq(variables['Build.Reason'], 'PullRequest')
displayName: Confirm no .bazelrc-site files
- job: otbn_standalone_tests
displayName: Run OTBN Smoke Test
dependsOn: lint
condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyCdcChanges'], '0'))
pool:
vmImage: ubuntu-20.04
timeoutInMinutes: 10
steps:
- template: ci/checkout-template.yml
- template: ci/install-package-dependencies.yml
- bash: |
set -x
sudo util/get-toolchain.py \
--install-dir="$TOOLCHAIN_PATH" \
--release-version="$TOOLCHAIN_VERSION" \
--update
echo "##vso[task.prependpath]$TOOLCHAIN_PATH/bin"
displayName: Install toolchain
- bash: |
python3 --version
fusesoc --version
verilator --version
displayName: Display environment
- bash: |
make -C hw/ip/otbn/dv/otbnsim test
displayName: OTBN ISS Test
- bash: |
./hw/ip/otbn/dv/smoke/run_smoke.sh
displayName: OTBN Smoke Test
- bash: |
make -C hw/ip/otbn/util asm-check
displayName: Assemble & link code snippets
- job: otbn_crypto_tests
displayName: Run OTBN crypto tests
dependsOn: lint
condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyCdcChanges'], '0'))
pool:
vmImage: ubuntu-20.04
timeoutInMinutes: 60
steps:
- template: ci/checkout-template.yml
- template: ci/install-package-dependencies.yml
- template: ci/load-bazel-cache-write-creds.yml
- bash: |
ci/bazelisk.sh test --test_tag_filters=-nightly //sw/otbn/crypto/...
displayName: Execute tests