-
Notifications
You must be signed in to change notification settings - Fork 49
275 lines (216 loc) Β· 7.12 KB
/
Pipeline.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
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# Copyright (C) 2020-2022 F4PGA Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
name: Pipeline
on:
workflow_call:
jobs:
License-check:
name: Check license headers
runs-on: ubuntu-latest
steps:
- name: π§° Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Check Licenses
uses: SymbiFlow/actions/checks@main
Format:
name: 'π Format'
runs-on: ubuntu-latest
steps:
- name: π§° Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: π Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: π§ Install dependencies
run: python -m pip install -r test/requirements.txt
- name: π¦ Check if Python sources follow code formatting standards
run: python -m black --check f4pga
Docs:
runs-on: ubuntu-latest
name: 'π Docs'
permissions:
contents: write
steps:
- name: π§° Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: π οΈ Setup environment
run: |
sudo apt update -qq
sudo apt install -y make
make -C docs env
- name: π Build the documentation
run: |
. ./docs/env/conda/bin/activate f4pga-docs
make -C docs html
cd docs/_build/html
touch .nojekyll
- name: 'π€ Upload artifact: Sphinx HTML'
uses: actions/upload-artifact@v3
with:
name: Documentation-HTML
path: docs/_build/html
- name: π Publish site to GitHub Pages
if: github.event_name != 'pull_request'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
Install:
runs-on: ubuntu-latest
steps:
- name: π Install f4pga (pip zipfile)
run: pip3 install https://github.com/"$GITHUB_REPOSITORY"/archive/"$GITHUB_REF".zip#subdirectory=f4pga
Builds:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
flow:
- SymbiFlow
- F4PGA
fam:
- xc7
- eos-s3
name: 'π¦ ${{ matrix.flow }} | ${{ matrix.fam }}'
env:
F4PGA_INSTALL_DIR: /opt/f4pga
FPGA_FAM: ${{ matrix.fam }}
steps:
- name: π§° Checkout
uses: actions/checkout@v3
- name: π§ Prepare environment
run: ./scripts/prepare_environment.sh
- name: π Install f4pga (pip)
run: |
. ./scripts/activate.sh
cd f4pga
pip install .
cd ..
- name: π οΈ Clone f4pga-examples
run: git clone --recurse-submodules https://github.com/chipsalliance/f4pga-examples
# F4PGA
- name: π§ [F4PGA] Test f4pga build
if: matrix.flow == 'F4PGA'
run: |
. ./scripts/activate.sh
cd f4pga-examples/${{ matrix.fam }}
f4pga -vv build --flow ../../.github/${{ matrix.fam }}_test.json
- name: 'π€ Upload artifact: ${{ matrix.fam }} bitstream'
if: matrix.flow == 'F4PGA'
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.flow }}-${{ matrix.fam }}-Bitstream
path: f4pga-examples/${{ matrix.fam }}/build/top.bit
if-no-files-found: error
# SymbiFlow
- name: π§ [SymbiFlow] Test make example
if: matrix.flow == 'SymbiFlow'
run: |
. ./scripts/activate.sh
cd f4pga-examples/${{ matrix.fam }}
export F4PGA_USE_DEPRECATED=true
case '${{ matrix.fam }}' in
xc7) TARGET="arty_35" make -C counter_test;;
eos-s3) make -C btn_counter;;
esac
- name: 'π€ Upload artifact: Arty 35 bitstream'
if: matrix.flow == 'SymbiFlow' && matrix.fam == 'xc7'
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.flow }}-${{ matrix.fam }}-Bitstream
path: f4pga-examples/${{ matrix.fam }}/counter_test/build/arty_35/top.bit
if-no-files-found: error
- name: 'π€ Upload artifact: QuickLogic bitstream'
if: matrix.flow == 'SymbiFlow' && matrix.fam == 'eos-s3'
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.flow }}-${{ matrix.fam }}-Bitstream
path: f4pga-examples/${{ matrix.fam }}/btn_counter/build/top.bit
if-no-files-found: error
Lattice:
runs-on: ubuntu-latest
name: 'π¦ Lattice | ice40'
env:
F4PGA_INSTALL_DIR: /usr/local
FPGA_FAM: ice40
steps:
- name: π§° Checkout
uses: actions/checkout@v3
- name: π οΈ Clone fomu-workshop
run: git clone https://github.com/im-tomu/fomu-workshop
- name: π§ [F4PGA] Test f4pga build
run: |
cat > ice40-test.sh <<'EOF'
set -e
apt-get update -qq
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends python3-pip git
pip install ./f4pga
cd fomu-workshop/hdl/verilog/blink
f4pga -vv build --flow ../../../../.github/ice40_test.json
EOF
docker run --rm -i \
-v $(pwd):/wrk -w /wrk \
-e FPGA_FAM=ice40 \
gcr.io/hdl-containers/impl/icestorm \
bash -le /wrk/ice40-test.sh
- name: 'π€ Upload artifact: ice40 bitstream'
uses: actions/upload-artifact@v3
with:
name: Lattice-ice40-Bitstream
path: fomu-workshop/hdl/verilog/blink/build/top.bit
if-no-files-found: error
Python-Tests:
runs-on: ubuntu-latest
name: 'π Python Tests'
env:
F4PGA_INSTALL_DIR: /opt/f4pga
FPGA_FAM: xc7
steps:
- name: π§° Checkout
uses: actions/checkout@v3
- name: π§ Prepare environment
run: ./scripts/prepare_environment.sh
- name: π Install f4pga (pip)
run: |
. ./scripts/activate.sh
cd f4pga
pip install .
cd ..
- name: π¦ Test Python wrappers
run: |
. ./scripts/activate.sh
pip3 install -r ./test/requirements.txt
pytest --verbose --capture=no -rA --color=yes test/
PYTHONPATH:
runs-on: ubuntu-latest
name: 'π PYTHONPATH'
env:
F4PGA_INSTALL_DIR: /opt/f4pga
FPGA_FAM: xc7
steps:
- name: π§° Checkout
uses: actions/checkout@v3
- name: π§ Test pyF4PGA (PYTHONPATH)
run: |
PYTHONPATH=$(pwd) python3 -m f4pga
PYTHONPATH=$(pwd) python3 -m f4pga -h