-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
371e41a
commit c5a9c22
Showing
1 changed file
with
68 additions
and
53 deletions.
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 |
---|---|---|
@@ -1,72 +1,87 @@ | ||
name: Python package | ||
|
||
on: [push, pull_request] | ||
name: Tox | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.10.14', '3.11'] | ||
python-version: ["3.10", "3.11"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install build dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install -y meson libgl1-mesa-glx libcairo2-dev libgdk-pixbuf2.0-dev libglib2.0-dev libjpeg-dev libpng-dev libtiff5-dev libxml2-dev libopenjp2-7-dev libsqlite3-dev zlib1g-dev libzstd-dev | ||
sudo apt install -y libfftw3-dev libexpat1-dev libgsf-1-dev liborc-0.4-dev | ||
python -m pip install scikit-build cmake ninja Cython pybind11 numpy==1.26.4 | ||
- name: Cache pip | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Build and install OpenSlide | ||
run: | | ||
cd /tmp | ||
git clone https://github.com/openslide/openslide.git | ||
cd openslide | ||
meson setup builddir | ||
meson compile -C builddir | ||
sudo meson install -C builddir | ||
- name: Cache tox environments | ||
uses: actions/cache@v3 | ||
with: | ||
path: .tox | ||
key: ${{ runner.os }}-tox-${{ hashFiles('**/tox.ini') }} | ||
restore-keys: | | ||
${{ runner.os }}-tox- | ||
- name: Build and install libvips | ||
run: | | ||
cd /tmp | ||
git clone https://github.com/libvips/libvips.git | ||
cd libvips | ||
meson setup builddir --prefix=/usr/local | ||
meson compile -C builddir | ||
sudo meson install -C builddir | ||
sudo ldconfig | ||
- name: Install build dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel scikit-build cmake ninja Cython numpy==1.26.4 pybind11 pyproject_api | ||
- name: Get pybind11 CMake path | ||
id: get-pybind11-path | ||
run: | | ||
python -m pip install pybind11 | ||
echo "PYBIND11_CMAKE_PATH=$(python -c 'import pybind11; import os; print(os.path.join(pybind11.get_cmake_dir(), "pybind11Config.cmake"))')" >> $GITHUB_ENV | ||
- name: Install tox | ||
run: pip install tox | ||
- name: Set CMAKE_PREFIX_PATH for pybind11 | ||
run: | | ||
echo "CMAKE_PREFIX_PATH=$(dirname ${PYBIND11_CMAKE_PATH})" >> $GITHUB_ENV | ||
- name: Environment info | ||
run: | | ||
python --version | ||
pip list | ||
env | sort | ||
gcc --version | ||
cmake --version | ||
- name: Install Python dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install tox>=4.17.1 tox-gh-actions | ||
pip install -e . | ||
- name: Create sdist | ||
run: python setup.py sdist --dist-dir ./dist | ||
- name: Environment info | ||
run: | | ||
python --version | ||
pip list | ||
env | sort | ||
gcc --version | ||
cmake --version | ||
- name: List sdist contents | ||
run: tar -tvf ./dist/*.tar.gz | ||
- name: Create sdist | ||
run: python setup.py sdist --dist-dir ./dist | ||
|
||
- name: Run tox | ||
run: tox -vv | ||
- name: List sdist contents | ||
run: tar -tvf ./dist/*.tar.gz | ||
|
||
- name: Upload tox logs | ||
if: failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: tox-logs | ||
path: .tox/**/log/ | ||
- name: Test with tox | ||
run: tox -vv | ||
|
||
- name: Upload dist | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: dist | ||
path: dist/ | ||
- name: Upload tox logs | ||
if: failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: tox-logs | ||
path: .tox/**/log/ |