|
| 1 | +name: Build and run tests |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + test: |
| 7 | + strategy: |
| 8 | + matrix: |
| 9 | + include: |
| 10 | + - runner: ubuntu-20.04 |
| 11 | + config: clang |
| 12 | + cc: clang |
| 13 | + - runner: ubuntu-20.04 |
| 14 | + config: gcc |
| 15 | + cc: gcc |
| 16 | + - runner: ubuntu-18.04 |
| 17 | + config: gcc |
| 18 | + cc: gcc-4.8 |
| 19 | + - runner: ubuntu-18.04 |
| 20 | + config: clang |
| 21 | + cc: clang-3.9 |
| 22 | + - runner: macOS-10.15 |
| 23 | + config: clang |
| 24 | + cc: clang |
| 25 | + runs-on: ${{ matrix.runner }} |
| 26 | + steps: |
| 27 | + |
| 28 | + - uses: actions/checkout@v2 |
| 29 | + |
| 30 | + - name: Install dependencies (Linux) |
| 31 | + if: runner.os == 'Linux' |
| 32 | + run: | |
| 33 | + sudo apt-get update |
| 34 | + sudo apt-get install g++ gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev |
| 35 | +
|
| 36 | + - name: Install gcc-4.8 |
| 37 | + if: matrix.cc == 'gcc-4.8' |
| 38 | + run: | |
| 39 | + sudo apt-get install g++-4.8 |
| 40 | +
|
| 41 | + - name: Install clang-3.9 |
| 42 | + if: matrix.cc == 'clang-3.9' |
| 43 | + run: | |
| 44 | + sudo apt-get install clang-3.9 |
| 45 | +
|
| 46 | + - name: Install dependencies (macOS) |
| 47 | + if: runner.os == 'macOS' |
| 48 | + run: | |
| 49 | + brew install bison gawk libffi pkg-config bash |
| 50 | +
|
| 51 | + - name: Setup environment (Linux) |
| 52 | + if: runner.os == 'Linux' |
| 53 | + run: | |
| 54 | + echo "procs=$(nproc)" >> $GITHUB_ENV |
| 55 | +
|
| 56 | + - name: Setup environment (macOS) |
| 57 | + if: runner.os == 'macOS' |
| 58 | + run: | |
| 59 | + echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH |
| 60 | + echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV |
| 61 | +
|
| 62 | + - name: Get iverilog |
| 63 | + run: | |
| 64 | + git clone git://github.com/steveicarus/iverilog.git |
| 65 | +
|
| 66 | + - name: Cache iverilog |
| 67 | + id: cache-iverilog |
| 68 | + uses: actions/cache@v2 |
| 69 | + with: |
| 70 | + path: iverilog-bin |
| 71 | + key: ${{ matrix.runner }}-${{ hashFiles('iverilog/.git/refs/heads/master') }} |
| 72 | + |
| 73 | + - name: Build iverilog |
| 74 | + if: steps.cache-iverilog.outputs.cache-hit != 'true' |
| 75 | + run: | |
| 76 | + mkdir iverilog-bin |
| 77 | + cd iverilog |
| 78 | + autoconf |
| 79 | + CC=gcc CXX=g++ ./configure --prefix=$PWD/../iverilog-bin |
| 80 | + make -j${{ env.procs }} |
| 81 | + make install |
| 82 | +
|
| 83 | + - name: Build yosys |
| 84 | + run: | |
| 85 | + ${{ matrix.cc }} --version |
| 86 | + make config-${{ matrix.config }} |
| 87 | + make -j${{ env.procs }} CC=${{ matrix.cc }} CXX=${{ matrix.cc }} LD=${{ matrix.cc }} |
| 88 | +
|
| 89 | + - name: Run tests |
| 90 | + run: | |
| 91 | + PATH=$PWD/iverilog-bin/bin:$PATH make -j${{ env.procs }} test CC=${{ matrix.cc }} CXX=${{ matrix.cc }} LD=${{ matrix.cc }} |
0 commit comments