-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix windows whl finding and add sdist check
- Loading branch information
Showing
2 changed files
with
142 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
on: | ||
push: | ||
branches: ['feature/python', 'feature/py-*'] # change to [main, master, 'hotfix/*', 'release/*', develop, 'feature/py-*'] after finish | ||
# pull_request: | ||
# branches: [main, master, 'hotfix/*', 'release/*', develop] | ||
|
||
name: py-sdist-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 | ||
echo $(sudo apt list --installed) | ||
echo "EIGEN_INCLUDE_DIR=/usr/include/eigen3" >> $GITHUB_ENV | ||
echo "BOOST_INCLUDE_DIR=/usr/include/boost" >> $GITHUB_ENV | ||
- name: Set system dependencies on macOS | ||
if: runner.os == 'macOS' | ||
run: | | ||
brew update | ||
brew install llvm libomp boost eigen | ||
EIGEN_LOC=$(brew --prefix eigen) | ||
BOOST_LOC=$(brew --prefix boost) | ||
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 "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: | | ||
choco install eigen -y --no-progress | ||
choco install boost-msvc-14.3 -y --no-progress | ||
$eigenPath = ( | ||
Get-ChildItem -Path "C:\ProgramData\chocolatey\lib\eigen" -Recurse -Filter "Eigen" | | ||
Select-Object -First 1 | ||
).Parent.FullName | ||
if ($eigenPath) { | ||
echo "eigen is installed in $eigenPath" | ||
} else { | ||
Write-Error "Wrong eigen path" | ||
exit 1 | ||
} | ||
$boostPath = $null | ||
$boostCand = @("C:\local", "C:\ProgramData\chocolatey\lib") | ||
foreach ($cand in $boostCand) { | ||
$isPath = ( | ||
Get-ChildItem -Path $cand -Directory | | ||
Where-Object { $_.Name -match "boost" } | | ||
Sort-Object LastWriteTime -Descending | | ||
Select-Object -First 1 | ||
).FullName | ||
if ($isPath) { | ||
$boostPath = $isPath | ||
break | ||
} | ||
} | ||
if ($boostPath) { | ||
echo "boost is installed in $boostPath" | ||
} else { | ||
Write-Error "Wrong boost path" | ||
exit 1 | ||
} | ||
echo "EIGEN_INCLUDE_DIR=$eigenPath" >> $Env:GITHUB_ENV | ||
echo "BOOST_INCLUDE_DIR=$boostPath" >> $Env:GITHUB_ENV | ||
- name: Verify Eigen and boost on non-Windows | ||
if: runner.os != 'Windows' | ||
run: | | ||
ls ${{ env.EIGEN_INCLUDE_DIR }} | ||
ls ${{ env.BOOST_INCLUDE_DIR }} | ||
- name: Verify Eigen and boost on Windows | ||
if: runner.os == 'Windows' | ||
run: | | ||
dir ${{ env.EIGEN_INCLUDE_DIR }} | ||
dir ${{ env.BOOST_INCLUDE_DIR }} | ||
- name: Install requirements | ||
run: | | ||
pip install --upgrade pip | ||
pip install -r requirements/requirements.txt | ||
- name: Verify pip | ||
run: pip list | ||
|
||
- name: Build sdist | ||
run: | | ||
pip install build | ||
python -m build --sdist . | ||
- name: Install sdist on non-Windows | ||
if: runner.os != 'Windows' | ||
run: pip install dist/*.tar.gz | ||
|
||
- name: Install sdist on Windows | ||
if: runner.os == 'Windows' | ||
run: | | ||
$dist = (Get-ChildItem -Path dist -Filter "*.tar.gz" | Select-Object -First 1).FullName | ||
pip install $dist | ||
- name: Verify installation | ||
run: pip list | ||
|
||
- name: OpenMP check | ||
run: python -c "from bvhar.utils import checkomp; checkomp.check_omp()" | ||
|
||
- name: Test | ||
run: pytest |
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