Skip to content

Commit

Permalink
Merge branch 'develop' into alinaliBQ/AD-522/config_window
Browse files Browse the repository at this point in the history
  • Loading branch information
alinaliBQ committed Jan 26, 2022
2 parents 0aa2052 + 7d42d92 commit 8d609da
Show file tree
Hide file tree
Showing 64 changed files with 11,498 additions and 475 deletions.
1 change: 0 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ jobs:
- uses: ZedThree/[email protected]
id: review
continue-on-error: true

26 changes: 23 additions & 3 deletions .github/workflows/mac-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,19 @@ on:

env:
CI_OUTPUT_PATH: "ci-output"
ODBC_LIB_PATH: "./build/odbc/lib"
ODBC_BIN_PATH: "./build/odbc/bin"
ODBC_BUILD_PATH: "./build/odbc/build"
ODBC_LIB_PATH: "${{github.workspace}}/build/odbc/lib"
ODBC_BIN_PATH: "${{github.workspace}}/build/odbc/bin"
ODBC_BUILD_PATH: "${{github.workspace}}/build/odbc/build"
DOCUMENTDB_HOME: "${{github.workspace}}/build/odbc/bin"
DOC_DB_KEYPAIR: ${{secrets.DOC_DB_KEYPAIR}}
DOC_DB_USER_NAME: ${{secrets.DOC_DB_USER_NAME}}
DOC_DB_PASSWORD: ${{secrets.DOC_DB_PASSWORD}}
DOC_DB_USER: ${{secrets.DOC_DB_USER}}
DOC_DB_HOST: ${{secrets.DOC_DB_HOST}}
DOC_DB_LOCAL_PORT: 27019
DOC_DB_REMOTE_PORT: 27017
DOC_DB_PRIV_KEY_FILE: ~/certs/docdb-sshtunnel.pem
JDBC_DRIVER_VERSION: "1.1.0"

jobs:
build-mac:
Expand All @@ -37,6 +47,12 @@ jobs:
# with:
# name: cppcheck-results
# path: cppcheck-results.log
- name: Extract key-pair into file
run: |
mkdir ~/certs
echo "${{env.DOC_DB_KEYPAIR}}" > ${{env.DOC_DB_PRIV_KEY_FILE}}
chmod 400 ${{env.DOC_DB_PRIV_KEY_FILE}}
- name: get-dependencies
run: |
brew install unixodbc
Expand All @@ -54,6 +70,10 @@ jobs:
# sudo cp ./src/Tests/Tests/odbc-mac.ini /Library/ODBC/odbc.ini
# sudo cp ./src/Tests/Tests/odbcinst-mac.ini /Library/ODBC/odbcinst.ini
# mkdir ${{ github.workspace }}/odbc-logs
- name: register-odbc-driver
run: |
chmod +x scripts/register_driver_macos.sh
./scripts/register_driver_macos.sh
- name: run-tests
run: |
./build/odbc/bin/ignite-odbc-tests
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/mac-debug-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ env:
ODBC_LIB_PATH: "./build/odbc/lib"
ODBC_BIN_PATH: "./build/odbc/bin"
ODBC_BUILD_PATH: "./build/odbc/build"
DOCUMENTDB_HOME: "./build/odbc/bin"

jobs:
build-mac:
Expand Down
79 changes: 64 additions & 15 deletions .github/workflows/win-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,45 +16,75 @@ env:
ODBC_BIN_PATH: "./build/odbc/bin/Release"
ODBC_BUILD_PATH: "./build/odbc/cmake"
VCPKG_ROOT: "c:/vcpkg"
DOCUMENTDB_HOME: "./build/odbc/bin/Release"
DOC_DB_KEYPAIR: ${{secrets.DOC_DB_KEYPAIR}}
DOC_DB_USER_NAME: ${{secrets.DOC_DB_USER_NAME}}
DOC_DB_PASSWORD: ${{secrets.DOC_DB_PASSWORD}}
DOC_DB_USER: ${{secrets.DOC_DB_USER}}
DOC_DB_HOST: ${{secrets.DOC_DB_HOST}}
RUN_REMOTE_INTEGRATION_TESTS: ${{ github.event.inputs.testWithoutDocumnetDb && 'false' || 'true' }}
DOC_DB_LOCAL_PORT: 27019
DOC_DB_REMOTE_PORT: 27017
DOC_DB_PRIV_KEY_FILE: ~/certs/docdb-sshtunnel.pem
JDBC_DRIVER_VERSION: "1.1.0"

jobs:
build-windows32:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2

- name: Get Java distribution
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
architecture: x86

- name: "Update path for Java"
run: |
echo "${{ env.JAVA_HOME }}\bin\server" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: "Update path for WIX Toolset"
run: |
echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Get specific version CMake, v3.20.1
uses: lukka/[email protected]

