Skip to content

Commit

Permalink
Merge pull request #55 from VCTLabs/src-release
Browse files Browse the repository at this point in the history
bug fixes and src release
  • Loading branch information
SJLC committed Oct 2, 2023
2 parents ada371e + 40563a1 commit 50cfbdb
Show file tree
Hide file tree
Showing 13 changed files with 211 additions and 35 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/auto-assign-pr.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python
if: matrix.language == 'python'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ jobs:
RIPC_SERVER_PATH: "${{ env.TEMP_DIR }}/socket"
run: |
make cov
gcovr --config gcovr.cfg -s -b src/.libs/ test/
gcovr --gcov-ignore-parse-errors --config gcovr.cfg -s -b src/.libs/ test/
- name: Test (ctest)
if: matrix.os == 'ubuntu-22.04'
env:
RIPC_SERVER_PATH: "${{ env.TEMP_DIR }}/socket"
run: |
ctest --build-target cov --test-dir build/
gcovr --config gcovr.cfg -r . -s -b build/
gcovr --gcov-ignore-parse-errors --config gcovr.cfg -r . -s -b build/
- name: Cleanup
env:
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,25 @@ jobs:
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install tox
- name: Build dist pkg
run: |
tox -e dist
# download all artifacts to project dir
- uses: actions/download-artifact@v3

- name: Generate changes file
uses: sarnold/gitchangelog-action@v1
uses: sarnold/gitchangelog-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN}}

