Skip to content

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksey.kozlov committed Sep 3, 2024
2 parents f449a64 + c74827b commit 0b998ea
Show file tree
Hide file tree
Showing 246 changed files with 9,057 additions and 7,043 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ lib/jaybird-full\.jar

lib/jaybird-cryptoapi\.jar

lib/fbclient-3\.jar

lib/fbclient-4\.jar

lib/fbclient-5\.jar
Expand Down
61 changes: 54 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ stages:
- test
- repackage
- deploy
- report

variables:
RELEASE_HUB_PROJECT: red_expert
Expand Down Expand Up @@ -56,8 +57,10 @@ prepare:
CONTEXT=commit
STAGE=snapshot
fi
- BUILD=$(awk -F'=' '/^eq.build=/ {print $2}' ./src/org/executequery/eq.system.properties)
- m4 -DVERSION=${VERSION} ci/artifacts.m4 > .ci/artifacts
- echo VERSION=${VERSION} > vars.env
- echo BUILD=${BUILD} >> vars.env
- echo BRANCH=${BRANCH} >> vars.env
- echo CONTEXT=${CONTEXT} >> vars.env
- echo STAGE=${STAGE} >> vars.env
Expand Down Expand Up @@ -85,8 +88,6 @@ sources:
paths:
- dist-src/



build_docs:
stage: build_docs
artifacts:
Expand All @@ -97,13 +98,15 @@ build_docs:
- docker
- builder
- x86_64
image: registry.red-soft.biz:5000/docker-images/texlive-alpine/texlive2018-alpine:20190305
image: registry.red-soft.biz:5000/docker-images/3rdparty/texlive:TL2022-2023-03-12-full
before_script:
- tar xf dist-src/RedExpert-$VERSION-src.tar.gz
- apt update && apt install -y python3-venv python3-pip
- mkdir -p dist/guide
script:
- cd RedExpert-$VERSION && ./ci/build_docs.sh && cd ..
- mv RedExpert-$VERSION/dist .

- cd guide_rst
- make bootstrap
- make latexpdf
- cp build/latex/Red_Expert.pdf ../dist/guide/RedExpert_Guide-ru.pdf

.build_template:
stage: build
Expand Down Expand Up @@ -150,6 +153,7 @@ build:linux:
- mv modules/redexpert/target/lib "${DIST}"
- cp -r license/ "${DIST}"
- cp -r "${CI_PROJECT_DIR}"/dist/guide/ "${DIST}"
- mv modules/redexpert/target/classes "${DIST}"
- mv modules/redexpert/target/LICENSE.txt "${DIST}"
- mv modules/redexpert/target/red_expert.ico "${DIST}"
- mv modules/redexpert/target/red_expert.png "${DIST}"
Expand Down Expand Up @@ -210,6 +214,7 @@ build:windows:
expire_in: 1 day
paths:
- test-results/
- coverage-results/
except:
variables:
- $SKIP_TESTS == "1"
Expand All @@ -221,6 +226,7 @@ test:windows:
- proxmox
- tester
variables:
BUILD: ${BUILD}
PROXMOX_TEMPLATE: template-testing-re-windows-7
JAVA_HOME: c:\Program Files\Java\jdk8
ErrorActionPreference: STOP
Expand Down Expand Up @@ -259,6 +265,7 @@ test:windows-robot:
- proxmox
- tester
variables:
BUILD: ${BUILD}
PROXMOX_TEMPLATE: template-testing-re-windows-7
ErrorActionPreference: STOP
DIST: ${CI_PROJECT_DIR}\dist\windows-${ARCH}
Expand Down Expand Up @@ -297,6 +304,7 @@ test:linux-robot:
- red_expert
- tester
variables:
BUILD: ${BUILD}
PROXMOX_TEMPLATE: template-testing-re-ubuntu-20
ErrorActionPreference: STOP
DIST: ${CI_PROJECT_DIR}/dist/linux-${ARCH}
Expand All @@ -315,6 +323,10 @@ test:linux-robot:
- $PYTHON ./ci/download_dbms.py ${DBMS} ${ARCH} linux
- chmod +x ./ci/install_dbms.sh
- ./ci/install_dbms.sh
- |
if [ $ARCH == "x86_64" ] && [ $DBMS == "rdb50" ]; then
export COVERAGE=true
fi
script:
- chmod +x ./ci/test_robot.sh
- ./ci/test_robot.sh
Expand Down Expand Up @@ -366,3 +378,38 @@ deploy:
only:
variables:
- "$RELEASE_HUB_KEY"

