Skip to content

Commit 5b91aec

Browse files
authored
Merge pull request #118 from antmicro/refactor-ci
Refactor CI to add centOS 7
2 parents 30d34e0 + 7a60b85 commit 5b91aec

File tree

9 files changed

+173
-75
lines changed

9 files changed

+173
-75
lines changed

.github/scripts/centos-setup.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
# Copyright (C) 2022 The SymbiFlow Authors.
3+
#
4+
# Use of this source code is governed by a ISC-style
5+
# license that can be found in the LICENSE file or at
6+
# https://opensource.org/licenses/ISC
7+
#
8+
# SPDX-License-Identifier: ISC
9+
10+
yum -y update
11+
yum -y install epel-release
12+
yum -y groupinstall 'Development Tools'
13+
yum -y install make which git python3 wget unzip curl \
14+
java-11-openjdk-headless java-11-openjdk java-11-openjdk-devel capnproto-devel
15+
16+
# Cmake3 install
17+
yum -y install cmake3
18+
ln -s /usr/bin/cmake3 /usr/bin/cmake
19+
20+
# Upgrade make version
21+
wget http://ftp.gnu.org/gnu/make/make-4.2.1.tar.gz
22+
tar -xvf make-4.2.1.tar.gz
23+
pushd make-4.2.1
24+
./configure
25+
make
26+
make install
27+
popd
28+
ln -s /usr/local/bin/make /usr/bin/make
29+
30+
# Check versions
31+
make --version
32+
cmake --version
33+
java --version
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env python3
2+
#-*- coding: utf-8 -*-
3+
#
4+
# Copyright (C) 2022 The SymbiFlow Authors.
5+
#
6+
# Use of this source code is governed by a ISC-style
7+
# license that can be found in the LICENSE file or at
8+
# https://opensource.org/licenses/ISC
9+
#
10+
# SPDX-License-Identifier: ISC
11+
12+
from itertools import product
13+
14+
devices = [
15+
"xc7a35t",
16+
"xc7a100t",
17+
"xc7a200t",
18+
"xc7s50",
19+
"xc7z010",
20+
"xczu7ev",
21+
"xc7k70t",
22+
"xc7k160t",
23+
"xc7k480t",
24+
"xc7vx980t",
25+
"testarch",
26+
"LIFCL-40"
27+
]
28+
29+
tools = [
30+
"nextpnr",
31+
"vpr"
32+
]
33+
34+
osvers = [
35+
("ubuntu", "focal"),
36+
("centos", "7"),
37+
]
38+
39+
jobs = list()
40+
41+
for device, tool, osver in product(devices, tools, osvers):
42+
os, ver = osver
43+
44+
if tool == "vpr" and device not in ["xc7a35t", "LIFCL-40", "testarch"]:
45+
continue
46+
47+
if os == "centos" and device == "LIFCL-40":
48+
continue
49+
50+
jobs += [{
51+
'tool': tool,
52+
'device': device,
53+
'os': os,
54+
'os-version': ver,
55+
}]
56+
57+
print(f'::set-output name=matrix::{jobs!s}')
58+
59+
print(str(jobs))

.github/scripts/ubuntu-setup.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
# Copyright (C) 2022 The SymbiFlow Authors.
3+
#
4+
# Use of this source code is governed by a ISC-style
5+
# license that can be found in the LICENSE file or at
6+
# https://opensource.org/licenses/ISC
7+
#
8+
# SPDX-License-Identifier: ISC
9+
10+
apt-get -qqy update
11+
apt-get -qqy install build-essential git make locales libtinfo-dev \
12+
cmake python3 wget unzip curl openjdk-11-jdk-headless capnproto
13+
dpkg-reconfigure locales
14+
15+
# Vivado is erroring out due to a missing library in CI.
16+
# https://support.xilinx.com/s/article/76585?language=en_US
17+
ln -s /lib/x86_64-linux-gnu/libtinfo.so.6 /lib/x86_64-linux-gnu/libtinfo.so.5

.github/workflows/ci.yml

Lines changed: 50 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -30,87 +30,55 @@ jobs:
3030
- ./tests/designs/litex_linux/arty.v
3131
- ./conda_lock.yml
3232
33-
Run-Nextpnr-Tests:
34-
runs-on: [self-hosted, Linux, X64]
35-
container: "ubuntu:20.04"
36-
strategy:
37-
fail-fast: false
38-
matrix:
39-
device: ["xc7a35t", "xc7a100t", "xc7a200t", "xc7s50", "xc7z010", "xczu7ev", "xc7k70t", "xc7k160t", "xc7k480t", "xc7vx980t", "LIFCL-40", "testarch"]
40-
env:
41-
LANG: "en_US.UTF-8"
42-
DEBIAN_FRONTEND: "noninteractive"
43-
GHA_EXTERNAL_DISK: "tools"
44-
XILINX_LOCAL_USER_DATA: "no"
45-
LC_ALL: "C"
46-
steps:
47-
48-
- uses: actions/checkout@v2
49-
with:
50-
submodules: recursive
51-
52-
- name: Install
53-
run: |
54-
apt-get -qqy update
55-
apt-get -qqy install build-essential git make locales libtinfo-dev \
56-
cmake python3 wget unzip curl openjdk-11-jdk-headless capnproto
57-
dpkg-reconfigure locales
58-
# Vivado is erroring out due to a missing library in CI.
59-
# https://support.xilinx.com/s/article/76585?language=en_US
60-
ln -s /lib/x86_64-linux-gnu/libtinfo.so.6 /lib/x86_64-linux-gnu/libtinfo.so.5
33+
Matrix:
34+
runs-on: ubuntu-latest
35+
outputs:
36+
matrix: ${{ steps.generate.outputs.matrix }}
6137

