name: Build and run tests with Verific (Linux) on: pull_request: merge_group: #push: # branches: [ main ] workflow_dispatch: jobs: pre_job: runs-on: ubuntu-latest outputs: should_skip: ${{ steps.set_output.outputs.should_skip }} steps: - id: skip_check if: ${{ github.event_name != 'merge_group' }} uses: mmicko/skip-duplicate-actions@master with: # don't run on documentation changes paths_ignore: '["**/README.md", "docs/**", "guidelines/**"]' # cancel previous builds if a new commit is pushed # but never cancel main cancel_others: ${{ github.ref != 'refs/heads/main' }} - id: set_output run: | if [ "${{ github.event_name }}" = "merge_group" ]; then echo "should_skip=false" >> $GITHUB_OUTPUT else echo "should_skip=${{ steps.skip_check.outputs.should_skip }}" >> $GITHUB_OUTPUT fi test-verific: needs: pre_job if: ${{ needs.pre_job.outputs.should_skip != 'true' && github.repository_owner == 'YosysHQ' }} runs-on: [self-hosted, linux, x64, fast] steps: - name: Checkout Yosys uses: actions/checkout@v7 with: persist-credentials: false submodules: true - name: Runtime environment run: | echo "procs=$(nproc)" >> $GITHUB_ENV mkdir -p "${GITHUB_WORKSPACE}/coverage" echo "LLVM_PROFILE_FILE=${GITHUB_WORKSPACE}/coverage/coverage_%p.profraw" >> $GITHUB_ENV echo "LLVM_PROFILE_FILE_BUFFER_SIZE=0" >> $GITHUB_ENV echo "SEED=0" >> $GITHUB_ENV - name: Build Yosys run: | rm -rf build Configuration.cmake coverage echo 'set(CMAKE_C_COMPILER clang CACHE STRING "")' >> Configuration.cmake echo 'set(CMAKE_CXX_COMPILER clang++ CACHE STRING "")' >> Configuration.cmake echo 'set(YOSYS_COMPILER_LAUNCHER ccache CACHE STRING "")' >> Configuration.cmake echo 'set(YOSYS_ENABLE_COVERAGE ON CACHE BOOL "")' >> Configuration.cmake echo 'set(YOSYS_VERIFIC_DIR "/usr/local/src/verific_lib" CACHE STRING "")' >> Configuration.cmake cmake -C Configuration.cmake -B build . -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/.local -DCMAKE_BUILD_TYPE=Debug cmake --build build -j$procs - name: Install Yosys run: | cmake --build build --target install - name: Checkout SBY uses: actions/checkout@v7 with: repository: 'YosysHQ/sby' path: 'sby' persist-credentials: false - name: Build SBY run: | make -C sby install DESTDIR=${GITHUB_WORKSPACE}/.local PREFIX= - name: Run unit tests run: | ctest --test-dir build/tests/unit --output-on-failure - name: Run Yosys tests run: | make -C tests -j$procs vanilla-test - name: Run Verific specific Yosys tests run: | make -C tests/sva make -C tests/svtypes - name: Run coverage run: | make -C tests coverage make -C tests clean_coverage - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v7 with: token: ${{ secrets.CODECOV_TOKEN }} slug: YosysHQ/yosys files: build/coverage.info comment: false disable_search: true override_branch: ${{ github.event_name == 'merge_group' && github.event.merge_group.base_ref || github.ref_name }} - name: Skip generating files if: ${{ github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' }} run: | echo "LLVM_PROFILE_FILE=/dev/null" >> $GITHUB_ENV - name: Run SBY tests if: ${{ github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' }} run: | make -C sby run_ci test-pyosys: needs: pre_job if: ${{ needs.pre_job.outputs.should_skip != 'true' && github.repository_owner == 'YosysHQ' }} runs-on: [self-hosted, linux, x64, fast] steps: - name: Checkout Yosys uses: actions/checkout@v7 with: persist-credentials: false submodules: true - name: Install UV run: | curl -LsSf https://astral.sh/uv/install.sh | sh - name: Runtime environment run: | echo "procs=$(nproc)" >> $GITHUB_ENV echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - name: Build pyosys run: | echo 'set(CMAKE_C_COMPILER clang CACHE STRING "")' >> Configuration.cmake echo 'set(CMAKE_CXX_COMPILER clang++ CACHE STRING "")' >> Configuration.cmake echo 'set(YOSYS_COMPILER_LAUNCHER ccache CACHE STRING "")' >> Configuration.cmake echo 'set(YOSYS_VERIFIC_DIR "/usr/local/src/verific_lib" CACHE STRING "")' >> Configuration.cmake echo 'set(YOSYS_WITH_PYTHON ON CACHE BOOL "")' >> Configuration.cmake echo 'set(YOSYS_INSTALL_PYTHON ON CACHE BOOL "")' >> Configuration.cmake cmake -C Configuration.cmake -B build . \ -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/.local \ -DYOSYS_INSTALL_PYTHON_SITEDIR=$GITHUB_WORKSPACE/.local/usr/lib/python3/site-packages cmake --build build -j$procs - name: Install pyosys run: | cmake --build build --target install - name: Run pyosys tests run: | export PYTHONPATH=${GITHUB_WORKSPACE}/.local/usr/lib/python3/site-packages:$PYTHONPATH python3 tests/pyosys/run_tests.py test-verific-result: runs-on: ubuntu-latest needs: - test-verific - test-pyosys if: always() steps: - name: Check results run: | echo "Needs results: ${{ join(needs.*.result, ',') }}" if [[ "${{ join(needs.*.result, ',') }}" == *failure* ]] || \ [[ "${{ join(needs.*.result, ',') }}" == *cancelled* ]]; then echo "Some jobs failed or were cancelled" exit 1 fi - run: echo "All good"