- name: add-msbuild-to-path
uses: microsoft/[email protected]

- name: Extract key-pair into file
run: |
mkdir -p ~/certs
echo "${{env.DOC_DB_KEYPAIR}}" > ~/certs/docdb-sshtunnel.pem
chmod 400 ~/certs/docdb-sshtunnel.pem
mkdir -p ~/.ssh
copy ./src/odbc-test/config/ssh_config ~/.ssh/config
#- name: Run SSH tunnel to DocumentDB server
# run: |
# ssh.exe -f -N -i ~/certs/docdb-sshtunnel.pem -L ${{env.DOC_DB_LOCAL_PORT}}:${{secrets.DOC_DB_HOST}}:${{env.DOC_DB_REMOTE_PORT}} ${{secrets.DOC_DB_USER}}

- name: Install dependencies Windows
run: vcpkg integrate install; vcpkg install openssl:x86-windows boost-test:x86-windows boost-asio:x86-windows boost-chrono:x86-windows boost-interprocess:x86-windows boost-regex:x86-windows boost-system:x86-windows boost-thread:x86-windows
env:
VCPKG_ROOT: ${{ env.VCPKG_ROOT }}

- name: configure-and-build-driver
run: |
.\build_win_release32.ps1
env:
OPENSSL_ROOT_DIR: '${{ env.VCPKG_ROOT }}/packages/openssl_x86-windows'
# - name: import-registry
# run: |
# reg import .\src\Tests\Tests\AWSProfileRegistry_Win32.reg
# reg import .\src\Tests\Tests\IAMRegistry_Win32.reg
# mkdir ${{ github.workspace }}\odbc-logs

- name: register-driver
run: |
.\src\odbc\install\install_amd64.cmd ${{env.ODBC_BIN_PATH}}\ignite.odbc.dll ${{env.ODBC_BIN_PATH}}\ignite.odbc.dll
- name: run-tests
run: |
${{ env.ODBC_BIN_PATH }}/ignite-odbc-tests.exe
${{env.ODBC_BIN_PATH}}/ignite-odbc-tests.exe
# - name: upload-test-report
# if: failure()
# uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -91,39 +121,58 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2

- name: Get Java distribution
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
architecture: x64

- name: "Update path for Java"
run: |
echo "${{ env.JAVA_HOME }}\bin\server" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "${{env.JAVA_HOME}}\bin\server" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: "Update path for WIX Toolset"
run: |
echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Get specific version CMake, v3.20.1
uses: lukka/[email protected]

- name: add-msbuild-to-path
uses: microsoft/[email protected]

- name: Extract key-pair into file
run: |
mkdir -p ~/certs
echo "${{env.DOC_DB_KEYPAIR}}" > ~/certs/docdb-sshtunnel.pem
chmod 400 ~/certs/docdb-sshtunnel.pem
mkdir -p ~/.ssh
copy ./src/odbc-test/config/ssh_config ~/.ssh/config
#- name: Run SSH tunnel to DocumentDB server
# run: |
# ssh.exe -f -N -i ~/certs/docdb-sshtunnel.pem -L ${{env.DOC_DB_LOCAL_PORT}}:${{secrets.DOC_DB_HOST}}:${{env.DOC_DB_REMOTE_PORT}} ${{secrets.DOC_DB_USER}}

- name: Install dependencies Windows
run: vcpkg integrate install; vcpkg install openssl:x64-windows boost-test:x64-windows boost-asio:x64-windows boost-chrono:x64-windows boost-interprocess:x64-windows boost-regex:x64-windows boost-system:x64-windows boost-thread:x64-windows
env:
VCPKG_ROOT: ${{ env.VCPKG_ROOT }}
VCPKG_ROOT: ${{env.VCPKG_ROOT}}

- name: configure-and-build-driver
run: |
.\build_win_release64.ps1
env:
OPENSSL_ROOT_DIR: '${{ env.VCPKG_ROOT }}/packages/openssl_x64-windows'
# - name: import-registry
# run: |
# reg import .\src\Tests\Tests\AWSProfileRegistry.reg
# reg import .\src\Tests\Tests\IAMRegistry.reg
# mkdir ${{ github.workspace }}\odbc-logs
OPENSSL_ROOT_DIR: '${{env.VCPKG_ROOT}}/packages/openssl_x64-windows'

