From 85db5e092b7c949d1b194fd07bfdf929f5e608bd Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 9 Jun 2023 12:08:37 -0400 Subject: [PATCH 1/5] fix: PythonLibs issue This is already included in PythonExtensions & is not valid with "REQUIRED". See https://github.com/scikit-build/scikit-build/issues/989 --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 580cb8cf..fc0d143a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,6 @@ endif() if(HDLCONVERTOR_PYTHON) message(STATUS "Building python hdlConvertor module with libhdlConvertor linked in") find_package(PythonExtensions REQUIRED) - find_package(PythonLibs REQUIRED) find_package(Cython REQUIRED) else() message(STATUS "Building libhdlConvertor (C++ lib) only, to build python module use setup.py.") From ec7a130d03a7dc04419a4e7bcd1224800f6f7882 Mon Sep 17 00:00:00 2001 From: Manuel Bertsch Date: Tue, 19 Dec 2023 18:29:17 +0100 Subject: [PATCH 2/5] tests+verilog preproc: Fix ANTLR <=4.9, CMake and Icarus tests - ANTLR 4.9 antlrcpp::Any was used incorrectly, preventing it from compiling on e.g. 4.9.3 - Depending on the compiler and CMake version used, C++ 17 wouldn't be automatically selected for the project. - Icarus moved the test file "sv_macro3" to two separate versions (a and b), but this is not yet correctly reflected in their file lists. With this change, all ~7000 tests collect correctly again under pytest and concurrencytest. --- src/CMakeLists.txt | 2 ++ src/verilogPreproc/verilogPreproc.cpp | 4 +++- tests/test_icarus_verilog_testsuite.py | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1a0db05b..c650a362 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,6 +2,8 @@ # build of the main library ############################################################################################## +set(CMAKE_CXX_STANDARD 17) + include(${CMAKE_CURRENT_SOURCE_DIR}/CMake_antlr4.txt) include_directories( diff --git a/src/verilogPreproc/verilogPreproc.cpp b/src/verilogPreproc/verilogPreproc.cpp index 0584e8b7..413f7ce2 100644 --- a/src/verilogPreproc/verilogPreproc.cpp +++ b/src/verilogPreproc/verilogPreproc.cpp @@ -1,3 +1,5 @@ +#include + #include // antlr4-runtime/ @@ -194,7 +196,7 @@ antlrcpp::Any VerilogPreproc::visitDefine( vector params_dummy; if (da) { #if !defined(ANTLRCPP_VERSION_MAJOR) || (ANTLRCPP_VERSION_MAJOR == 4 && ANTLRCPP_VERSION_MINOR <= 9) - params = visitDefine_args(da); + params = visitDefine_args(da).as *>(); #else params = std::any_cast *>(visitDefine_args(da)); #endif diff --git a/tests/test_icarus_verilog_testsuite.py b/tests/test_icarus_verilog_testsuite.py index 8f22eef9..13be11cf 100644 --- a/tests/test_icarus_verilog_testsuite.py +++ b/tests/test_icarus_verilog_testsuite.py @@ -48,6 +48,7 @@ def parse_verilator_record(line, dir_name): "sv_string_index": "string_index", "sv_timeunit_prec": "sv_timeunit_prec1", "sv_timeunit_prec_fail": "sv_timeunit_prec_fail1", + "sv_macro3": "sv_macro3a" } name = name_fix.get(name, name) args = columns[1] From 13fce3ce9e94b32e632a139ee865af2b2ad64d5a Mon Sep 17 00:00:00 2001 From: Kin Wong Date: Sat, 13 Jan 2024 23:33:11 +0000 Subject: [PATCH 3/5] GitHub CI with Prebuilt Binary Wheel (#188) * GitHub CI with ANTRL4 bundled c414db3 * Fix Typo 5bf1d88 * Fix Source Build Python Version 52db50d * Add Debug Build and Test Job 65e6169 * Fix Typo b09038b * Typo 8f2c8dc --- .github/workflows/build_and_release.yml | 169 ++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 .github/workflows/build_and_release.yml diff --git a/.github/workflows/build_and_release.yml b/.github/workflows/build_and_release.yml new file mode 100644 index 00000000..ff9cd40e --- /dev/null +++ b/.github/workflows/build_and_release.yml @@ -0,0 +1,169 @@ +name: Test, Build and Deploy + +on: [push] + +permissions: + contents: read + +jobs: + # Create a Debug build and test it. + build_and_test: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - uses: actions/setup-python@v5 + with: + python-version: "3.10" + + # Don't need to install Python / Create venv, as you are running in a container. + # You don't even need to install g++/cmake as it comes with the docker image. + - name: Install Dependencies + run: | + sudo apt update -y + sudo apt install build-essential uuid-dev cmake default-jre \ + libantlr4-runtime-dev antlr4 libssl-dev -yq + pip install setuptools wheel cmake ninja patchelf auditwheel + pip install -r requirements.txt + + - name: Check Your Environment + run: | + gcc -v + python --version + cmake --version + free + + - name: Build + run: | + echo Your Build Script here + echo Make sure the Debug and Coverage Switch is on, only in this job. + + - name: Test + run: | + echo Your Test Script here + + - name: Extract Coverage Report + run: | + echo Your Coverage Report + + + # Build on Different Platform. + build_linux_amd64: + + # This can be expensive so you might skip this if it is not tagged + # by uncommenting the following + # if: ${{ startsWith(github.ref, 'refs/tags/v') && success() }} + + # Run only when the test is good. + if: ${{ success() }} + + needs: + - build_and_test + + strategy: + matrix: + python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12" ] + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install Dependencies + run: | + sudo apt update -y + sudo apt install build-essential uuid-dev cmake default-jre \ + libantlr4-runtime-dev antlr4 libssl-dev -yq + pip install setuptools wheel cmake ninja patchelf auditwheel + pip install -r requirements.txt + + # Include ANTLR4's License file as we are redistributing their binary + - name: Adding ANTLR4 License + run: | + curl -s https://raw.githubusercontent.com/antlr/antlr4/master/LICENSE.txt >> LICENSE + + # Build the library. + # Don't include debug and coverage stuff here. + # GitHub runner on Open source project is equipped with 4 cores. + # Use them with `-j 4` flag + - name: Build Library + run: | + python setup.py bdist_wheel -j 4 + auditwheel repair --plat manylinux_2_31_x86_64 dist/*.whl + + - name: Archive Artifacts + uses: actions/upload-artifact@v3 + with: + name: PythonPackage + path: | + wheelhouse + + # Build the Source Bundle + # Developer can still build on their machine with the source bundle + # (i.e. the original `pip install` flow if the platform is not included by above steps) + build_sdist: + runs-on: ubuntu-20.04 + if: ${{ success() }} + + needs: + - build_and_test + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - uses: actions/setup-python@v5 + with: + python-version: "3.9" + - name: Install Dependencies + run: | + sudo apt update -y + sudo apt install build-essential uuid-dev cmake default-jre \ + libantlr4-runtime-dev antlr4 libssl-dev -yq + pip install setuptools wheel cmake ninja patchelf auditwheel + pip install -r requirements.txt + + # Not including ANTLR4 license here as we don't redistribute ANTLR4 Binary in this package. + + - name: Build Source Library + run: | + python setup.py sdist + + - name: Archive Artifacts + uses: actions/upload-artifact@v3 + with: + name: PythonPackage + path: | + dist + + # Add your testing steps here + + publish: + + runs-on: ubuntu-latest + + # Publish only when a tag "v*" is pushed. (which is a release) + if: ${{ startsWith(github.ref, 'refs/tags/v') && success() }} + + needs: + - build_linux_amd64 + - build_sdist + + environment: + name: pypi + url: https://pypi.org/p/hdlConvertor + permissions: + id-token: write + + steps: + - name: Download Package Built + uses: actions/download-artifact@v3 + with: + name: PythonPackage + path: dist + + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 From 15d8224a4cb83089e2c9d2cf63963e85c5785fe4 Mon Sep 17 00:00:00 2001 From: Nic30 Date: Sun, 14 Jan 2024 00:42:45 +0100 Subject: [PATCH 4/5] ci: githubactions update to ubuntu 23.10 --- .github/workflows/build_and_release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_and_release.yml b/.github/workflows/build_and_release.yml index ff9cd40e..a13afd0e 100644 --- a/.github/workflows/build_and_release.yml +++ b/.github/workflows/build_and_release.yml @@ -8,14 +8,14 @@ permissions: jobs: # Create a Debug build and test it. build_and_test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-23.10 steps: - uses: actions/checkout@v3 with: submodules: recursive - uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.11" # Don't need to install Python / Create venv, as you are running in a container. # You don't even need to install g++/cmake as it comes with the docker image. @@ -63,8 +63,8 @@ jobs: strategy: matrix: - python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12" ] - runs-on: ubuntu-20.04 + python-version: [ "3.9", "3.10", "3.11", "3.12" ] + runs-on: ubuntu-23.10 steps: - uses: actions/checkout@v3 with: @@ -105,7 +105,7 @@ jobs: # Developer can still build on their machine with the source bundle # (i.e. the original `pip install` flow if the platform is not included by above steps) build_sdist: - runs-on: ubuntu-20.04 + runs-on: ubuntu-23.10 if: ${{ success() }} needs: @@ -117,7 +117,7 @@ jobs: submodules: recursive - uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.11" - name: Install Dependencies run: | sudo apt update -y From 4bcce70a5bf6115d1fbf6cc18fea8579cbe72ba1 Mon Sep 17 00:00:00 2001 From: Nic30 Date: Sun, 14 Jan 2024 11:44:50 +0100 Subject: [PATCH 5/5] Revert "ci: githubactions update to ubuntu 23.10" This reverts commit 15d8224a4cb83089e2c9d2cf63963e85c5785fe4. --- .github/workflows/build_and_release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_and_release.yml b/.github/workflows/build_and_release.yml index a13afd0e..ff9cd40e 100644 --- a/.github/workflows/build_and_release.yml +++ b/.github/workflows/build_and_release.yml @@ -8,14 +8,14 @@ permissions: jobs: # Create a Debug build and test it. build_and_test: - runs-on: ubuntu-23.10 + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 with: submodules: recursive - uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.10" # Don't need to install Python / Create venv, as you are running in a container. # You don't even need to install g++/cmake as it comes with the docker image. @@ -63,8 +63,8 @@ jobs: strategy: matrix: - python-version: [ "3.9", "3.10", "3.11", "3.12" ] - runs-on: ubuntu-23.10 + python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12" ] + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 with: @@ -105,7 +105,7 @@ jobs: # Developer can still build on their machine with the source bundle # (i.e. the original `pip install` flow if the platform is not included by above steps) build_sdist: - runs-on: ubuntu-23.10 + runs-on: ubuntu-20.04 if: ${{ success() }} needs: @@ -117,7 +117,7 @@ jobs: submodules: recursive - uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.9" - name: Install Dependencies run: | sudo apt update -y