62-
- name: Create environment
63-
run: make env
38+
steps:
6439

65-
- name: Build CMake
66-
run: |
67-
make build
68-
make update
40+
- name: Setup repository
41+
uses: actions/checkout@v3
6942

70-
- name: Run tests
71-
run: |
72-
.github/scripts/tests.sh ${{ matrix.device }} vendor-bit-tests
43+
- name: Generate examples matrix
44+
id: generate
45+
run: ./.github/scripts/generate_job_matrix.py '${{ github.repository }}'
7346

74-
- name: Prepare report
75-
run: |
76-
cd build
77-
python3 ../utils/report_targets.py --log `find . -name "all-*-tests.log"` --csv report.csv --allowed-failures allowed-failures.log
7847

79-
- uses: actions/upload-artifact@v2
80-
with:
81-
name: fpga-interchange-tests-${{ matrix.device }}
82-
path: |
83-
**/plot_*.svg
84-
build/report*.csv
48+
Run-Tests:
49+
needs: Matrix
8550

86-
Run-VPR-Tests:
8751
runs-on: [self-hosted, Linux, X64]
88-
container: "ubuntu:20.04"
52+
8953
strategy:
9054
fail-fast: false
9155
matrix:
92-
device: ["xc7a35t", "LIFCL-40", "testarch"]
56+
include: ${{ fromJson(needs.Matrix.outputs.matrix) }}
57+
58+
container: ${{ matrix.os }}:${{ matrix.os-version }}
59+
9360
env:
94-
LANG: "en_US.UTF-8"
95-
DEBIAN_FRONTEND: "noninteractive"
96-
GHA_EXTERNAL_DISK: "tools"
97-
XILINX_LOCAL_USER_DATA: "no"
98-
LC_ALL: "C"
61+
LANG: en_US.UTF-8
62+
DEBIAN_FRONTEND: noninteractive
63+
GHA_EXTERNAL_DISK: tools
64+
XILINX_LOCAL_USER_DATA: no
65+
LC_ALL: C
66+
CMAKE_FLAGS: -DPNR_TOOL=${{ matrix.tool }}
9967
steps:
10068

10169
- uses: actions/checkout@v2
10270
with:
10371
submodules: recursive
10472

73+
- name: Install centos
74+
if: ${{matrix.os == 'centos'}}
75+
run: |
76+
.github/scripts/centos-setup.sh
77+
10578
- name: Install
79+
if: ${{ matrix.os == 'ubuntu' }}
10680
run: |
107-
apt-get -qqy update
108-
apt-get -qqy install build-essential git make locales libtinfo-dev \
109-
cmake python3 wget unzip curl openjdk-11-jdk-headless capnproto
110-
dpkg-reconfigure locales
111-
# Vivado is erroring out due to a missing library in CI.
112-
# https://support.xilinx.com/s/article/76585?language=en_US
113-
ln -s /lib/x86_64-linux-gnu/libtinfo.so.6 /lib/x86_64-linux-gnu/libtinfo.so.5
81+
.github/scripts/ubuntu-setup.sh
11482
11583
- name: Create environment
11684
run: make env
@@ -119,27 +87,41 @@ jobs:
11987
run: |
12088
make build
12189
make update
122-
env:
123-
CMAKE_FLAGS: "-DPNR_TOOL=vpr"
12490
125-
- name: Run tests
91+
- name: Run nextpnr tests
92+
if: ${{ matrix.tool == 'nextpnr' }}
93+
run: |
94+
.github/scripts/tests.sh ${{ matrix.device }} vendor-bit-tests
95+
96+
- name: Run VPR tests
97+
if: ${{ matrix.tool == 'vpr' }}
12698
run: |
12799
.github/scripts/tests.sh ${{ matrix.device }}
128100
129-
- name: Prepare report
101+
- name: Prepare nextpnr report
102+
if: ${{ matrix.tool == 'nextpnr' }}
130103
run: |
104+
source env/conda/bin/activate fpga-interchange
105+
cd build
106+
python3 ../utils/report_targets.py --log `find . -name "all-*-tests.log"` --csv report.csv --allowed-failures allowed-failures.log
107+
108+
- name: Prepare VPR report
109+
if: ${{ matrix.tool == 'vpr' }}
110+
run: |
111+
source env/conda/bin/activate fpga-interchange
131112
cd build
132113
python3 ../utils/report_targets.py --log `find . -name "all-*-tests.log"` --csv report.csv --allow-any-failure
133114
134115
- uses: actions/upload-artifact@v2
135116
with:
136-
name: fpga-interchange-tests-${{ matrix.device }}
117+
name: fpga-interchange-tests_${{ matrix.device }}_${{ matrix.tool }}_${{ matrix.os }}
137118
path: |
138119
**/plot_*.svg
120+
build/report*.csv
139121
140122
Prepare-Design-Status-Report:
141123
runs-on: ubuntu-18.04
142-
needs: Run-Nextpnr-Tests
124+
needs: Run-Tests
143125
steps:
144126