- name: register-driver
run: |
.\src\odbc\install\install_amd64.cmd ${{env.ODBC_BIN_PATH}}\ignite.odbc.dll
- name: run-tests
run: |
${{ env.ODBC_BIN_PATH }}/ignite-odbc-tests.exe
${{env.ODBC_BIN_PATH}}/ignite-odbc-tests.exe
# - name: upload-test-report
# if: failure()
# uses: actions/upload-artifact@v2
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@
1. E.g.: `.\build_win_debug64.ps1`
2. Navigate to the `build\odbc\cmake` folder to use the generated solution file, `Ignite.C++.sln` to work on
source code development and testing.
7. More details in `src\DEVNOTES.txt`.
7. Set the environment variable `DOCUMENTDB_HOME`. On a developer's machine, set it to `<repo-folder>\build\odbc\bin\Debug`. The
build script run above, downloads it to the `<repo-folder>\build\odbc\bin\Debug\libs` folder.
8. Open a **64-bit** command shell or **64-bit** PowerShell window, **as Administrator**, run the
```
<repo-folder>\src\odbc\src\install\install_amd64.cmd <repo-folder>\buildbuild\odbc\cmake\Debug\ignite.odbc.dll
```
8. More details in [`src\DEVNOTES.txt`](src/DEVNOTES.txt).

### MacOS

Expand All @@ -44,7 +50,7 @@
2. Run one of the build scripts to create an initial compilation.
1. E.g.: `./build_mac_release64.sh`
2. Navigate to the `build/odbc/lib` folder to use the generated files.
3. More details in `src\DEVNOTES.txt`.
3. More details in [`src\DEVNOTES.txt`](src/DEVNOTES.txt).

### Linux

Expand Down
21 changes: 21 additions & 0 deletions build_mac_debug64.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@

BUILD_DIR=cmake-build64
BUILD_TYPE=Debug
PROJECT_DIR=$(pwd)
DRIVER_BIN_DIR="$PROJECT_DIR/build/odbc/bin"

mkdir cmake-build64
cd cmake-build64
cmake ../src -DCMAKE_BUILD_TYPE="Debug" -DCODE_COVERAGE="ON" -DBUILD_SHARED_LIBS="OFF" -DWITH_TESTS="ON" -DWITH_CORE="OFF" -DWITH_ODBC="ON"
cd ..

# Download the DocumentDB JDBC Driver
JDBC_DRIVER_VERSION="${JDBC_DRIVER_VERSION-1.1.0}"
JDBC_DRIVER_FILENAME="documentdb-jdbc-$JDBC_DRIVER_VERSION-all.jar"
JDBC_DRIVER_FULLPATH="$DRIVER_BIN_DIR/libs/$JDBC_DRIVER_FILENAME"
export DOCUMENTDB_HOME="$DRIVER_BIN_DIR"
if [ ! -f "$JDBC_DRIVER_FULLPATH" ]; then
mkdir "$DRIVER_BIN_DIR/libs"
echo "Downloading version $JDBC_DRIVER_VERSION of JDBC driver..."
curl -o "$DRIVER_BIN_DIR/libs/$JDBC_DRIVER_FILENAME" -L https://github.com/aws/amazon-documentdb-jdbc-driver/releases/download/v$JDBC_DRIVER_VERSION/$JDBC_DRIVER_FILENAME
echo "Download complete."
fi

cd cmake-build64
make ccov-all -j 4
cd ..
26 changes: 23 additions & 3 deletions build_mac_release64.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
mkdir cmake-build64
cd cmake-build64
cmake ../src -DCMAKE_BUILD_TYPE="Release" -DCODE_COVERAGE="OFF" -DBUILD_SHARED_LIBS="OFF" -DWITH_TESTS="ON" -DWITH_CORE="OFF" -DWITH_ODBC="ON"

BUILD_DIR=cmake-build64
BUILD_TYPE=Release
PROJECT_DIR=$(pwd)
DRIVER_BIN_DIR="$PROJECT_DIR/build/odbc/bin"

set -e
mkdir $BUILD_DIR
cd $BUILD_DIR
cmake ../src -DCMAKE_BUILD_TYPE="$BUILD_TYPE" -DCODE_COVERAGE="OFF" -DBUILD_SHARED_LIBS="OFF" -DWITH_TESTS="ON" -DWITH_CORE="OFF" -DWITH_ODBC="ON"
make -j 4

# Download the DocumentDB JDBC Driver
JDBC_DRIVER_VERSION="${JDBC_DRIVER_VERSION-1.1.0}"
JDBC_DRIVER_FILENAME="documentdb-jdbc-$JDBC_DRIVER_VERSION-all.jar"
JDBC_DRIVER_FULLPATH="$DRIVER_BIN_DIR/libs/$JDBC_DRIVER_FILENAME"
export DOCUMENTDB_HOME="$DRIVER_BIN_DIR"
if [ ! -f "$JDBC_DRIVER_FULLPATH" ]; then
mkdir "$DRIVER_BIN_DIR/libs"
echo "Downloading version $JDBC_DRIVER_VERSION of JDBC driver..."
curl -o "$DRIVER_BIN_DIR/libs/$JDBC_DRIVER_FILENAME" -L https://github.com/aws/amazon-documentdb-jdbc-driver/releases/download/v$JDBC_DRIVER_VERSION/$JDBC_DRIVER_FILENAME
echo "Download complete."
fi