report:coverage:
stage: report
tags: ["docker", "x86_64"]
image: registry.red-soft.biz:5000/docker-images/rdbbuildenv:rdb5-8
before_script:
- test -e ${CI_PROJECT_DIR}/coverage-results || (echo No coverage data found; exit 0)
script:
- echo "Uploading report"
- mc alias set minio ${MINIO_SERVER} ${MINIO_USER} ${MINIO_PASSWORD}
- |
if [ "${CI_COMMIT_TAG}" ]; then
REPORT_NAME=${VERSION}
elif [ "${CI_COMMIT_REF_NAME}" = "$TAG_BRANCH" ]; then
REPORT_NAME=${TAG_BRANCH}
echo "Generating badge"
PCOV=$(grep -oP '<tfoot.*?>.*?</tfoot>' coverage-results/index.html | grep -oP '<td class="ctr2">\K[^<]+' | head -n 1 | tr -d '%')
anybadge -l "coverage ${TAG_BRANCH}" -v "$PCOV" --suffix='%' -o -f coverage-results/badge.svg 70=red 80=orange 90=yellow 100=green
fi
- |
if [ "${REPORT_NAME}" ]; then
mc rm -r --force minio/reports/coverage/red-expert/${REPORT_NAME}
mc cp -r coverage-results/ minio/reports/coverage/red-expert/${REPORT_NAME}
echo Report ${MINIO_SERVER}reports/coverage/red-expert/${REPORT_NAME}/index.html
else
mc cp -r coverage-results/ minio/reports/temp/coverage/red-expert/${VERSION}
echo Report ${MINIO_SERVER}reports/temp/coverage/red-expert/${VERSION}/index.html
fi
# coverage: /^\s*lines:\s*\d+.\d+\%/
only:
variables:
- $CI_COMMIT_TAG
- $CONTEXT == "weekly"
- $FORCE_COVERAGE == "1"
allow_failure: true
9 changes: 9 additions & 0 deletions ci/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ $DISTRO=$env:DISTRO
if (-Not (Test-Path env:\DBMS)) { die("DBMS not defined") }
$DBMS=$env:DBMS

if (-Not (Test-Path env:\BUILD)) { die("BUILD not defined") }
$BUILD=$env:BUILD

echo "Downloading tests"
git clone -q http://git.red-soft.biz/red-database/re-tests.git -b new_ui
git clone -q http://git.red-soft.biz/red-database/python/lackey.git
Expand All @@ -31,6 +34,12 @@ start-process "${PYTHON}" "-m pip install git+http://git.red-soft.biz/red-databa
start-process "${PYTHON}" "-m pip install -e .\lackey" -wait -nonewwindow
start-process "${PYTHON}" "-m pip install -e .\re-tests" -wait -nonewwindow

echo "Set .xml"
$BUILD_PATH="$env:USERPROFILE\.redexpert\${BUILD}"
mkdir "${BUILD_PATH}"
copy ".\re-tests\files\xml\savedconnections.xml" "${BUILD_PATH}"
copy ".\re-tests\files\xml\eq.user.properties" "${BUILD_PATH}"

echo "Start testing"
cd re-tests
start-process "${PYTHON}" "-m pytest -vv --junitxml .\results.xml .\tests" -wait -nonewwindow
Expand Down
8 changes: 8 additions & 0 deletions ci/test_robot.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,21 @@ $DISTRO=$env:DISTRO
if (-Not (Test-Path env:\DBMS)) { die("DBMS not defined") }
$DBMS=$env:DBMS

if (-Not (Test-Path env:\BUILD)) { die("BUILD not defined") }
$BUILD=$env:BUILD

echo "Downloading tests"
git clone -q http://git.red-soft.biz/red-database/re-tests-robot

echo "Installing components"
start-process "${PYTHON}" "-m pip install git+http://git.red-soft.biz/red-database/python/red-database-python-driver.git" -wait -nonewwindow
start-process "${PYTHON}" "-m pip install robotframework" -wait -nonewwindow

echo "Set .xml"
$BUILD_PATH="$env:USERPROFILE\.redexpert\${BUILD}"
mkdir "${BUILD_PATH}"
copy ".\re-tests-robot\files\xml\savedconnections.xml" "${BUILD_PATH}"

echo "Start testing"
cd re-tests-robot
start-process "${PYTHON}" "-m robot -x results.xml .\tests" -wait -nonewwindow
Expand Down
14 changes: 14 additions & 0 deletions ci/test_robot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ check_variable WORKSPACE
check_variable DISTRO
check_variable PYTHON
check_variable DBMS
check_variable BUILD

