add github action

This commit is contained in:
Dolu1990 2021-06-23 09:04:35 +02:00
parent 1017b316b8
commit cdd8a7e94a
2 changed files with 121 additions and 0 deletions

59
.github/workflows/scala.yml vendored Normal file
View file

@ -0,0 +1,59 @@
name: Scala CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-v2
restore-keys: |
${{ runner.os }}-pip-
- name: Cache SBT
uses: actions/cache@v2
with:
path: |
~/.ivy2/cache
~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}
- name: Cache tools
id: tools
uses: actions/cache@v2
with:
path: |
~/tools
key: ${{ runner.os }}-tools_v2
- name: Setup env
run: echo "$HOME/tools/bin" >> $GITHUB_PATH
- name: Install cached tools
if: steps.tools.outputs.cache-hit != 'true'
run: source tools.sh && (cd ~/ && install_verilator)
- name: Install uncached tools
run: (cd .. && git clone https://github.com/SpinalHDL/SpinalHDL.git -b dev)
- name: Compile tests
run: sbt "+test:compile"
- name: Run tests
run: sbt "+test"

62
tools.sh Normal file
View file

@ -0,0 +1,62 @@
#!/bin/sh
install_verilator(){
sudo apt install -y git make autoconf g++ flex libfl-dev bison # First time prerequisites
git clone http://git.veripool.org/git/verilator # Only first time
unset VERILATOR_ROOT # For bash
cd verilator
git pull # Make sure we're up-to-date
git checkout v4.040
autoconf # Create ./configure script
./configure --prefix ~/tools
make -j$(nproc)
make install
cd ..
}
install_ghdl(){
sudo apt install -y gnat-9 libgnat-9 zlib1g-dev libboost-dev
git clone https://github.com/ghdl/ghdl ghdl-build && cd ghdl-build
git reset --hard "0316f95368837dc163173e7ca52f37ecd8d3591d"
mkdir build
cd build
../configure --prefix=~/tools
make -j$(nproc)
make install
cd ..
}
install_iverilog(){
sudo apt install -y gperf readline-common bison flex libfl-dev
curl -fsSL https://github.com/steveicarus/iverilog/archive/v10_3.tar.gz | tar -xvz
cd iverilog-10_3
autoconf
./configure --prefix ~/tools
make -j$(nproc)
make install
cd ..
}
install_cocotb(){
pip3 install --user cocotb
sudo apt install -y git make gcc g++ swig python3-dev
}
purge_cocotb(){
# Force cocotb to compile VPI to avoid race condition when tests are start in parallel
cd tester/src/test/python/spinal/Dummy
make TOPLEVEL_LANG=verilog
make TOPLEVEL_LANG=vhdl
cd ../../../../../..
}
install_packages(){
sudo apt install -y gnat-9 libgnat-9 zlib1g-dev libboost-dev
}
install_tools(){
install_verilator
install_ghdl
install_iverilog
install_cocotb
}