Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AD-492] Working JNI GitHub workflow #2

Merged
merged 16 commits into from
Dec 20, 2021
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 93 additions & 81 deletions .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ jobs:
with:
cmake-version: '3.21.4'
- uses: actions/checkout@v2
- name: Get Java distribution
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
architecture: x64
- name: run-cppcheck
run: |
sudo apt install cppcheck
Expand Down Expand Up @@ -98,84 +104,90 @@ jobs:
with:
name: linux64-deb-installer
path: deb-installer
build-linux32:
birschick-bq marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.21.4'
- uses: actions/checkout@v2
- name: run-cppcheck
run: |
sudo apt install cppcheck
sh run_cppcheck.sh
- name: upload-cppcheck-results
if: failure()
uses: actions/upload-artifact@v2
with:
name: cppcheck-results
path: cppcheck-results.log
- name: get-dependencies
if: success()
run: |
# Need to install i386 versions
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install unixodbc:i386 unixodbc-dev:i386 odbcinst1debian2:i386 libodbc1:i386 libcurl4-openssl-dev:i386 libssl-dev:i386 uuid-dev:i386 cpp:i386 cpp-9:i386 gcc:i386 g++:i386 zlib1g-dev:i386 linux-headers-$(uname -r) gcc-multilib:i386 g++-multilib:i386 g++-9:i386 gcc-9:i386 gcc-9-multilib:i386 g++-9-multilib:i386 binutils:i386 make:i386
- name: prepare-dsn
if: success()
run: |
sudo cp ./src/Tests/Tests/odbc-linux32.ini /etc/odbc.ini
sudo cp ./src/Tests/Tests/odbcinst-linux32.ini /etc/odbcinst.ini
mkdir -p ${{ github.workspace }}/odbc-logs
export ODBCSYSINI=/etc/
export ODBCINSTINI=odbcinst.ini
export ODBCINI=/etc/odbc.ini
- name: configure-and-build-driver
if: success()
run: |
./build_linux_release32_deb.sh
- name: run-tests
if: success()
run: |
./build/odbc/bin/tests --gtest_output="xml:report.xml"
- name: prepare-test-results
if: always()
run: |
cp ${{ github.workspace }}/report.xml ${{ github.workspace }}/odbc-logs/
- name: upload-test-report
if: failure()
uses: actions/upload-artifact@v2
with:
name: test-results-linux32
path: ${{ github.workspace }}/report.xml
- name: build-deb-installer
if: success()
run: |
cd cmake-build32
cmake ../src
make -j4
cpack .
cd ..
- name: create-output
if: success()
run: |
mkdir deb-installer
mkdir build-output
mkdir test-output
cp -v ./build/odbc/lib/*.a build-output/
cp -v ./build/odbc/lib/*.so build-output/
cp -v ./cmake-build32/*.deb deb-installer/
- name: upload-build
if: success()
uses: actions/upload-artifact@v2
with:
name: linux32-build
path: build-output
- name: upload-linux32-deb-installer
if: success()
uses: actions/upload-artifact@v2
with:
name: linux32-deb-installer
path: deb-installer
#build-linux32:
# runs-on: ubuntu-latest
# steps:
# - name: Setup cmake
# uses: jwlawson/[email protected]
# with:
# cmake-version: '3.21.4'
# - uses: actions/checkout@v2
# - name: Get Java distribution
# uses: actions/setup-java@v2
# with:
# distribution: 'temurin'
# java-version: '17'
# architecture: x86
# - name: run-cppcheck
# run: |
# sudo apt install cppcheck
# sh run_cppcheck.sh
# - name: upload-cppcheck-results
# if: failure()
# uses: actions/upload-artifact@v2
# with:
# name: cppcheck-results
# path: cppcheck-results.log
# - name: get-dependencies
# if: success()
# run: |
# # Need to install i386 versions
# sudo dpkg --add-architecture i386
# sudo apt update
# sudo apt install unixodbc:i386 unixodbc-dev:i386 odbcinst1debian2:i386 libodbc1:i386 libcurl4-openssl-dev:i386 libssl-dev:i386 uuid-dev:i386 cpp:i386 cpp-9:i386 gcc:i386 g++:i386 zlib1g-dev:i386 linux-headers-$(uname -r) gcc-multilib:i386 g++-multilib:i386 g++-9:i386 gcc-9:i386 gcc-9-multilib:i386 g++-9-multilib:i386 binutils:i386 make:i386
# - name: prepare-dsn
# if: success()
# run: |
# sudo cp ./src/Tests/Tests/odbc-linux32.ini /etc/odbc.ini
# sudo cp ./src/Tests/Tests/odbcinst-linux32.ini /etc/odbcinst.ini
# mkdir -p ${{ github.workspace }}/odbc-logs
# export ODBCSYSINI=/etc/
# export ODBCINSTINI=odbcinst.ini
# export ODBCINI=/etc/odbc.ini
# - name: configure-and-build-driver
# if: success()
# run: |
# ./build_linux_release32_deb.sh
# - name: run-tests
# if: success()
# run: |
# ./build/odbc/bin/tests --gtest_output="xml:report.xml"
# - name: prepare-test-results
# if: always()
# run: |
# cp ${{ github.workspace }}/report.xml ${{ github.workspace }}/odbc-logs/
# - name: upload-test-report
# if: failure()
# uses: actions/upload-artifact@v2
# with:
# name: test-results-linux32
# path: ${{ github.workspace }}/report.xml
# - name: build-deb-installer
# if: success()
# run: |
# cd cmake-build32
# cmake ../src
# make -j4
# cpack .
# cd ..
# - name: create-output
# if: success()
# run: |
# mkdir deb-installer
# mkdir build-output
# mkdir test-output
# cp -v ./build/odbc/lib/*.a build-output/
# cp -v ./build/odbc/lib/*.so build-output/
# cp -v ./cmake-build32/*.deb deb-installer/
# - name: upload-build
# if: success()
# uses: actions/upload-artifact@v2
# with:
# name: linux32-build
# path: build-output
# - name: upload-linux32-deb-installer
# if: success()
# uses: actions/upload-artifact@v2
# with:
# name: linux32-deb-installer
# path: deb-installer
6 changes: 6 additions & 0 deletions .github/workflows/mac-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ jobs:
with:
cmake-version: '3.21.4'
- uses: actions/checkout@v2
- name: Get Java distribution
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
architecture: x64
- name: run-cppcheck
run: |
brew install cppcheck
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/mac-debug-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ jobs:
with:
cmake-version: '3.21.4'
- uses: actions/checkout@v2
- name: Get Java distribution
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
architecture: x64
- name: run-cppcheck
run: |
brew install cppcheck
Expand Down
25 changes: 24 additions & 1 deletion .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ jobs:
with:
cmake-version: '3.21.4'
- uses: actions/checkout@v2
- name: Get Java distribution
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
architecture: x64
- name: run-cppcheck
run: |
brew install cppcheck
Expand Down Expand Up @@ -72,6 +78,15 @@ 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: x32
- name: "Update path for Java"
run: |
echo "${{ env.JAVA_HOME }}\bin\server" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - name: Get specific version CMake, v3.18.3
- name: Get specific version CMake, v3.18.3
uses: lukka/[email protected]
- name: add-msbuild-to-path
Expand Down Expand Up @@ -103,7 +118,15 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Get specific version CMake, v3.18.3
- 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 - name: Get specific version CMake, v3.18.3
uses: lukka/[email protected]
- name: add-msbuild-to-path
uses: microsoft/[email protected]
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/win-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ 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: x86
- name: "Update path for Java"
run: |
echo "${{ env.JAVA_HOME }}\bin\server" | 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
Expand Down Expand Up @@ -75,6 +84,15 @@ 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
- name: Get specific version CMake, v3.20.1
uses: lukka/[email protected]
- name: add-msbuild-to-path
Expand Down Expand Up @@ -120,6 +138,15 @@ 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
- name: Get specific version CMake, v3.20.1
uses: lukka/[email protected]
- name: add-msbuild-to-path
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/win-debug-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ 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: x32
- name: "Update path for Java"
run: |
echo "${{ env.JAVA_HOME }}\bin\server" | 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
Expand Down Expand Up @@ -61,6 +70,15 @@ 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
- name: Get specific version CMake, v3.20.1
uses: lukka/[email protected]
- name: add-msbuild-to-path
Expand Down
13 changes: 13 additions & 0 deletions src/Tests/Tests/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,39 @@
// clang-format on

int main(int argc, char** argv) {
std::cerr << "Start: Line 30" << std::endl;
birschick-bq marked this conversation as resolved.
Show resolved Hide resolved
#ifdef WIN32
std::cerr << "Line 32" << std::endl;
// Enable CRT for detecting memory leaks
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
std::cerr << "Line 35" << std::endl;
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
std::cerr << "Line 37" << std::endl;
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
std::cerr << "Line 39" << std::endl;
#endif
#ifdef __APPLE__
// Enable malloc logging for detecting memory leaks.
system("export MallocStackLogging=1");
#endif
std::cerr << "Line 45" << std::endl;
testing::internal::CaptureStdout();
std::cerr << "Line 47" << std::endl;
::testing::InitGoogleTest(&argc, argv);

std::cerr << "Line 50" << std::endl;
int failures = RUN_ALL_TESTS();

std::cerr << "Line 53" << std::endl;
std::string output = testing::internal::GetCapturedStdout();
std::cerr << "Line 55" << std::endl;
std::cout << output << std::endl;
std::cerr << "Line 56" << std::endl;
std::cout << (failures ? "Not all tests passed." : "All tests passed")
<< std::endl;
std::cerr << "Line 60" << std::endl;
WriteFileIfSpecified(argv, argv + argc, "-fout", output);
std::cerr << "Line 62" << std::endl;

#ifdef __APPLE__
// Disable malloc logging and report memory leaks
Expand Down
Loading