Skip to content

[WIP] Add clang-tidy checks to CI #13370

[WIP] Add clang-tidy checks to CI

[WIP] Add clang-tidy checks to CI #13370

Workflow file for this run

name: Test
on:
# We want to run the CI when anything is pushed to master.
# Since master is a protected branch this only happens when a PR is merged.
# This is a double check in case the PR was stale and had some issues.
push:
branches:
- master
paths-ignore: # Prevents from running if only docs are updated
- 'doc/**'
- '**/*README*'
- '**.md'
- '**.rst'
pull_request:
paths-ignore: # Prevents from running if only docs are updated
- 'doc/**'
- '**/*README*'
- '**.md'
- '**.rst'
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # daily
# We want to cancel previous runs for a given PR or branch / ref if another CI
# run is requested.
# See: https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
# default compiler for all non-compatibility tests
MATRIX_EVAL: "CC=gcc-13 && CXX=g++-13"
jobs:
BuildVTR:
name: 'B: Building VTR Release'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
submodules: 'true'
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Install dependencies
run: ./install_apt_packages.sh
- uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}
- name: Build
env:
CMAKE_PARAMS: "-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_IPO_BUILD=off -DVTR_ASSERT_LEVEL=3"
BUILD_TYPE: release
NUM_PROC: ${{ steps.cpu-cores.outputs.count }}
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j${{ steps.cpu-cores.outputs.count}}
- name: Pack Build
shell: bash
run: |
tar -czvf build.tar.gz --exclude='CMakeFiles' --exclude='*.a' --exclude='*.cmake' build/
- name: Store Build Artifact
uses: actions/upload-artifact@v7
with:
name: build-release.tar.gz
path: build.tar.gz
retention-days: 1
BuildVTRWithOdin:
name: 'B: Building VTR Release With Odin'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
submodules: 'true'
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
# NOTE: BlifExplorer requires Qt5 to build. We do not currently actually
# run the executable as part of the CI, but we at least want to test
# that it can be compiled.
- name: Install dependencies
run: |
./install_apt_packages.sh
sudo apt-get update
sudo apt-get install qtbase5-dev
- uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}
- name: Build
env:
CMAKE_PARAMS: "-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_IPO_BUILD=off -DVTR_ASSERT_LEVEL=3 -DWITH_BLIFEXPLORER=on -DWITH_PARMYS=OFF -DWITH_ODIN=on"
BUILD_TYPE: release
NUM_PROC: ${{ steps.cpu-cores.outputs.count }}
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j${{ steps.cpu-cores.outputs.count}}
- name: Pack Build
shell: bash
run: |
tar -czvf build.tar.gz --exclude='CMakeFiles' --exclude='*.a' --exclude='*.cmake' build/
- name: Store Build Artifact
uses: actions/upload-artifact@v7
with:
name: build-release-with-odin.tar.gz
path: build.tar.gz
retention-days: 1
Format:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- { name: 'C/C++', script: 'check-format.sh' , with_python: 'yes', with_submodules: 'true', all_vtr_pkgs: 'yes', pkgs: 'clang-format-18' }
- { name: 'Python', script: 'check-format-py.sh', with_python: 'yes', with_submodules: 'true', all_vtr_pkgs: 'yes', pkgs: '' }
name: 'F: ${{ matrix.name }}'
steps:
- uses: actions/checkout@v6
with:
submodules: ${{ matrix.with_submodules }}
# NOTE: We usually do not need sub-modules. We do not check sub-modules
# for formatting. However we may need to build make-format which
# requires building VTR which will not build without submodules.
# TODO: We should relax this requirement.
# In order to perform a cpp format of VTR, make format is used which requires
# all of the vpr dependencies to be installed.
# TODO: This should be fixed so this test is not as heavy. We do not need
# these dependencies to perform a simple format.
- name: Install dependencies
if: ${{ matrix.all_vtr_pkgs == 'yes' }}
run: ./install_apt_packages.sh
# TODO: This should be on the same version of Python as would be found on
# Ubuntu 24.04 (3.12.3); however that version has some linting errors.
# - The version of Pylint in requirements.txt is not compatible with
# python version 3.12.3. Pylint needs to be updated to move to this version.
- uses: actions/setup-python@v6
if: ${{ matrix.with_python == 'yes' }}
with:
python-version: 3.10.10
- name: Build Python Virtual Env
run: |
python -m venv .venv
- name: Install Python Requirements
if: ${{ matrix.with_python == 'yes' }}
run: |
source .venv/bin/activate
pip install -r requirements.txt
- name: Install dependencies
if: ${{ matrix.pkgs }}
run: sudo apt install -y ${{ matrix.pkgs }}
- name: Test
run: |
source .venv/bin/activate
./dev/${{ matrix.script }}
VerifyTestSuites:
runs-on: ubuntu-24.04
name: 'Verify Test Suites'
steps:
- uses: actions/setup-python@v6
with:
python-version: 3.12.3
- uses: actions/checkout@v6
# NOTE: We do not need sub-modules. This only verifies the tests, does not run them.
- name: 'Run test suite verification'
run: |
./dev/vtr_test_suite_verifier/verify_test_suites.py \
-vtr_regression_tests_dir vtr_flow/tasks/regression_tests \
-test_suite_info dev/vtr_test_suite_verifier/test_suites_info.json
UnitTests:
name: 'U: C++ Unit Tests'
runs-on: ubuntu-24.04
needs: [BuildVTR]
steps:
- uses: actions/checkout@v6
with:
submodules: 'true'
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Install dependencies
run: ./install_apt_packages.sh
- name: Download Build Artifact
uses: actions/download-artifact@v8
with:
name: build-release.tar.gz
- name: Unpack Build
shell: bash
run: |
tar -xvzf build.tar.gz
- name: Test
run: |
cd build
make test -j${{ steps.cpu-cores.outputs.count }}
# This test builds different variations of VTR (with different CMake Params)
# and ensures that they can run the basic regression tests. This also ensures
# that these build variations are warning clean.
BuildVariations:
runs-on: ubuntu-24.04
name: 'B: Build Variations'
env:
# For the CI, we want all build variations to be warning clean.
# NOTE: Need to turn IPO off due to false warnings being produced.
COMMON_CMAKE_PARAMS: '-DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_IPO_BUILD=off'
steps:
- uses: actions/setup-python@v6
with:
python-version: 3.12.3
- uses: actions/checkout@v6
with:
submodules: 'true'
- name: 'Get number of CPU cores'
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: 'Install dependencies'
run: ./install_apt_packages.sh
- name: 'Install Python Requirements'
run: |
pip install -r requirements.txt
- name: 'ccache'
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}
- name: 'Test with VTR_ASSERT_LEVEL 4'
timeout-minutes: 120
if: success() || failure()
env:
CMAKE_PARAMS: "${{ env.COMMON_CMAKE_PARAMS }} -DVTR_ASSERT_LEVEL=4"
NUM_PROC: ${{ steps.cpu-cores.outputs.count }}
run: |
rm -f build/CMakeCache.txt
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j${{ steps.cpu-cores.outputs.count}}
./run_reg_test.py vtr_reg_basic -show_failures -j${{ steps.cpu-cores.outputs.count}}
- name: 'Test with VTR_ASSERT_LEVEL 0'
timeout-minutes: 120
if: success() || failure()
env:
CMAKE_PARAMS: "${{ env.COMMON_CMAKE_PARAMS }} -DVTR_ASSERT_LEVEL=0"
NUM_PROC: ${{ steps.cpu-cores.outputs.count }}
run: |
rm -f build/CMakeCache.txt
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j${{ steps.cpu-cores.outputs.count}}
./run_reg_test.py vtr_reg_basic -show_failures -j${{ steps.cpu-cores.outputs.count}}
- name: 'Test with NO_GRAPHICS'
timeout-minutes: 60
if: success() || failure()
env:
CMAKE_PARAMS: "${{ env.COMMON_CMAKE_PARAMS }} -DVPR_USE_EZGL=off"
NUM_PROC: ${{ steps.cpu-cores.outputs.count }}
run: |
rm -f build/CMakeCache.txt
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j${{ steps.cpu-cores.outputs.count}}
./run_reg_test.py vtr_reg_basic -show_failures -j${{ steps.cpu-cores.outputs.count}}
- name: 'Test with NO_SERVER'
timeout-minutes: 60
if: success() || failure()
env:
CMAKE_PARAMS: "${{ env.COMMON_CMAKE_PARAMS }} -DVPR_USE_SERVER=off"
NUM_PROC: ${{ steps.cpu-cores.outputs.count }}
run: |
rm -f build/CMakeCache.txt
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j${{ steps.cpu-cores.outputs.count}}
./run_reg_test.py vtr_reg_basic -show_failures -j${{ steps.cpu-cores.outputs.count}}
- name: 'Test with CAPNPROTO disabled'
timeout-minutes: 60
if: success() || failure()
env:
CMAKE_PARAMS: "${{ env.COMMON_CMAKE_PARAMS }} -DVTR_ENABLE_CAPNPROTO=off"
NUM_PROC: ${{ steps.cpu-cores.outputs.count }}
run: |
rm -f build/CMakeCache.txt
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j${{ steps.cpu-cores.outputs.count}}
./run_reg_test.py vtr_reg_basic -show_failures -j${{ steps.cpu-cores.outputs.count}}
- name: 'Test with serial VPR_EXECUTION_ENGINE'
timeout-minutes: 60
if: success() || failure()
env:
CMAKE_PARAMS: "${{ env.COMMON_CMAKE_PARAMS }} -DVPR_EXECUTION_ENGINE=serial -DTATUM_EXECUTION_ENGINE=serial"
NUM_PROC: ${{ steps.cpu-cores.outputs.count }}
run: |
rm -f build/CMakeCache.txt
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j${{ steps.cpu-cores.outputs.count}}
./run_reg_test.py vtr_reg_basic -show_failures -j${{ steps.cpu-cores.outputs.count}}
- name: 'Test with VTR_ENABLE_DEBUG_LOGGING enabled'
timeout-minutes: 60
if: success() || failure()
env:
CMAKE_PARAMS: "${{ env.COMMON_CMAKE_PARAMS }} -DVTR_ENABLE_DEBUG_LOGGING=on"
NUM_PROC: ${{ steps.cpu-cores.outputs.count }}
run: |
rm -f build/CMakeCache.txt
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j${{ steps.cpu-cores.outputs.count}}
./run_reg_test.py vtr_reg_basic -show_failures -j${{ steps.cpu-cores.outputs.count}}
Regression:
runs-on: ubuntu-24.04
needs: [BuildVTR]
strategy:
fail-fast: false
matrix:
include: [
{
name: 'Basic',
suite: 'vtr_reg_basic',
extra_pkgs: ''
},
{
name: 'Strong',
suite: 'vtr_reg_strong',
extra_pkgs: ''
},
{
name: 'Parallel',
suite: 'vtr_reg_parallel',
extra_pkgs: '',
num_cores: 2
},
{
name: 'SystemVerilog',
suite: 'vtr_reg_system_verilog',
extra_pkgs: ''
},
{
name: 'Valgrind Memory',
suite: 'vtr_reg_valgrind_small',
extra_pkgs: 'valgrind'
}
]
name: 'R: ${{ matrix.name }}'
steps:
- uses: actions/setup-python@v6
with:
python-version: 3.12.3
- uses: actions/checkout@v6
with:
submodules: 'true'
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Install dependencies
run: ./install_apt_packages.sh
- name: Install Extra Dependencies
if: ${{ matrix.extra_pkgs != '' }}
run: |
sudo apt update
sudo apt install -y ${{ matrix.extra_pkgs }}
- name: Install Python Requirements
run: |
pip install -r requirements.txt
- name: Download Build Artifact
uses: actions/download-artifact@v8
with:
name: build-release.tar.gz
- name: Unpack Build
shell: bash
run: |
tar -xvzf build.tar.gz
- name: Test
timeout-minutes: 30
run: |
./run_reg_test.py ${{ matrix.suite }} -show_failures -j${{ matrix.num_cores || steps.cpu-cores.outputs.count}}
- name: Upload regression run files
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: ${{matrix.name}}_run_files
path: |
vtr_flow/**/*.out
# vtr_flow/**/*.blif # Removed since it was taking too much space and was hardly used.
vtr_flow/**/*.p
vtr_flow/**/*.net
vtr_flow/**/*.r
- name: Upload regression results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: ${{matrix.name}}_results
path: |
vtr_flow/**/*.log
vtr_flow/**/parse_results*.txt
RegressionWithOdin:
runs-on: ubuntu-24.04
needs: [BuildVTRWithOdin]
strategy:
fail-fast: false
matrix:
include: [
{
name: 'Basic_odin',
suite: 'vtr_reg_basic_odin',
extra_pkgs: ''
},
{
name: 'Strong_odin',
suite: 'vtr_reg_strong_odin',
extra_pkgs: ''
},
{
name: 'Valgrind Memory Odin',
suite: 'vtr_reg_valgrind_small_odin',
extra_pkgs: 'valgrind'
}
]
name: 'R: ${{ matrix.name }}'
steps:
- uses: actions/setup-python@v6
with:
python-version: 3.12.3
- uses: actions/checkout@v6
with:
submodules: 'true'
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Install dependencies
run: ./install_apt_packages.sh
- name: Install Extra Dependencies
if: ${{ matrix.extra_pkgs != '' }}
run: |
sudo apt update
sudo apt install -y ${{ matrix.extra_pkgs }}
- name: Install Python Requirements
run: |
pip install -r requirements.txt
- name: Download Build Artifact
uses: actions/download-artifact@v8
with:
name: build-release-with-odin.tar.gz
- name: Unpack Build
shell: bash
run: |
tar -xvzf build.tar.gz
- name: Test
timeout-minutes: 15
run: |
./run_reg_test.py ${{ matrix.suite }} -show_failures -j${{ steps.cpu-cores.outputs.count}}
- name: Upload regression run files
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: ${{matrix.name}}_run_files
path: |
vtr_flow/**/*.out
# vtr_flow/**/*.blif # Removed since it was taking too much space and was hardly used.
vtr_flow/**/*.p
vtr_flow/**/*.net
vtr_flow/**/*.r
- name: Upload regression results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: ${{matrix.name}}_results
path: |
vtr_flow/**/*.log
vtr_flow/**/parse_results*.txt
Sanitized:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include: [
{
name: 'Basic',
params: '-DVTR_ASSERT_LEVEL=3 -DVTR_ENABLE_SANITIZE=on -DVTR_IPO_BUILD=off -DWITH_BLIFEXPLORER=on -DWITH_PARMYS=OFF -DWITH_ODIN=on',
suite: 'vtr_reg_basic_odin'
}
#- { name: 'Strong', suite: 'vtr_reg_strong' } # SKIP Too long to run on GitHub Actions (max 6h)
]
name: 'S: ${{ matrix.name }}'
steps:
- uses: actions/setup-python@v6
with:
python-version: 3.12.3
- uses: actions/checkout@v6
with:
submodules: 'true'
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Install dependencies
run: ./install_apt_packages.sh
- name: Install Python Requirements
run: |
pip install -r requirements.txt
- uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}-${{ matrix.suite }}
- name: Test
timeout-minutes: 60
env:
CMAKE_PARAMS: ${{ matrix.params }}
BUILD_TYPE: RelWithDebInfo
LSAN_OPTIONS: 'exitcode=42' #Use a non-standard exit code to ensure LSAN errors are detected
# In Ubuntu 20240310.1.0, the entropy of ASLR has increased (28 -> 32). LLVM 14 in this
# image is not compatible with this increased ASLR entropy. Apparently, memory sanitizer
# depends on LLVM and all CI tests where VTR_ENABLE_SANITIZE is enabled fail. For a temporary
# fix, we manually reduce the entropy. This quick fix should be removed in the future
# when github deploys a more stable Ubuntu image.
NUM_PROC: ${{ steps.cpu-cores.outputs.count }}
run: |
sudo sysctl -w vm.mmap_rnd_bits=28
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
./.github/scripts/build.sh
# We skip QoR since we are only checking for errors in sanitizer runs
./run_reg_test.py ${{ matrix.suite }} -show_failures -j${{ steps.cpu-cores.outputs.count }} -skip_qor
Parmys:
name: 'Parmys Basic Test'
runs-on: ubuntu-24.04
needs: [BuildVTR]
steps:
- uses: actions/setup-python@v6
with:
python-version: 3.12.3
- uses: actions/checkout@v6
with:
submodules: 'true'
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Install dependencies
run: ./install_apt_packages.sh
- name: Install Python Requirements
run: |
pip install -r requirements.txt
- name: Download Build Artifact
uses: actions/download-artifact@v8
with:
name: build-release.tar.gz
- name: Unpack Build
shell: bash
run: |
tar -xvzf build.tar.gz
- name: Test
timeout-minutes: 30
run: |
./run_reg_test.py parmys_reg_basic -show_failures -j${{ steps.cpu-cores.outputs.count }}
ODINII:
name: 'ODIN-II Basic Test'
runs-on: ubuntu-24.04
needs: [BuildVTRWithOdin]
steps:
- uses: actions/setup-python@v6
with:
python-version: 3.12.3
- uses: actions/checkout@v6
with:
submodules: 'true'
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Install dependencies
run: ./install_apt_packages.sh
- name: Install Python Requirements
run: |
pip install -r requirements.txt
- name: Download Build Artifact
uses: actions/download-artifact@v8
with:
name: build-release-with-odin.tar.gz
- name: Unpack Build
shell: bash
run: |
tar -xvzf build.tar.gz
- name: Test
timeout-minutes: 15
run: |
sudo sysctl -w vm.mmap_rnd_bits=28
./run_reg_test.py odin_reg_basic -show_failures -j${{ steps.cpu-cores.outputs.count }}
VQM2BLIF:
name: 'VQM2BLIF Basic Tests'
runs-on: ubuntu-24.04
needs: [BuildVTR]
steps:
- uses: actions/setup-python@v6
with:
python-version: 3.12.3
- uses: actions/checkout@v6
with:
submodules: 'true'
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Install dependencies
run: ./install_apt_packages.sh
- name: Download Build Artifact
uses: actions/download-artifact@v8
with:
name: build-release.tar.gz
- name: Unpack Build
shell: bash
run: |
tar -xvzf build.tar.gz
- name: Test
run: |
./utils/vqm2blif/test/scripts/test_vqm2blif.sh
Compatibility:
runs-on: ubuntu-24.04
needs: [BuildVTR]
strategy:
fail-fast: false
matrix:
include:
- { name: 'GCC 12 (Ubuntu Noble - 24.04)', CC: 'gcc-12', CXX: 'g++-12', }
- { name: 'GCC 14 (Ubuntu Noble - 24.04)', CC: 'gcc-14', CXX: 'g++-14', }
- { name: 'Clang 16 (Ubuntu Noble - 24.04)', CC: 'clang-16', CXX: 'clang++-16', }
- { name: 'Clang 17 (Ubuntu Noble - 24.04)', CC: 'clang-17', CXX: 'clang++-17', }
- { name: 'Clang 18 (Ubuntu Noble - 24.04)', CC: 'clang-18', CXX: 'clang++-18', }
# Note: We do not include GCC-13 since it is the default and is already tested.
# We also do not include GCC-11 since it is tested in the JammyCompatibility test.
name: 'B: ${{ matrix.name }}'
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
steps:
- uses: actions/checkout@v6
with:
submodules: 'true'
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Install dependencies
run: ./install_apt_packages.sh
- uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}-${{ matrix.CC }}
- name: Build
env:
CMAKE_PARAMS: "-DVTR_ASSERT_LEVEL=3 -DVTR_IPO_BUILD=off"
BUILD_TYPE: release # Note: Found that release build caches way better than debug build for this test.
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j${{ steps.cpu-cores.outputs.count}}
JammyCompatibility:
name: 'Ubuntu Jammy - 22.04 Compatibility Test'
runs-on: ubuntu-22.04
needs: [BuildVTR]
env:
CC: gcc-11
CXX: g++-11
steps:
- uses: actions/checkout@v6
with:
submodules: 'true'
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Install Dependencies
run: ./install_apt_packages.sh
- uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}-gcc-11
- name: Build
env:
CMAKE_PARAMS: "-DVTR_ASSERT_LEVEL=3 -DCMAKE_COMPILE_WARNING_AS_ERROR=on -DVTR_IPO_BUILD=off"
BUILD_TYPE: release # Note: Found that release build caches way better than debug build for this test.
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -j${{ steps.cpu-cores.outputs.count}}
Msys2Compatibility:
needs: [BuildVTR]
name: ${{ matrix.config.name }}
runs-on: windows-2025
# Branch on different OS and settings
strategy:
fail-fast: false
matrix:
config:
# UCRT64 is another environment supported by Msys2. It has a different set of package names than the MINGW64 but the same as foundational libraries. If MINGW64 can pass, UCRT64 can pass mostly. It is commented out just to avoid CI runtime increase for now.
# - name: "Build Compatibility (GCC, Windows Msys2-UCRT64)"
# cc: gcc
# cxx: g++
# os: UCRT64
# prefix: ucrt64
- name: "Build Compatibility (GCC, Windows Msys2-MINGW64)"
cc: gcc
cxx: g++
os: MINGW64
prefix: mingw64
defaults:
run:
# This ensures all 'run' steps use the MSYS2 bash shell by default
shell: msys2 {0}
# Define the steps to run the build job
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
steps:
- uses: actions/checkout@v6
with:
submodules: 'true'
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.config.os }}
update: true
# Optional: Pre-install core tools needed to run your script
install: >-
wget
git
#In MSYS2, the flex package is an MSYS-native tool, meaning it installs its headers to /usr/include/FlexLexer.h. However, if you are using a MinGW-w64 environment (e.g., UCRT64, MINGW64), the compiler only looks for headers in /mingw64/include or similar toolchain-specific paths. The most common workaround is to copy or link the header from the MSYS directory to your active MinGW-w64 include directory.
# For python build from sources
- name: Install dependencies
run: |
./install_win_msys2_${{ matrix.config.prefix}}_packages.sh
cp /usr/include/FlexLexer.h /${{ matrix.config.prefix}}/include/
- name: Dump tool versions
run: |
which cmake
cmake --version
which ${CC}
${CC} --version
which ${CXX}
${CXX} --version
which ld
ld --version
which python3
python3 --version
echo "==== Checking yosys packages ===="
which yosys.exe
echo "==== Checking libgnat.a ===="
ls /${{ matrix.config.prefix }}/lib/gcc/x86_64-w64-mingw32/*/adalib/libgnat.a
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-msys2-${{ github.job }}-${{ hashFiles('**/CMakeLists.txt', '**/Makefile') }}
restore-keys: |
${{ runner.os }}-msys2-${{ github.job }}-
${{ runner.os }}-msys2-
- name: Build
shell: msys2 {0}
env:
CMAKE_PARAMS: "-DWITH_ABC=OFF -DWITH_PARMYS=OFF -DSLANG_SYSTEMVERILOG=OFF -DVTR_IPO_BUILD=off -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
BUILD_TYPE: release # Note: Found that release build caches way better than debug build for this test.
CCACHE_DIR: ${{ github.workspace }}/.ccache
run: |
make -j${{ steps.cpu-cores.outputs.count}}
# Test the compilation compatibility on Windows MSVC compiler
MsvcCompatibility:
needs: [BuildVTR]
name: ${{ matrix.config.name }}
runs-on: windows-2025
strategy:
fail-fast: false
matrix:
config:
- name: "Build Compatibility (MSVC, Windows 2025)"
steps:
- uses: actions/checkout@v6
with:
submodules: 'true'
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: vcpkg build
uses: johnwason/vcpkg-action@v8
id: vcpkg
with:
# vcpkg will automatically find and use the vcpkg.json in your repo root
token: ${{ secrets.GITHUB_TOKEN }}
manifest-dir: ${{ github.workspace }} # Set to the directory containing your vcpkg.json file
triplet: x64-windows-release # This must be set with a valid vcpkg triplet
- name: Install WinFlexBison and Tcl
shell: powershell
run: |
choco install winflexbison3 wget
choco install magicsplat-tcl-tk --version=1.16.0
- name: Dump tool versions
shell: powershell
run: |
cmake --version
where curl
win_flex --version
win_bison --version
tclsh --version
- name: Ensure curl is available
shell: powershell
run: |
$curlPath = (Get-Command curl.exe -ErrorAction SilentlyContinue).Source
if (-not $curlPath) {
choco install curl
$curlPath = (Get-Command curl.exe).Source
}
echo "CURL_PATH=$curlPath" >> $env:GITHUB_ENV
- name: Set up MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Check MSVC Version
run: cl
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-msvc-${{ github.sha }}
restore-keys: ${{ runner.os }}-msvc-
- name: Configure and build with CMake
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
run: |
mkdir build
cd build
cmake ${{ steps.vcpkg.outputs.vcpkg-cmake-config }} -S .. -B . -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_PARMYS=OFF -DSLANG_SYSTEMVERILOG=OFF -DVTR_IPO_BUILD=OFF -DWITH_ABC=OFF -DWGET="${{ env.CURL_PATH }}" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build . --parallel ${{ steps.cpu-cores.outputs.count }}