cd ..
15 changes: 15 additions & 0 deletions scripts/build_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ Set-Location $CURRENT_DIR
$DRIVER_BIN_DIR = "$DRIVER_BUILD_DIR\..\bin\$CONFIGURATION"
New-Item -Path $DRIVER_BIN_DIR -ItemType Directory -Force | Out-Null

# Download the JDBC driver
$JDBC_DRIVER_VERSION = if ($JDBC_DRIVER_VERSION -eq $null) { "1.1.0" } else { $JDBC_DRIVER_VERSION }
$JDBC_DRIVER_FILENAME = "documentdb-jdbc-$JDBC_DRIVER_VERSION-all.jar"
$JDBC_DRIVER_FULLPATH = "$DRIVER_BIN_DIR\libs\$JDBC_DRIVER_FILENAME"
if (-not (Test-Path -Path $JDBC_DRIVER_FULLPATH -PathType Leaf)) {
New-Item -Path "$DRIVER_BIN_DIR\libs" -ItemType Directory -Force | Out-Null
Write-Output "Downloading version $JDBC_DRIVER_VERSION of JDBC driver..."
$progresspreference = 'silentlyContinue'
Invoke-WebRequest `
https://github.com/aws/amazon-documentdb-jdbc-driver/releases/download/v$JDBC_DRIVER_VERSION/$JDBC_DRIVER_FILENAME `
-o $JDBC_DRIVER_FULLPATH
$progressPreference = 'Continue'
Write-Output "Download complete."
}

if (Test-Path -Path $DRIVER_BUILD_DIR\$CONFIGURATION) {
Copy-Item $DRIVER_BUILD_DIR\$CONFIGURATION\* $DRIVER_BIN_DIR
}
27 changes: 27 additions & 0 deletions scripts/register_driver_macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done

SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"

PROJECT_DIR="$SCRIPT_DIR/.."
ODBC_LIB_PATH="$PROJECT_DIR/build/odbc/lib"
ODBC_LIB_FILENAME="$ODBC_LIB_PATH/libignite-odbc.dylib"

if [ ! -f "$ODBC_LIB_FILENAME" ]
then
echo "Cannot find ODBC library file: $ODBC_LIB_FILENAME"
exit 1
fi

echo "[Apache Ignite]" > "$ODBC_LIB_PATH/ignite-odbc-install.ini"
echo "Description=Apache Ignite" >> "$ODBC_LIB_PATH/ignite-odbc-install.ini"
echo "Driver=$ODBC_LIB_FILENAME" >> "$ODBC_LIB_PATH/ignite-odbc-install.ini"
echo "Setup=$ODBC_LIB_FILENAME" >> "$ODBC_LIB_PATH/ignite-odbc-install.ini"
echo "DriverODBCVer=03.00" >> "$ODBC_LIB_PATH/ignite-odbc-install.ini"
echo "FileUsage=0" >> "$ODBC_LIB_PATH/ignite-odbc-install.ini"
odbcinst -i -d -f "$ODBC_LIB_PATH/ignite-odbc-install.ini"
2 changes: 1 addition & 1 deletion src/common/include/ignite/common/big_integer.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ namespace ignite
// Reading number itself.
while (is && isdigit(c))
{
part = part * 10 + (c - '0');
part = part * 10 + (static_cast<unsigned long long>(c) - '0');
++partDigits;

if (part >= 1000000000000000000U)
Expand Down
6 changes: 3 additions & 3 deletions src/common/include/ignite/common/decimal.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ namespace ignite
os << '0';
}

os.write(&magStr[magBegin], lastNonZero - magBegin + 1);
os.write(&magStr[magBegin], static_cast<std::streamsize>(lastNonZero) - magBegin + 1);
}
else
{
Expand All @@ -340,7 +340,7 @@ namespace ignite
{
os << '.';

os.write(&magStr[magBegin + dotPos], afterDot);
os.write(&magStr[static_cast< std::basic_string< char, std::char_traits< char >, std::allocator< char > >::size_type >(magBegin) + dotPos], afterDot);
}
}

Expand Down Expand Up @@ -395,7 +395,7 @@ namespace ignite
{
if (isdigit(c))
{
part = part * 10 + (c - '0');
part = part * 10 + (static_cast<unsigned long long>(c) - '0');
++partDigits;
}
else if (c == '.' && scale < 0)
Expand Down
Loading

0 comments on commit 8d609da

Please sign in to comment.