Skip to content

Commit

Permalink
Merge branch 'master' into mesonbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
Nic30 committed Jan 22, 2024
2 parents 2153b22 + fae60ef commit aefd9e9
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 1 deletion.
169 changes: 169 additions & 0 deletions .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
4 changes: 3 additions & 1 deletion src/verilogPreproc/verilogPreproc.cpp
@@ -1,3 +1,5 @@
#include <any>

#include <hdlConvertor/verilogPreproc/verilogPreproc.h>

// antlr4-runtime/
Expand Down Expand Up @@ -194,7 +196,7 @@ antlrcpp::Any VerilogPreproc::visitDefine(
vector<MacroDefVerilog::param_info_t> 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<vector<MacroDefVerilog::param_info_t> *>();
#else
params = std::any_cast<vector<MacroDefVerilog::param_info_t> *>(visitDefine_args(da));
#endif
Expand Down
1 change: 1 addition & 0 deletions tests/test_icarus_verilog_testsuite.py
Expand Up @@ -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]
Expand Down

0 comments on commit aefd9e9

Please sign in to comment.