-
Notifications
You must be signed in to change notification settings - Fork 589
174 lines (146 loc) · 4.75 KB
/
ci.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
name: ci
on: [push, pull_request]
env:
GHDL_VERSION: "v4.1.0"
VERILATOR_VERSION: "v5.030"
CT_NG_VERSION: "32f288e61fee8528931bcd55bf106cf0cfb4e2a1"
jobs:
build:
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: ["3.8", "3.12"]
steps:
# Checkout Repository
- name: Checkout
uses: actions/checkout@v4
- name: Setup CCache
uses: hendrikmuhs/[email protected]
with:
create-symlink: true
# Install Tools
- name: Install Tools
run: |
sudo apt-get install wget build-essential ninja-build libtool libtool-bin
sudo apt-get install libevent-dev libjson-c-dev flex bison
sudo apt-get install libfl-dev libfl2 zlib1g-dev libncurses5-dev
sudo apt-get install llvm gnat help2man mold clang lld
- name: Set up SBT
uses: sbt/setup-sbt@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "setup.py"
- name: Install Python dependencies
run: |
python3 -m pip install setuptools requests pexpect meson
# Install GCC Toolchains
- name: Install GCC Toolchains
run: |
sudo python3 litex_setup.py --gcc=riscv
sudo python3 litex_setup.py --gcc=openrisc
sudo python3 litex_setup.py --gcc=powerpc
# Build / Install crosstool-ng
- name: Cache crosstool-ng
id: cache-crosstool-ng
uses: actions/cache@v3
with:
path: crosstool-ng
key: crosstool-ng-${{ env.CT_NG_VERSION }}-${{ runner.os }}
- name: Checkout crosstool-ng
if: steps.cache-crosstool-ng.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: crosstool-ng/crosstool-ng
ref: ${{ env.CT_NG_VERSION }}
path: crosstool-ng
- name: Build crosstool-ng
if: steps.cache-crosstool-ng.outputs.cache-hit != 'true'
run: |
cd crosstool-ng
./bootstrap
./configure
make -j$(nproc)
- name: Install crosstool-ng
run: |
cd crosstool-ng
sudo make install
- name: Cache x-tools
id: cache-x-tools
uses: actions/cache@v3
with:
path: x-tools
key: x-tools-${{ runner.os }}
- name: Build lm32 toolchain
if: steps.cache-x-tools.outputs.cache-hit != 'true'
run: |
unset LD_LIBRARY_PATH
ct-ng lm32-unknown-elf
sed -i -e '/CT_LOG_PROGRESS_BAR/s/y$/n/' .config
sed -i -e '/CT_LOCAL_TARBALLS_DIR/s/HOME/CT_TOP_DIR/' .config
sed -i -e '/CT_PREFIX_DIR/s/HOME/CT_TOP_DIR/' .config
ct-ng build
- name: Add toolchains to PATH
run: |
for d in $(pwd)/x-tools/*/bin; do echo "$d" >> $GITHUB_PATH; done
# Build / Install GHDL
- name: Cache GHDL
id: cache-ghdl
uses: actions/cache@v3
with:
path: ghdl
key: ghdl-${{ env.GHDL_VERSION }}-${{ runner.os }}
- name: Checkout GHDL
if: steps.cache-ghdl.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: ghdl/ghdl
ref: ${{ env.GHDL_VERSION }}
path: ghdl
- name: Build GHDL
if: steps.cache-ghdl.outputs.cache-hit != 'true'
run: |
cd ghdl
./configure --with-llvm-config
make -j$(nproc)
- name: Install GHDL
run: |
cd ghdl
sudo make install
# Build / Install Verilator
- name: Cache Verilator
id: cache-verilator
uses: actions/cache@v3
with:
path: verilator
key: verilator-${{ env.VERILATOR_VERSION }}-${{ runner.os }}
- name: Checkout Verilator
if: steps.cache-verilator.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: verilator/verilator
ref: ${{ env.VERILATOR_VERSION }}
path: verilator
- name: Build Verilator
if: steps.cache-verilator.outputs.cache-hit != 'true'
run: |
cd verilator
autoconf
./configure CC=clang CXX=clang++
make -j$(nproc)
- name: Install Verilator
run: |
cd verilator
sudo make install
# Install (n)Migen / LiteX / Cores
- name: Install LiteX
run: |
python3 litex_setup.py --config=full --init --install --user --dev
# Install Project
- name: Install Project
run: python3 setup.py develop --user
# Test
- name: Run Tests
run: python3 -m unittest discover -v