Build and test with conda #1106
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: Build and test with conda | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '47 6 * * *' | |
# Automatically stop old builds on the same branch/PR | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -el {0} | |
jobs: | |
macos-tests: | |
runs-on: macos-13 | |
strategy: | |
fail-fast: false | |
matrix: | |
PYTHON_VERSION: ['3.10', '3.11'] | |
PYARROW_VERSION: ['10.0.1'] | |
include: | |
- PYTHON_VERSION: "3.10" | |
PYARROW_VERSION: "9.0.0" | |
- PYTHON_VERSION: "3.11" | |
PYARROW_VERSION: "12.0.0" | |
- PYTHON_VERSION: "3.11" | |
PYARROW_VERSION: "13.0.0" | |
- PYTHON_VERSION: "3.11" | |
PYARROW_VERSION: "14.0.1" | |
- PYTHON_VERSION: "3.11" | |
PYARROW_VERSION: "15.0.0" | |
- PYTHON_VERSION: "3.11" | |
PYARROW_VERSION: "16.0.0" | |
- PYTHON_VERSION: "3.11" | |
PYARROW_VERSION: "17.0.0" | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Fetch full git history | |
run: git fetch --prune --unshallow | |
- name: Set up Conda env | |
uses: mamba-org/provision-with-micromamba@e2b397b12d0a38069451664382b769c9456e3d6d | |
with: | |
condarc-file: .github/workflows/.condarc | |
cache-env: true | |
extra-specs: | | |
python=${{ matrix.PYTHON_VERSION }} | |
pyarrow=${{ matrix.PYARROW_VERSION }} | |
pytest-md | |
pytest-emoji | |
- name: Build with CMake | |
run: | | |
mkdir build && \ | |
cd build && \ | |
cmake -DBOOST_ROOT=${CONDA_PREFIX} -DBUILD_COVERAGE=ON \ | |
-DCMAKE_INSTALL_PREFIX=./dist \ | |
-DPYTHON_EXECUTABLE=$(which python) \ | |
-GNinja .. && \ | |
ninja && \ | |
cmake --build . --target install | |
- name: Install repository | |
run: | | |
cd build/dist && python -m pip install --no-build-isolation --no-deps --disable-pip-version-check -e . | |
- name: Test import | |
run: | | |
cd / | |
python -c 'import turbodbc' | |
python -c "import turbodbc.arrow_support" | |
windows-tests: | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: cmd /C call {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
PYTHON_VERSION: ['3.10'] | |
PYARROW_VERSION: ['10.0.1'] | |
include: | |
- PYTHON_VERSION: "3.10" | |
PYARROW_VERSION: "9.0.0" | |
- PYTHON_VERSION: "3.11" | |
PYARROW_VERSION: "11.0.0" | |
- PYTHON_VERSION: "3.11" | |
PYARROW_VERSION: "12.0.0" | |
- PYTHON_VERSION: "3.11" | |
PYARROW_VERSION: "13.0.0" | |
- PYTHON_VERSION: "3.11" | |
PYARROW_VERSION: "14.0.1" | |
- PYTHON_VERSION: "3.11" | |
PYARROW_VERSION: "15.0.0" | |
steps: | |
- name: Create SQL Server | |
shell: pwsh | |
run: | | |
Write-Host "Downloading" | |
Import-Module BitsTransfer | |
Start-BitsTransfer -Source "https://download.microsoft.com/download/3/8/d/38de7036-2433-4207-8eae-06e247e17b25/SqlLocalDB.msi" -Destination SqlLocalDB.msi | |
Write-Host "Installing" | |
Start-Process -FilePath "SqlLocalDB.msi" -Wait -ArgumentList "/qn", "/norestart", "/l*v SqlLocalDBInstall.log", "IACCEPTSQLLOCALDBLICENSETERMS=YES" | |
sqlcmd -S '(localdb)\MSSQLLocalDB' -Q 'CREATE DATABASE test_db' -l 60 | |
- name: Configure ODBC Data Source | |
run: | | |
odbcconf /a {CONFIGDSN "ODBC Driver 17 for SQL Server" "DSN=MSSQL|Server=(localdb)\MSSQLLocalDB|Database=test_db|Trusted_Connection=Yes"} | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Fetch full git history | |
run: git fetch --prune --unshallow | |
- name: Set up Conda env | |
uses: mamba-org/provision-with-micromamba@e2b397b12d0a38069451664382b769c9456e3d6d | |
with: | |
condarc-file: .github/workflows/.condarc | |
cache-env: true | |
environment-file: environment.yml | |
extra-specs: | | |
python=${{ matrix.PYTHON_VERSION }} | |
pyarrow=${{ matrix.PYARROW_VERSION }} | |
pytest-md | |
pytest-emoji | |
pytest-cov | |
- name: Configure with CMake | |
run: | | |
@CALL micromamba activate turbodbc | |
@echo on | |
mkdir build | |
cd build | |
cmake -DBUILD_COVERAGE=ON -DCMAKE_INSTALL_PREFIX=./dist -DCMAKE_BUILD_TYPE=Release -GNinja .. | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
- name: Build with CMake | |
run: | | |
@CALL micromamba activate turbodbc | |
@echo on | |
cd build | |
ninja | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
cmake --build . --target install | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
- name: Install repository | |
run: | | |
@CALL micromamba activate turbodbc | |
@echo on | |
cd build/dist | |
dir src | |
dir src\turbodbc_arrow | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
python -m pip install --no-build-isolation --no-deps --disable-pip-version-check -e . | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
- name: Test import | |
run: | | |
@CALL micromamba activate turbodbc | |
@echo on | |
cd / | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
python -c "import turbodbc" | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
python -c "import turbodbc.arrow_support" | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
- name: Run tests | |
run: | | |
@CALL micromamba activate turbodbc | |
@echo on | |
cd build | |
ctest --verbose | |
if %errorlevel% neq 0 exit /b %errorlevel% |