tests: Improve GitHub CI action #3438
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: [push, pull_request] | |
env: | |
GHDL_VERSION: "v4.1.0" | |
VERILATOR_VERSION: "v5.030" | |
jobs: | |
build: | |
runs-on: ubuntu-24.04 | |
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 | |
sudo apt-get install libevent-dev libjson-c-dev flex bison | |
sudo apt-get install libfl-dev libfl2 zlib1g-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: "3.12" | |
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 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 |