Expand All @@ -93,3 +107,4 @@ jobs:
prerelease: false
files: |
packages/*.deb
redis-ipc*.tar.gz
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,21 @@ Release/*
build/
# Conda
environment.yml
# repolite
ext/
# virtual env
.env
.tox
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# coverage files
test/*.out
*.gcov
# compilation files
*.lo
*.od
Expand Down
44 changes: 44 additions & 0 deletions .repolite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
prog_name: repolite
top_dir: ext # local directory path for enabled repositories
pull_with_rebase: false # use --ff-only if false
# add new repo_name sections as needed
repos:
- repo_name: hiredis
repo_alias: null
repo_url: https://github.com/redis/hiredis.git
repo_depth: 0
repo_remote: origin
repo_opts: []
repo_branch: v0.14.1
repo_hash: null
repo_use_rebase: false
repo_has_lfs_files: false
repo_init_submodules: false
repo_install: false
repo_enable: true
- repo_name: json-c
repo_alias: json
repo_url: https://github.com/json-c/json-c.git
repo_depth: 0
repo_remote: origin
repo_opts: []
repo_branch: json-c-0.16-20220414
repo_hash: null
repo_use_rebase: false
repo_has_lfs_files: false
repo_init_submodules: false
repo_install: false
repo_enable: true
- repo_name: redis
repo_alias: null
repo_url: https://github.com/redis/redis.git
repo_depth: 0
repo_remote: origin
repo_opts: []
repo_branch: 6.0.16
repo_hash: null
repo_use_rebase: false
repo_has_lfs_files: false
repo_init_submodules: false
repo_install: false
repo_enable: true
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.10...3.15)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

# used for both library and pkgconfig file
set(PACKAGE_VERSION 0.0.6)
set(PACKAGE_VERSION 0.2.1)
set(LIBRARY_SOVERSION 0)

if(POLICY CMP0048)
Expand Down
2 changes: 1 addition & 1 deletion conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set name = "redis-ipc" %}
{% set version = "0.0.3" %}
{% set version = "0.2.1" %}

package:
name: {{ name|lower }}
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.68])
AC_INIT([redis-ipc], [0.0.6], [sjl@vctlabs.com])
AC_INIT([redis-ipc], [0.2.1], [sjl@vctlabs.com])
AC_CONFIG_SRCDIR([src/redis_ipc.c])
AC_CONFIG_MACRO_DIR([m4])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Expand Down
3 changes: 3 additions & 0 deletions requirements-sync.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# tool requirements, useful for tox/pip/git
#gitchangelog @ https://github.com/sarnold/gitchangelog/releases/download/3.1.2/gitchangelog-3.1.2-py3-none-any.whl
repolite @ https://github.com/sarnold/repolite/releases/download/0.4.0/repolite-0.4.0-py3-none-any.whl
33 changes: 33 additions & 0 deletions tox-deps.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[tox]
skip_missing_interpreters = true
skipsdist = true

[testenv:{sync,tools,build}]
skip_install = true
install_command = pip install {opts} {packages}
envdir = {toxworkdir}/.env

passenv =
REPO_CFG
DISPLAY
XAUTHORITY
HOME
USERNAME
USER
CI
LANG
LC_COLLATE
SSH_*
GID
UID
XDG_*
PIP_DOWNLOAD_CACHE

deps =
pip>=21.3
cmake
ninja
-r requirements-sync.txt

commands =
sync: repolite {posargs:--quiet}
32 changes: 19 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ skip_missing_interpreters = true
skipsdist = true

[testenv]
envdir = {toxinidir}/.env
# uncomment next line to force older system python for local testing
#basepython = python3.8
install_command = pip install {opts} {packages}
skip_install = true
envdir = {toxinidir}/.env
runner = ignore_env_name_mismatch

passenv =
pythonLocation
Expand All @@ -16,7 +20,9 @@ passenv =
PIP_DOWNLOAD_CACHE

setenv =
clang: ENV_LLVM_VER = {env:ENV_LLVM_VER:12}
clang: CC = {env:CC:clang}
clang: CXX = {env:CXX:clang++}
clang: ENV_LLVM_VER = {env:ENV_LLVM_VER:15}
{auto,bionic}: ENV_RIPC_RUNTIME_DIR = {env:ENV_RIPC_RUNTIME_DIR:{envtmpdir}}

allowlist_externals =
Expand All @@ -27,15 +33,15 @@ changedir =
{tests,bionic,clang,grind}: build

deps =
{auto,dist,tests,clang,ctest,bionic,grind,lint,cover}: pip>=19.0.1
{tests,clang,ctest,bionic,grind}: cmake
{tests,clang,ctest,bionic,grind}: ninja
{auto,tests,ctest,bionic,cover}: gcovr
lcov: lcov_cobertura
{auto,dist}: this-cli
pip>=21.0.1
gcovr
{tests,bionic,clang,ctest,grind,lcov}: lcov_cobertura
{tests,bionic,clang,ctest,grind,lcov}: cmake
{tests,bionic,clang,ctest,grind,lcov}: ninja
{tests,bionic,clang,ctest,grind,lcov}: ValgrindCI
{auto,dist,cover}: this-cli
lint: cpplint
lint: beautysh
grind: ValgrindCI

commands_pre =
bionic: mkdir -p {toxinidir}/coverage
Expand Down Expand Up @@ -64,14 +70,14 @@ commands =
clang: bash -c 'cmake --build . --target coverage'
lcov: lcov_cobertura build/coverage/lcov.info --base-dir {toxinidir} --output coverage.xml
lint: bash -c 'cpplint --output=gsed {toxinidir}/src/* {toxinidir}/inc/*'
auto: gcovr -s -b src/.libs/ test/
auto: gcovr --gcov-ignore-parse-errors=negative_hits.warn -s -b src/.libs/ test/
auto: gcovr --xml-pretty -o coverage.xml src/.libs/ test/
{bionic,tests}: gcovr -s -b -r {toxinidir} .
{bionic,tests}: gcovr --gcov-ignore-parse-errors=negative_hits.warn -s -b -r {toxinidir} .
bionic: gcovr -r {toxinidir} --xml-pretty -o coverage.xml .
bionic: gcovr -r {toxinidir} --html --html-details -o {toxinidir}/coverage/coverage.html .
{auto,bionic}: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh stop'
ctest: bash -c 'ctest --build-generator {posargs:"Unix Makefiles"} --build-and-test . build --build-options -DWITH_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug --test-command ctest --rerun-failed --output-on-failure -V'
ctest: gcovr -s -b build/
ctest: gcovr --gcov-ignore-parse-errors=negative_hits.warn -s -b build/
cover: gcovr --xml-pretty -o coverage.xml build/
# runtime assertion error without || true => (SIGSEGV)) (exited with code -11)
grind: bash -c 'valgrind --tool=memcheck --xml=yes --xml-file=json_check.xml --leak-check=full --show-leak-kinds=definite,possible --error-exitcode=127 ./json_test || true'
Expand All @@ -85,7 +91,7 @@ commands =
# xml exception (no errors in report) => junk after document element
#grind: bash -c '[[ -f command_check.xml ]] && valgrind-ci command_check.xml --number-of-errors || true'
#grind: bash -c '[[ -f command_check.xml ]] && valgrind-ci command_check.xml --summary || true'
clean: bash -c 'rm -rf build/ coverage/ coverage.xml'
clean: bash -c 'rm -rf build/ coverage/ coverage.xml *.gcov'
autoclean: bash -c 'make distclean-recursive'
autoclean: bash -c 'rm -rf Makefile Makefile.in aclocal.m4 ar-lib autom4te.cache/ compile config.* coverage* configure configure~ depcomp install-sh libltdl/ ltmain.sh m4/ missing src/Makefile.in test-driver test/gmon.out test/Makefile.in'

Expand Down
77 changes: 77 additions & 0 deletions toxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
"""
https://github.com/masenf/tox-ignore-env-name-mismatch
MIT License
Copyright (c) 2023 Masen Furer
"""
from contextlib import contextmanager
from typing import Any, Iterator, Optional, Sequence, Tuple

from tox.plugin import impl
from tox.tox_env.api import ToxEnv
from tox.tox_env.info import Info
from tox.tox_env.python.virtual_env.runner import VirtualEnvRunner
from tox.tox_env.register import ToxEnvRegister


class FilteredInfo(Info):
"""Subclass of Info that optionally filters specific keys during compare()."""

def __init__(
self,
*args: Any,
filter_keys: Optional[Sequence[str]] = None,
filter_section: Optional[str] = None,
**kwargs: Any,
):
"""
:param filter_keys: key names to pop from value
:param filter_section: if specified, only pop filter_keys when the compared section matches
All other args and kwargs are passed to super().__init__
"""
self.filter_keys = filter_keys
self.filter_section = filter_section
super().__init__(*args, **kwargs)

@contextmanager
def compare(
self,
value: Any,
section: str,
sub_section: Optional[str] = None,
) -> Iterator[Tuple[bool, Optional[Any]]]:
"""Perform comparison and update cached info after filtering `value`."""
if self.filter_section is None or section == self.filter_section:
try:
value = value.copy()
except AttributeError: # pragma: no cover
pass
else:
for fkey in self.filter_keys or []:
value.pop(fkey, None)
with super().compare(value, section, sub_section) as rv:
yield rv


class IgnoreEnvNameMismatchVirtualEnvRunner(VirtualEnvRunner):
"""EnvRunner that does NOT save the env name as part of the cached info."""

@staticmethod
def id() -> str:
return "ignore_env_name_mismatch"

@property
def cache(self) -> Info:
"""Return a modified Info class that does NOT pass "name" key to `Info.compare`."""
return FilteredInfo(
self.env_dir,
filter_keys=["name"],
filter_section=ToxEnv.__name__,
)


@impl
def tox_register_tox_env(register: ToxEnvRegister) -> None:
"""tox4 entry point: add IgnoreEnvNameMismatchVirtualEnvRunner to registry."""
register.add_run_env(IgnoreEnvNameMismatchVirtualEnvRunner)

0 comments on commit 50cfbdb

Please sign in to comment.