updated cpp version to 17 #267
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: matador@windows | |
on: | |
push: | |
branches: | |
- develop | |
- master | |
paths-ignore: | |
- .github/workflows/linux.yml | |
- .github/workflows/release.yml | |
- .github/workflows/coverage.yml | |
pull_request: | |
branches: | |
- develop | |
paths-ignore: | |
- .github/workflows/linux.yml | |
- .github/workflows/release.yml | |
- .github/workflows/coverage.yml | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Debug | |
INSTALL_LOCATION: ".local" | |
jobs: | |
build: | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cache dependencies | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: ${{env.INSTALL_LOCATION}} | |
key: ${{runner.os}}-dependencies | |
- name: Start PostgreSQL | |
run: | | |
$pgService = Get-Service -Name postgresql* | |
Set-Service -InputObject $pgService -Status running -StartupType automatic | |
Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru | |
- name: Create PostgreSQL User | |
run: | | |
& $env:PGBIN\psql --command="CREATE USER test PASSWORD 'test123'" --command="\du" | |
- name: Create PostgreSQL TestDB | |
run: | | |
& $env:PGBIN\createdb --owner=test matador_test | |
$env:PGPASSWORD = 'test123' | |
& $env:PGBIN\psql --username=test --host=localhost --list matador_test | |
- name: Install SQL Server on Windows | |
run: > | |
choco install sql-server-2019 -y | |
--params="'/Q /SUPPRESSPRIVACYSTATEMENTNOTICE /IACCEPTSQLSERVERLICENSETERMS /ACTION=Install /SkipRules=RebootRequiredCheck /FEATURES=SQLENGINE /SECURITYMODE=SQL /TCPENABLED=1 /SAPWD=Password12!'" | |
- name: Create SQL Server Database | |
run: sqlcmd -S localhost -U SA -P 'Password12!' -Q 'CREATE DATABASE matador_test' | |
- name: Install SQLite | |
shell: cmd | |
run: | | |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | |
choco install sqlite | |
cd /D C:\ProgramData\chocolatey\lib\SQLite\tools | |
lib.exe /machine:x64 /def:sqlite3.def /out:sqlite3.lib | |
mkdir lib | |
copy sqlite3.* lib\ | |
- name: Install SQLite Header | |
shell: cmd | |
run: | | |
cd /D C:\ProgramData\chocolatey\lib\SQLite\tools | |
for /f "tokens=2 delims=|" %%a in ('choco list sqlite -r --local-only --exact') do set VERSION=%%a | |
echo "SQLite Version: %VERSION%" | |
rem Extract major, minor, and patch components | |
for /f "tokens=1-3 delims=." %%i in ("%VERSION%") do ( | |
set MAJOR=%%i | |
set MINOR=00%%j | |
set PATCH=00%%k | |
) | |
set MAJOR=%MAJOR:~-2% | |
set MINOR=%MINOR:~-2% | |
set PATCH=%PATCH:~-2% | |
set FORMATTED_VERSION=%MAJOR%%MINOR%%PATCH%00 | |
set SQLITE3_FILE="sqlite-amalgamation-%FORMATTED_VERSION%.zip" | |
echo "Retrieving SQLite Amalgamation File: %SQLITE3_FILE%" | |
curl -L "https://www.sqlite.org/2023/sqlite-amalgamation-%FORMATTED_VERSION%.zip" --output %SQLITE3_FILE% | |
7z x %SQLITE3_FILE% | |
mkdir include | |
copy sqlite-amalgamation-%FORMATTED_VERSION%\sqlite3*.h include\ | |
dir include | |
- name: Set variables for SQLite | |
run: | | |
'C:\ProgramData\chocolatey\lib\SQLite\tools' >> $env:GITHUB_PATH | |
"SQLITE3_DIR=C:\ProgramData\chocolatey\lib\SQLite\tools" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Print SQLite Env Var | |
run: $env:SQLITE3_DIR | |
- name: Install mysql | |
shell: cmd | |
run: choco install mysql | |
- name: Prepare MySQL | |
shell: cmd | |
run: | | |
"C:\tools\mysql\current\bin\mysql" -u root -e "create database matador_test;" | |
"C:\tools\mysql\current\bin\mysql" -u root -e "CREATE USER 'test'@'localhost' IDENTIFIED BY 'test123'" | |
"C:\tools\mysql\current\bin\mysql" -u root -e "GRANT ALL PRIVILEGES ON matador_test.* TO 'test'@'localhost'" | |
"C:\tools\mysql\current\bin\mysql" -u root -e "FLUSH PRIVILEGES" | |
"C:\tools\mysql\current\bin\mysql" -u root -e "SHOW GRANTS FOR 'test'@'localhost'" | |
- name: Set MySQL variables | |
run: | | |
'C:\tools\mysql\current\lib' >> $env:GITHUB_PATH | |
- name: CMake Version | |
run: cmake --version | |
- name: Print Path | |
run: $env:PATH | |
- name: Configure CMake | |
run: > | |
cmake -B ${{github.workspace}}/build | |
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
-DCMAKE_INSTALL_PREFIX="$HOME/$env:INSTALL_LOCATION" | |
-DMYSQL_CONNECTION_STRING=mysql://test:test123@127.0.0.1/matador_test | |
-DMSSQL_CONNECTION_STRING:STRING="mssql://sa:Password12!@127.0.0.1/matador_test (ODBC Driver 17 for SQL Server)" | |
- name: Build | |
run: > | |
cmake --build ${{github.workspace}}/build | |
--config ${{env.BUILD_TYPE}} | |
--target matador test_matador | |
- name: List Debug | |
working-directory: ${{github.workspace}}/build/Debug/bin/Debug | |
run: dir | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
run: ctest --verbose -C ${{env.BUILD_TYPE}} |