feat: adfs authentication support (#214) #1537
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Failover Unit Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- '*' | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.jpg' | |
- '**/README.txt' | |
- '**/LICENSE.txt' | |
- 'docs/**' | |
- 'ISSUE_TEMPLATE/**' | |
- '**/remove-old-artifacts.yml' | |
env: | |
LINUX_BUILD_TYPE: Release | |
WINDOWS_BUILD_TYPE: Debug | |
MAC_BUILD_TYPE: Debug | |
jobs: | |
build-windows: | |
name: Windows | |
runs-on: windows-latest | |
env: | |
CMAKE_GENERATOR: Visual Studio 17 2022 | |
MYSQL_DIR: C:/mysql-${{ vars.MYSQL_VERSION }}-winx64 | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
# Configure build environment/dependencies | |
- name: Install MySQL client libs and include files | |
run: | | |
curl -L https://dev.mysql.com/get/Downloads/MySQL-8.3/mysql-${{ vars.MYSQL_VERSION }}-winx64.zip -o mysql.zip | |
curl -L https://dev.mysql.com/get/Downloads/MySQL-8.3/mysql-${{ vars.MYSQL_VERSION }}-winx64-debug-test.zip -o mysql-debug.zip | |
unzip -d C:/ mysql.zip | |
mkdir C:/mysql-${{ vars.MYSQL_VERSION }}-winx64-debug | |
unzip -d C:/mysql-${{ vars.MYSQL_VERSION }}-winx64-debug mysql-debug.zip | |
mv -Force C:/mysql-${{ vars.MYSQL_VERSION }}-winx64-debug/mysql-${{ vars.MYSQL_VERSION }}-winx64/lib/debug/mysqlclient.lib C:/mysql-${{ vars.MYSQL_VERSION }}-winx64/lib/mysqlclient.lib | |
- name: Install OpenSSL 3 | |
run: | | |
curl -L https://download.firedaemon.com/FireDaemon-OpenSSL/openssl-3.3.1.zip -o openssl3.zip | |
unzip -d C:/ openssl3.zip | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: Cache AWS SDK libraries | |
id: cache-static-aws-sdk | |
uses: actions/cache@v4 | |
with: | |
path: | | |
aws_sdk | |
key: ${{ runner.os }}-aws-sdk-static-lib | |
- name: Build and install AWS SDK C++ | |
working-directory: ./scripts | |
if: steps.cache-static-aws-sdk.outputs.cache-hit != 'true' | |
run: | | |
.\build_aws_sdk_win.ps1 x64 ${{ env.WINDOWS_BUILD_TYPE}} ON "${{env.CMAKE_GENERATOR}}" | |
- name: Create build environment | |
shell: bash | |
run: cmake -E make_directory ${{ github.workspace }}/build | |
- name: Configure CMake | |
shell: bash | |
run: cmake -S . -B build -A x64 | |
-G "$CMAKE_GENERATOR" | |
-DCMAKE_BUILD_TYPE=$WINDOWS_BUILD_TYPE | |
-DMYSQLCLIENT_STATIC_LINKING=TRUE | |
-DENABLE_UNIT_TESTS=TRUE | |
-DENABLE_INTEGRATION_TESTS=FALSE | |
-DOPENSSL_INCLUDE_DIR="C:/openssl-3/x64/include/" | |
-DOPENSSL_LIBRARY="C:/openssl-3/x64/bin/libssl-3-x64.dll" | |
-DCRYPTO_LIBRARY="C:/openssl-3/x64/bin/libcrypto-3-x64.dll" | |
# Configure test environment | |
- name: Build Driver | |
shell: bash | |
working-directory: ${{ github.workspace }}/build | |
run: | | |
cmake --build . --config $WINDOWS_BUILD_TYPE | |
- name: Run failover tests | |
if: always() | |
working-directory: ${{ github.workspace }}/build/unit_testing | |
shell: bash | |
run: | | |
export PATH="${{ github.workspace }}/build/lib/${{env.WINDOWS_BUILD_TYPE}}":$PATH | |
ctest -C $WINDOWS_BUILD_TYPE --output-on-failure | |
- name: Check memory leaks | |
if: always() | |
working-directory: ${{ github.workspace }}/build/unit_testing/Testing/Temporary | |
run: | | |
$is_leaking = Select-String -Path ./LastTest.log -Pattern 'leak' -SimpleMatch | |
if ($is_leaking) {echo $is_leaking; exit 1;} | |
# Upload artifacts | |
- name: Upload build artifacts - Binaries | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-failover-sln | |
path: ${{ github.workspace }}/build/MySQL_Connector_ODBC.sln | |
- name: Upload build artifacts - Binaries | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-failover-binaries | |
path: ${{ github.workspace }}/build/bin/ | |
- name: Upload build artifacts - Libraries | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-failover-libraries | |
path: ${{ github.workspace }}/build/lib/ | |
- name: Upload failover test artifacts | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-failover-results | |
path: ${{ github.workspace }}/build/unit_testing/Testing/Temporary/LastTest.log | |
# build-linux: | |
# name: Linux | |
# runs-on: ubuntu-latest | |
# env: | |
# CMAKE_GENERATOR: Unix Makefiles | |
# CXX: g++-11 | |
# steps: | |
# - name: Checkout source code | |
# uses: actions/checkout@v4 | |
# | |
# # Configure build environment/dependencies | |
# - name: Install build dependencies | |
# run: sudo apt-get update && sudo apt-get install | |
# g++-11 | |
# build-essential | |
# libgtk-3-dev | |
# unixodbc | |
# unixodbc-dev | |
# libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev # AWS SDK dependencies | |
# | |
# - name: Install MySQL client libs and include files | |
# run: | | |
# curl -L https://dev.mysql.com/get/Downloads/MySQL-8.3/mysql-${{ vars.MYSQL_VERSION }}-linux-glibc2.28-x86_64.tar.xz -o mysql.tar.gz | |
# tar xf mysql.tar.gz | |
# | |
# - name: Cache AWS SDK libraries | |
# id: cache-dynamic-aws-sdk | |
# uses: actions/cache@v4 | |
# with: | |
# path: | | |
# aws_sdk | |
# key: ${{ runner.os }}-aws-sdk-dynamic-lib | |
# | |
# - name: Build and install AWS SDK C++ | |
# working-directory: ./scripts | |
# if: steps.cache-dynamic-aws-sdk.outputs.cache-hit != 'true' | |
# run: | | |
# ./build_aws_sdk_unix.sh $LINUX_BUILD_TYPE | |
# | |
# - name: Create build environment | |
# shell: bash | |
# run: cmake -E make_directory ${{ github.workspace }}/build | |
# | |
# - name: Configure CMake | |
# shell: bash | |
# run: cmake -S . -B build | |
# -G "$CMAKE_GENERATOR" | |
# -DCMAKE_BUILD_TYPE=$LINUX_BUILD_TYPE | |
# -DMYSQLCLIENT_STATIC_LINKING=true | |
# -DWITH_UNIXODBC=1 | |
# -DCONNECTOR_PLATFORM=linux | |
# -DMYSQL_DIR=./mysql-${{ vars.MYSQL_VERSION }}-linux-glibc2.28-x86_64/ | |
# -DENABLE_UNIT_TESTS=TRUE | |
# | |
# - name: copy AWS SDK libraries to driver library | |
# run: | | |
# cp ./aws_sdk/install/lib/*.so ./build/lib/ | |
# | |
# # Build driver | |
# - name: Build driver | |
# working-directory: ${{ github.workspace }}/build | |
# shell: bash | |
# run: make -j4 | |
# | |
# # Test driver | |
# - name: Run failover tests on Linux | |
# if: success() | |
# working-directory: ${{ github.workspace }}/build/unit_testing | |
# shell: bash | |
# run: ctest --output-on-failure | |
# | |
# # Upload artifacts | |
# - name: Upload build artifacts - Binaries | |
# if: always() | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: linux-failover-binaries | |
# path: ${{ github.workspace }}/build/bin/ | |
# - name: Upload build artifacts - Libraries | |
# if: always() | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: linux-failover-libraries | |
# path: ${{ github.workspace }}/build/lib/ | |
# - name: Upload test artifacts | |
# if: always() | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: linux-failover-results | |
# path: ${{ github.workspace }}/build/unit_testing/Testing/Temporary/LastTest.log | |
build-mac: | |
name: MacOS | |
runs-on: macos-13 | |
env: | |
CMAKE_GENERATOR: Unix Makefiles | |
ODBC_DM_INCLUDES: /usr/local/include | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
# Configure build environment/dependencies | |
# Removing some /usr/local/bin files to avoid symlink issues wih brew update | |
- name: Install MySQL client libs & other dependencies | |
run: | | |
rm '/usr/local/bin/2to3' | |
rm '/usr/local/bin/2to3-3.11' | |
rm '/usr/local/bin/idle3' | |
rm '/usr/local/bin/idle3.11' | |
rm '/usr/local/bin/pydoc3' | |
rm '/usr/local/bin/pydoc3.11' | |
rm '/usr/local/bin/python3' | |
rm '/usr/local/bin/python3-config' | |
rm '/usr/local/bin/python3.11' | |
rm '/usr/local/bin/python3.11-config' | |
brew update | |
brew unlink unixodbc | |
brew install libiodbc mysql-client | |
brew link --overwrite --force libiodbc | |
brew install openssl@3 | |
rm -f /usr/local/lib/libssl.3.dylib | |
rm -f /usr/local/lib/libcrypto.3.dylib | |
ln -s /usr/local/opt/openssl@3/lib/libssl.3.dylib /usr/local/lib/ | |
ln -s /usr/local/opt/openssl@3/lib/libcrypto.3.dylib /usr/local/lib/ | |
source /Users/runner/.bash_profile | |
curl -L https://dev.mysql.com/get/Downloads/MySQL-8.3/mysql-${{ vars.MYSQL_VERSION }}-macos14-x86_64.tar.gz -o mysql.tar.gz | |
tar -xzvf mysql.tar.gz | |
- name: Cache AWS SDK libraries | |
id: cache-dynamic-aws-sdk | |
uses: actions/cache@v4 | |
with: | |
path: | | |
aws_sdk | |
key: ${{ runner.os }}-aws-sdk-dynamic-lib | |
- name: Build and install AWS SDK C++ | |
working-directory: ./scripts | |
if: steps.cache-dynamic-aws-sdk.outputs.cache-hit != 'true' | |
run: | | |
./build_aws_sdk_unix.sh $MAC_BUILD_TYPE | |
- name: Create build environment | |
shell: bash | |
run: cmake -E make_directory ${{ github.workspace }}/build | |
- name: Configure CMake | |
shell: bash | |
run: cmake -S . -B build | |
-G "$CMAKE_GENERATOR" | |
-DCMAKE_BUILD_TYPE=$MAC_BUILD_TYPE | |
-DMYSQLCLIENT_STATIC_LINKING=true | |
-DODBC_INCLUDES=$ODBC_DM_INCLUDES | |
-DENABLE_UNIT_TESTS=TRUE | |
-DENABLE_INTEGRATION_TESTS=FALSE | |
-DMYSQL_DIR=./mysql-${{ vars.MYSQL_VERSION }}-macos14-x86_64 | |
# Build driver | |
- name: Build driver | |
working-directory: ${{ github.workspace }}/build | |
shell: bash | |
run: | | |
export LIBRARY_PATH=$LIBRARY_PATH:$(brew --prefix zstd)/lib/ | |
cmake --build . | |
ln -s /usr/local/opt/openssl@3/lib/libssl.3.dylib /Users/runner/work/aws-mysql-odbc/aws-mysql-odbc/build/unit_testing/ | |
ln -s /usr/local/opt/openssl@3/lib/libssl.3.dylib /Users/runner/work/aws-mysql-odbc/aws-mysql-odbc/build/unit_testing/bin/ | |
ln -s /usr/local/opt/openssl@3/lib/libcrypto.3.dylib /Users/runner/work/aws-mysql-odbc/aws-mysql-odbc/build/unit_testing/ | |
ln -s /usr/local/opt/openssl@3/lib/libcrypto.3.dylib /Users/runner/work/aws-mysql-odbc/aws-mysql-odbc/build/unit_testing/bin/ | |
# Test driver | |
- name: Run driver tests | |
if: success() | |
working-directory: ${{ github.workspace }}/build/unit_testing | |
shell: bash | |
run: ctest --output-on-failure | |
- name: Check memory leaks | |
if: always() | |
working-directory: ${{ github.workspace }}/build/unit_testing/bin | |
run: | | |
leaks -atExit -- ./unit_testing > ../leaks_unit_testing.txt | |
export is_leaking=$? | |
if (( $is_leaking != 0 )); then echo $is_leaking; exit 1; else echo "no memory leaks"; fi; | |
# Upload artifacts | |
- name: Upload build artifacts - Binaries | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos-binaries | |
path: ${{ github.workspace }}/build/bin/ | |
- name: Upload build artifacts - Libraries | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos-libraries | |
path: ${{ github.workspace }}/build/lib/ | |
- name: Upload test artifacts | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos-failover-results | |
path: ${{ github.workspace }}/build/unit_testing/Testing/Temporary/LastTest.log | |
- name: Upload memory leaks check | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos-memory-leaks-results | |
path: ${{ github.workspace }}/build/unit_testing/leaks_unit_testing.txt |