diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 76734bf..5bba3dd 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -14,11 +14,76 @@ jobs: shell: bash run: | sudo apt-get update - sudo apt-get install -y cmake build-essential libfmt-dev yosys - - uses: YosysHQ/setup-oss-cad-suite@v3 + sudo apt-get install -y cmake build-essential libfmt-dev + sudo apt-get install -y gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev - uses: actions/checkout@v3 with: - submodules: 'recursive' fetch-depth: 0 - - run: | - TARGET=build/slang.so ./build.sh + - name: Initialize submodules + run: | + git submodule init + - name: Find out Yosys revision + run: | + { + echo -n "YOSYS_HASH=" + git submodule status --cached tests/third_party/yosys | awk '{print $1}' + } >> $GITHUB_ENV + - name: Cache Yosys build + id: cache-yosys + uses: actions/cache@v3 + env: + cache-name: cache-yosys + with: + path: tests/third_party/yosys + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.YOSYS_HASH }} + - if: ${{ steps.cache-yosys.outputs.cache-hit != 'true' }} + name: Pull Yosys + run: | + git submodule update --depth 0 -- tests/third_party/yosys + - if: ${{ steps.cache-yosys.outputs.cache-hit != 'true' }} + name: Build Yosys + shell: bash + run: | + cd tests/third_party/yosys + make config-gcc + echo "ENABLE_ABC := 0" >> Makefile.conf + make -j6 + - name: Install Yosys + shell: bash + run: | + cd tests/third_party/yosys + sudo make install + - name: Find out Slang revision + run: | + { + echo -n "SLANG_HASH=" + git submodule status --cached third_party/slang | awk '{print $1}' + } >> $GITHUB_ENV + - name: Cache Slang build + id: cache-slang + uses: actions/cache@v3 + env: + cache-name: cache-slang + with: + path: build/slang_install + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.SLANG_HASH }} + - if: ${{ steps.cache-slang.outputs.cache-hit != 'true' }} + name: Pull Slang + run: | + git submodule update --depth 0 -- third_party/slang + - if: ${{ steps.cache-slang.outputs.cache-hit != 'true' }} + name: Build Slang + shell: bash + run: | + cmake -S third_party/slang -B build/slang -DCMAKE_INSTALL_PREFIX=build/slang_install -DSLANG_USE_MIMALLOC=OFF \ + -DSLANG_INCLUDE_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DSLANG_INCLUDE_TOOLS=OFF \ + -DCMAKE_CXX_FLAGS="-fPIC" -DBoost_NO_BOOST_CMAKE=ON + make -C build/slang -j$(nproc) + make -C build/slang install + - name: Build yosys-slang + run: | + yosys-config --build slang.so \ + slang_frontend.cc initial_eval.cc proc_usage.cc \ + -Ibuild/slang_install/include -std=c++20 \ + -DSLANG_BOOST_SINGLE_HEADER -Lbuild/slang_install/lib \ + -lsvlang -lfmt