echo "Downloading tests"
git clone -q http://git.red-soft.biz/red-database/re-tests-robot
Expand All @@ -28,14 +29,27 @@ echo "Installing components"
$PYTHON -m pip install git+http://git.red-soft.biz/red-database/python/red-database-python-driver.git
$PYTHON -m pip install robotframework

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/RedDatabase/lib

export PYTHONPATH=$PYTHONPATH:/root/remoteswinglibrary-2.3.3.jar
export DISPLAY=:0
su reduser -c 'xhost +'

echo "Set .xml"
BUILD_PATH="/root/.redexpert/${BUILD}"
mkdir "${BUILD_PATH}"
cp "./re-tests-robot/files/xml/savedconnections.xml" "${BUILD_PATH}"

echo "Start testing"
cd re-tests-robot
$PYTHON -m robot -x results.xml --nostatusrc ./tests

if [ $COVERAGE == true ]; then
echo "Start generate coverage results"
mkdir "${WORKSPACE}/coverage-results/"
java -jar ./lib/jacococli.jar report ./results/jacoco.exec --classfiles "${DIST}/classes" --sourcefiles ../src --html "${WORKSPACE}/coverage-results/"
fi

echo "Copy test results"
mkdir "${WORKSPACE}/test-results/"
cp results.xml "${WORKSPACE}/test-results/${DISTRO}-${DBMS}-${ARCH}.xml"
Expand Down
38 changes: 38 additions & 0 deletions guide_rst/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= $(VENV)/bin/sphinx-build
SOURCEDIR = source
BUILDDIR = build

PYTHON ?= python3
ROOT := $(shell pwd)
VENV ?= $(ROOT)/.venv
PIP ?= $(VENV)/bin/pip

.DEFAULT_GOAL := all


# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile clean distclean bootstrap

clean:
- rm -rf $(BUILDDIR)

distclean: clean
- rm -r $(VENV)

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

bootstrap:
$(PYTHON) -m venv .venv
$(PIP) install -r requirements.txt
35 changes: 35 additions & 0 deletions guide_rst/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
2 changes: 2 additions & 0 deletions guide_rst/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Sphinx==7.2.6
sphinx_design
42 changes: 42 additions & 0 deletions guide_rst/source/_ext/HideShowIfCertDirective.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from __future__ import annotations

__docformat__ = 'reStructuredText'

import os.path

from docutils import statemachine
from docutils.parsers.rst import Directive, states

import globalvar

class BaseInclude(Directive):
has_content = True
required_arguments = 0
optional_arguments = 0
final_argument_whitespace = True
option_spec = {}

def run(self):
tab_width = self.state.document.settings.tab_width
rawtext = '\n'.join(self.content)
include_lines = statemachine.string2lines(rawtext, tab_width, convert_whitespace=1)
self.state_machine.insert_input(include_lines, '')
return []

class HideIfCert(BaseInclude):
def run(self):
if not globalvar.IsCertifiedVersion:
return super().run()
else:
return []

class ShowIfCert(BaseInclude):
def run(self):
if globalvar.IsCertifiedVersion:
return super().run()
else:
return []

def setup(app):
app.add_directive('hideifcert', HideIfCert)
app.add_directive('showifcert', ShowIfCert)
44 changes: 44 additions & 0 deletions guide_rst/source/_ext/HideShowIfCertRole.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from docutils import nodes
from docutils.parsers.rst.states import Struct
import globalvar

def Hide_ifcert_role(role, rawtext, text, lineno, inliner, options={}, content=[]):
# Prepare context for nested parsing
memo = Struct(document=inliner.document,
reporter=inliner.reporter,
language=inliner.language)
parent = nodes.inline(rawtext, '', **options)

if not globalvar.IsCertifiedVersion:
# Parse role text for markup and add to parent
processed, messages = inliner.parse(text, lineno, memo, parent)
parent += processed
else:
parent = nodes.Text('')
messages = []

return [parent], messages

def Show_ifcert_role(role, rawtext, text, lineno, inliner, options={}, content=[]):
# Prepare context for nested parsing
memo = Struct(document=inliner.document,
reporter=inliner.reporter,
language=inliner.language)
parent = nodes.inline(rawtext, '', **options)

if globalvar.IsCertifiedVersion:
# Parse role text for markup and add to parent
processed, messages = inliner.parse(text, lineno, memo, parent)
parent += processed
else:
parent = nodes.Text('')
messages = []

return [parent], messages


def setup(app):
app.add_role('hideifcert', Hide_ifcert_role)
app.add_role('showifcert', Show_ifcert_role)


Loading

0 comments on commit 0b998ea

Please sign in to comment.