-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
223 lines (199 loc) · 8.42 KB
/
.gitlab-ci.yml
File metadata and controls
223 lines (199 loc) · 8.42 KB
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#
# OpTiMSoC autobuilder configuration
#
# This configuration file is used by GitLab CI to build and test OpTiMSoC.
# Resulting build artifacts are deployed to Bintray.
#
# See the README.md file in this repository for more information.
#
stages:
- get-src
- build-base
- build-ext
- test
- dist
before_script:
# Update package cache
- sudo apt-get update
# Restore optimsoc-src from get-src-optimsoc job (if it exists)
- test -f optimsoc-*-src.tar.gz && mkdir optimsoc-src && tar -xf optimsoc-*-src.tar.gz --strip-components=1 -C optimsoc-src
# Build dependencies (if the get-src-optimsoc stage has been completed)
- test -f optimsoc-src/tools/install-build-deps.sh && INSTALL_DOC_DEPS=no optimsoc-src/tools/install-build-deps.sh
- export PATH=$HOME/.local/bin:$PATH
- pip3 install --user --upgrade pip setuptools
# XXX: zipp 2.0+ doesn't work with Python 3.5.2, as it is used on Ubuntu 16.04
- python3 -m pip install --user pytest fusesoc 'zipp<2'
- pytest --version
- fusesoc --version
# OpTiMSoC Prebuilts (Verilator and or1k toolchain)
# XXX: This directory could be cached
- mkdir optimsoc
- curl -sL https://raw.githubusercontent.com/optimsoc/prebuilts/master/optimsoc-prebuilt-deploy.py | python - -d $CI_PROJECT_DIR/optimsoc all
# load OpTiMSoC Prebuilts (Verilator and or1k toolchain)
- test -f optimsoc/setup_prebuilt.sh && source optimsoc/setup_prebuilt.sh
# Install and load optimsoc framework (whatever parts have already been compiled)
- test -f optimsoc-*-base.tar.gz && mkdir -p optimsoc/framework && tar -xf optimsoc-*-base.tar.gz --strip-components=1 -C optimsoc/framework
- for f in optimsoc-*-examples*.tar.gz; do tar -xf $f --strip-components=1 -C optimsoc/framework; done || true
# Load build information file into environment
- test -f buildinfo && source ./buildinfo
# Create an OpTiMSoC source distribution tar file
get-src-optimsoc:
stage: get-src
script:
- git clone https://github.com/optimsoc/optimsoc.git optimsoc-src
- if [ "$OPTIMSOC_RELEASE_TAG" ]; then git -C optimsoc-src checkout "$OPTIMSOC_RELEASE_TAG"; fi
- echo "export BUILDINFO_NIGHTLY_VERSION=$(date -u +%Y-%m-%d-%H-%M-%S)" > buildinfo
- echo "export BUILDINFO_GIT_COMMIT=$(git -C optimsoc-src rev-parse HEAD)" >> buildinfo
- mkdir optimsoc-src/objdir
- make -C optimsoc-src srcdist
- mv optimsoc-src/objdir/optimsoc-*-src.tar.gz .
artifacts:
paths:
- optimsoc-*-src.tar.gz
- buildinfo
# Run cocotb-based tests
srctest-cocotb:
stage: build-base
script:
- module load synopsys/vcs-mx/latest
- INSTALL_COCOTB=1 optimsoc-src/external/opensocdebug/hardware/test/cocotb/cocotb_testrunner optimsoc-src
dependencies:
- get-src-optimsoc
allow_failure: true
# Build a binary distribution of the OpTiMSoC framework (without examples)
build-base:
stage: build-base
script:
# Call install-build-deps.sh again, this time install docs dependencies
# as well. We don't always install them since they include texlive, which is
# takes quite some time to download and install.
- INSTALL_DOC_DEPS=yes optimsoc-src/tools/install-build-deps.sh
- make -C optimsoc-src BUILD_EXAMPLES=no BUILD_EXAMPLES_FPGA=no BUILD_DOCS=yes build dist
- mv optimsoc-src/objdir/optimsoc-*-base.tar.gz .
artifacts:
paths:
- optimsoc-*-base.tar.gz
dependencies:
- get-src-optimsoc
# Build examples: Verilator-based simulations, and some FPGA examples
build-ext-examples:
stage: build-ext
script:
- module load xilinx/vivado/2018.2
- make -C optimsoc-src BUILD_EXAMPLES=yes BUILD_EXAMPLES_FPGA=yes BUILD_DOCS=no build dist
- mv optimsoc-src/objdir/optimsoc-*-examples.tar.gz .
artifacts:
paths:
- optimsoc-*-examples.tar.gz
dependencies:
- get-src-optimsoc
# Run Spyglass Lint on the hardware source code
build-ext-spyglass:
stage: build-ext
script:
- source optimsoc/framework/optimsoc-environment.sh
- module load synopsys/spyglass/N-2017.12-SP1-1
- fusesoc --cores-root optimsoc-src/examples run --target=lint --tool=spyglass optimsoc:examples:compute_tile_nexys4ddr
dependencies:
- get-src-optimsoc
- build-base
allow_failure: true
artifacts:
when: always
paths:
- build/*/lint-spyglass/*/consolidated_reports
- build/*/lint-spyglass/*/compute_tile_dm_nexys4/lint/*/spyglass.log
# Build an extended example: A compute_tile system with eight cores for the
# VCU108 board using a Cypress FX3-based USB3 off-chip interface
build-ext-compute_tile_vcu108_eightcore_usb3:
stage: build-ext
script:
- source optimsoc/framework/optimsoc-environment.sh
- module load xilinx/vivado/2018.2
- fusesoc --cores-root optimsoc-src/examples build optimsoc:examples:system_2x2_cccc_vcu108 --HOST_IF usb3 --NUM_CORES 8
- mkdir -p examples-ext/fpga/vcu108/compute_tile
- mv build/*/*-vivado/*.bit examples-ext/fpga/vcu108/compute_tile/compute_tile_vcu108_eightcore_usb3.bit
artifacts:
when: always
paths:
- build/*/*-vivado/*.bit
- build/*/*-vivado/*.runs/*/runme.log
- build/*/*-vivado/*.runs/*/*.rpt
- examples-ext
dependencies:
- get-src-optimsoc
- build-base
allow_failure: true
# Build an extended example: A 2x2-mesh system with four compute tiles, each of
# them featuring two CPU cores, for the VCU108 board using a Cypress FX3-based
# USB3 off-chip interface
build-ext-system_2x2_cccc_vcu108_dualcore_usb3:
stage: build-ext
script:
- source optimsoc/framework/optimsoc-environment.sh
- module load xilinx/vivado/2018.2
- fusesoc --cores-root optimsoc-src/examples build optimsoc:examples:compute_tile_vcu108 --HOST_IF usb3 --NUM_CORES 2
- mkdir -p examples-ext/fpga/vcu108/system_2x2_cccc
- mv build/*/*-vivado/*.bit examples-ext/fpga/vcu108/system_2x2_cccc/system_2x2_cccc_vcu108_dualcore_usb3.bit
artifacts:
when: always
paths:
- build/*/*-vivado/*.bit
- build/*/*-vivado/*.runs/*/runme.log
- build/*/*-vivado/*.runs/*/*.rpt
- examples-ext
dependencies:
- get-src-optimsoc
- build-base
allow_failure: true
# Run the systemtests on the builds
# The systemtests run in simulation and on actual FPGA hardware.
test:
stage: test
tags:
# Test requires a GitLab CI Runner with this tag, indicating a connected
# Nexys 4 DDR board
- hw-nexys4ddr
script:
- source optimsoc/framework/optimsoc-environment.sh
- module load xilinx/vivado/2018.2
# Write test configuration: where to find the boards
# Expected setup:
# /dev/ttyUSB1: UART of the Nexys4 DDR board
- ls -l /dev/ttyUSB*
- mkdir -p $HOME/.config/optimsoc
- 'echo "boards: { nexys4ddr: { device: /dev/ttyUSB1 } }" > $HOME/.config/optimsoc/test-localconf.yaml'
- make -C optimsoc-src test BUILD_EXAMPLES_FPGA=yes
# Nightly Build: Deploy (upload) the build artifacts to Bintray
# This job expects the environment variables BINTRAY_USER and BINTRAY_API_KEY
# to be set.
dist-nightly:
stage: dist
except:
variables:
- $OPTIMSOC_RELEASE_TAG
script:
# Create extended examples package
- export OPTIMSOC_VERSION=$(optimsoc-src/tools/get-version.sh)
- tar -cz --transform "s@examples-ext@optimsoc-$OPTIMSOC_VERSION/examples@" -f optimsoc-$OPTIMSOC_VERSION-examples-ext.tar.gz examples-ext
# Upload artifacts to the optimsoc/nightly channel on Bintray
- ./upload-bintray.sh
# Release Build: Deploy (upload) the build artifacts to GitHub Releases
# This job expects the environment variables GITHUB_TOKEN and GITHUB_USER
# to be set.
dist-release:
stage: dist
only:
variables:
- $OPTIMSOC_RELEASE_TAG
script:
# Create extended examples package
- export OPTIMSOC_VERSION=$(optimsoc-src/tools/get-version.sh)
- tar -cz --transform "s@examples-ext@optimsoc-$OPTIMSOC_VERSION/examples@" -f optimsoc-$OPTIMSOC_VERSION-examples-ext.tar.gz examples-ext
# Download ghr, a helper tool for GitHub Releases
- curl -sfL https://github.com/tcnksm/ghr/releases/download/v0.12.0/ghr_v0.12.0_linux_amd64.tar.gz | tar -xzf - --strip-components=1 --wildcards '*/ghr'
# Prepare release artifacts in one directory
- mkdir -p release-artifacts
- cp optimsoc-*-src.tar.gz optimsoc-*-base.tar.gz optimsoc-*-examples.tar.gz optimsoc-*-examples-ext.tar.gz release-artifacts
# Upload release (in draft mode, release can be edited and published in GitHub web)
- ./ghr -u optimsoc -r optimsoc -draft -n ${OPTIMSOC_RELEASE_TAG:1} -c "$BUILDINFO_GIT_COMMIT" "$OPTIMSOC_RELEASE_TAG" release-artifacts