revert dl gig trick #114
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
on: | |
push: | |
branches: [main, master, 'hotfix/*', 'release/*', develop, 'feature/py-*', 'feature/*-withci'] | |
pull_request: | |
branches: [main, master, 'hotfix/*', 'release/*', develop] | |
name: py-wheel-check | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ['3.10', '3.11', '3.12'] | |
defaults: | |
run: | |
working-directory: python | |
name: ${{ matrix.os }} (${{ matrix.python-version }}) | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set system dependencies on Linux | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libboost-all-dev libeigen3-dev libfmt-dev libspdlog-dev | |
echo $(sudo apt list --installed) | |
echo "EIGEN_INCLUDE_DIR=/usr/include/eigen3" >> $GITHUB_ENV | |
echo "BOOST_INCLUDE_DIR=/usr/include/boost" >> $GITHUB_ENV | |
echo "SPDLOG_INCLUDE_DIR=/usr/include/spdlog" >> $GITHUB_ENV | |
echo "FMT_INCLUDE_DIR=/usr/include/fmt" >> $GITHUB_ENV | |
- name: Set system dependencies on macOS | |
if: runner.os == 'macOS' | |
run: | | |
brew update | |
brew install llvm libomp boost eigen fmt spdlog | |
EIGEN_LOC=$(brew --prefix eigen) | |
BOOST_LOC=$(brew --prefix boost) | |
SPDLOG_LOC=$(brew --prefix spdlog) | |
FMT_LOC=$(brew --prefix fmt) | |
LLVM_LOC=$(brew --prefix llvm) | |
OMP_LOC=$(brew --prefix libomp) | |
echo "EIGEN_INCLUDE_DIR=$EIGEN_LOC/include/eigen3" >> $GITHUB_ENV | |
echo "BOOST_INCLUDE_DIR=$BOOST_LOC/include" >> $GITHUB_ENV | |
echo "SPDLOG_INCLUDE_DIR=$SPDLOG_LOC/include" >> $GITHUB_ENV | |
echo "FMT_INCLUDE_DIR=$FMT_LOC/include" >> $GITHUB_ENV | |
echo "LLVM_LOC=$LLVM_LOC" >> $GITHUB_ENV | |
echo "OMP_LOC=$OMP_LOC" >> $GITHUB_ENV | |
echo "CC=$LLVM_LOC/bin/clang" >> $GITHUB_ENV | |
echo "CXX=$LLVM_LOC/bin/clang++" >> $GITHUB_ENV | |
echo "CPPFLAGS=-I$LLVM_LOC/include -I$OMP_LOC/include" >> $GITHUB_ENV | |
echo "LDFLAGS=-L$LLVM_LOC/lib -L$OMP_LOC/lib" >> $GITHUB_ENV | |
- name: Set system dependencies on Windows | |
if: runner.os == 'Windows' | |
run: | | |
$vcpkgRoot = $Env:VCPKG_INSTALLATION_ROOT | |
vcpkg install eigen3 | Out-Null | |
vcpkg install boost | Out-Null | |
vcpkg install fmt | Out-Null | |
vcpkg install spdlog | Out-Null | |
$installPath = $null | |
$tripletCand = @( | |
"$vcpkgRoot\installed\x64-windows", | |
"$vcpkgRoot\installed\x86-windows", | |
"$vcpkgRoot\installed\arm64-windows" | |
) | |
foreach ($cand in $tripletCand) { | |
Write-Host "Checking triplet path: $cand" | |
if (Test-Path "$cand\include") { | |
$installPath = "$cand" | |
Write-Host "Valid installation: $installPath" | |
break | |
} | |
} | |
if (-not $installPath) { | |
Write-Error "No valid installation path" | |
exit 1 | |
} | |
$libPath = @{ | |
"eigen" = "$installPath\include\eigen3" | |
"boost" = "$installPath\include" | |
"spdlog" = "$installPath\include" | |
"fmt" = "$installPath\include" | |
} | |
foreach ($lib in $libPath.Keys) { | |
if (Test-Path $libPath[$lib]) { | |
Write-Host "$lib is installed in $($libPath[$lib])" | |
echo "$($lib.ToUpper())_INCLUDE_DIR=$($libPath[$lib])" >> $Env:GITHUB_ENV | |
} else { | |
Write-Error "Wrong $lib path: $($libPath[$lib])" | |
exit 1 | |
} | |
} | |
- name: Verify C++ libraries on non-Windows | |
if: runner.os != 'Windows' | |
run: | | |
ls ${{ env.EIGEN_INCLUDE_DIR }} | |
ls ${{ env.BOOST_INCLUDE_DIR }} | |
ls ${{ env.SPDLOG_INCLUDE_DIR }} | |
ls ${{ env.FMT_INCLUDE_DIR }} | |
- name: Verify C++ libraries on Windows | |
if: runner.os == 'Windows' | |
run: | | |
dir ${{ env.EIGEN_INCLUDE_DIR }} | |
dir ${{ env.BOOST_INCLUDE_DIR }} | |
dir ${{ env.SPDLOG_INCLUDE_DIR }} | |
dir ${{ env.FMT_INCLUDE_DIR }} | |
- name: Install requirements | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements/requirements.txt | |
- name: Verify pip | |
run: pip list | |
- name: Build wheel | |
run: | | |
pip install build | |
python -m build --wheel . | |
- name: Install wheel on non-Windows | |
if: runner.os != 'Windows' | |
run: pip install dist/*.whl | |
- name: Install wheel on Windows | |
if: runner.os == 'Windows' | |
run: | | |
$whl = (Get-ChildItem -Path dist -Filter "*.whl" | Select-Object -First 1).FullName | |
pip install $whl | |
- name: Verify installation | |
run: pip list | |
- name: OpenMP check | |
run: python -c "from bvhar.utils import checkomp; checkomp.check_omp()" | |
- name: Test | |
run: pytest |