145127
- uses: actions/checkout@v2

tests/designs/litex_linux/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
get_python_cpu_data(
2-
VexRiscvLitexSmpCluster_Cc1_Iw32Is4096Iy1_Dw32Ds4096Dy1_Ldw128_Ood.v
2+
VexRiscvLitexSmpCluster_Cc1_Iw32Is4096Iy1_Dw32Ds4096Dy1_ITs4DTs4_Ldw128_Ood.v
33
pythondata_cpu_vexriscv_smp
44
vexriscv
55
)

tests/designs/litex_linux/arty.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16520,7 +16520,7 @@ BUFG BUFG_6(
1652016520
.O(clkout_buf1)
1652116521
);
1652216522

16523-
VexRiscvLitexSmpCluster_Cc1_Iw32Is4096Iy1_Dw32Ds4096Dy1_Ldw128_Ood VexRiscvLitexSmpCluster_Cc1_Iw32Is4096Iy1_Dw32Ds4096Dy1_Ldw128_Ood(
16523+
VexRiscvLitexSmpCluster_Cc1_Iw32Is4096Iy1_Dw32Ds4096Dy1_ITs4DTs4_Ldw128_Ood VexRiscvLitexSmpCluster_Cc1_Iw32Is4096Iy1_Dw32Ds4096Dy1_ITs4DTs4_Ldw128_Ood(
1652416524
.clintWishbone_ADR(main_soclinux_clintbus_adr),
1652516525
.clintWishbone_CYC(main_soclinux_clintbus_cyc),
1652616526
.clintWishbone_DAT_MOSI(main_soclinux_clintbus_dat_w),

tests/tests.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ function(add_generic_test)
193193
add_custom_command(
194194
OUTPUT ${netlist_yaml}
195195
COMMAND
196+
${quiet_cmd}
196197
${PYTHON3} -mfpga_interchange.convert
197198
--schema_dir ${INTERCHANGE_SCHEMA_PATH}
198199
--schema logical
@@ -214,6 +215,7 @@ function(add_generic_test)
214215
add_custom_command(
215216
OUTPUT ${phys}
216217
COMMAND
218+
${quiet_cmd}
217219
${NEXTPNR_FPGA_INTERCHANGE}
218220
--chipdb ${chipdb_loc}
219221
--xdc ${xdc}
@@ -237,6 +239,7 @@ function(add_generic_test)
237239
add_custom_command(
238240
OUTPUT ${phys}
239241
COMMAND
242+
${quiet_cmd}
240243
${VPR}
241244
${device_loc} ${netlist}
242245
--arch_format fpga-interchange
@@ -262,6 +265,7 @@ function(add_generic_test)
262265
add_custom_command(
263266
OUTPUT ${phys_yaml}
264267
COMMAND
268+
${quiet_cmd}
265269
${PYTHON3} -mfpga_interchange.convert
266270
--schema_dir ${INTERCHANGE_SCHEMA_PATH}
267271
--schema physical

utils/aggregate_results.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,18 @@ def main():
9595
device_files = dict()
9696
for name in os.listdir(args.inp):
9797

98-
if not name.startswith("fpga-interchange-tests-"):
98+
if not name.startswith("fpga-interchange-tests_"):
99+
continue
100+
101+
_, device, tool, os_name = name.split("_")
102+
103+
if os_name == "centos" or tool == "vpr":
99104
continue
100105

101106
pathname = os.path.join(args.inp, name)
102107
if not os.path.isdir(pathname):
103108
continue
104109

105-
# Get the device name
106-
device = name.replace("fpga-interchange-tests-", "")
107110
device_files[device] = dict()
108111

109112
# Test status report
@@ -125,7 +128,7 @@ def main():
125128
# Generate content
126129
for device, files in device_files.items():
127130

128-
assert "report" in files, files
131+
assert "report" in files, (device, files)
129132

130133
# Load CSV report
131134
with open(files["report"], "r") as fp:

utils/report_targets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def main():
241241
# Data
242242
keys = sorted(designs.keys(), key=lambda x: x[1])
243243
for key in keys:
244-
line = "{},{},{}".format(key[1], key[0], key[2])
244+
line = f"{key[1]},{key[0]},{key[2]}"
245245
for stage in all_stages:
246246
status = designs[key][stage]
247247
if status is True:

0 commit comments

Comments
 (0)