diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index dee8c691..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,170 +0,0 @@ -name: Build - -on: - push: - branches: - - master - paths: - - '.github/workflows/build.yml' - pull_request: - release: - types: - - published - workflow_dispatch: - schedule: - - cron: '0 6 * * 1' - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - - uses: pre-commit/action@v3.0.0 - - conda: - name: Conda ${{ matrix.python-version }} - ${{ matrix.os }} - - runs-on: ${{ matrix.os }} - strategy: - fail-fast: true - matrix: - os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] - sidx-version: ['1.8.5','1.9.3'] - - steps: - - uses: actions/checkout@v4 - - uses: conda-incubator/setup-miniconda@v3 - with: - channels: conda-forge - auto-update-conda: true - python-version: ${{ matrix.python-version }} - - name: Setup - shell: bash -l {0} - run: | - conda install -c conda-forge numpy libspatialindex=${{ matrix.sidx-version }} -y - - name: Install - shell: bash -l {0} - run: | - pip install -e . - - name: Test with pytest - shell: bash -l {0} - run: | - pip install pytest - python -m pytest --doctest-modules rtree tests - ubuntu: - name: Ubuntu Python ${{ matrix.python-version }} - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - name: Install Python - with: - python-version: '3.11' - - name: Setup - shell: bash -l {0} - run: | - sudo apt install libspatialindex-c6 python3-pip - python3 -m pip install --upgrade pip - python3 -m pip install setuptools numpy pytest - - - name: Build - shell: bash -l {0} - run: | - python3 -m pip install --user . - - name: Test with pytest - shell: bash -l {0} - run: | - python3 -m pytest --doctest-modules rtree tests - - wheels: - name: Build wheel on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-latest, ubuntu-latest, macos-latest] - steps: - - uses: actions/checkout@v4 - - name: Set up QEMU - if: runner.os == 'Linux' - uses: docker/setup-qemu-action@v3 - with: - platforms: arm64 - - uses: actions/setup-python@v5 - name: Install Python - with: - python-version: '3.11' - - uses: ilammy/msvc-dev-cmd@v1 - if: startsWith(matrix.os, 'windows') - - name: Run Windows Preinstall Build - if: startsWith(matrix.os, 'windows') - run: | - choco install vcpython27 -f -y - ci\install_libspatialindex.bat - - name: Build wheels - uses: pypa/cibuildwheel@v2.16.2 - - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.os }}-whl - path: wheelhouse/*.whl - - collect-artifacts: - name: Package and push release - - #needs: [windows-wheel, linux-wheel, osx-wheel, conda, ubuntu] - needs: [conda, ubuntu, wheels] - - runs-on: 'ubuntu-latest' - strategy: - fail-fast: true - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - name: Install Python - with: - python-version: '3.11' - - name: Source - shell: bash -l {0} - run: | - sudo apt install libspatialindex-c6 python3-pip - python3 -m pip install --upgrade pip - python3 -m pip install setuptools numpy pytest wheel - export PATH=$PATH:/home/runner/.local/bin - python3 setup.py sdist - - - uses: actions/download-artifact@v4 - with: - path: dist - name: Download artifacts - - - name: Display structure of downloaded files - run: ls -R - working-directory: dist - - - name: Unpack - shell: bash -l {0} - working-directory: dist - run: | - for f in *whl - do - cd "$f" - cp *.whl .. - cd .. - done; - rm -rf *\-whl - ls -al - - - uses: pypa/gh-action-pypi-publish@release/v1 - name: Publish package - if: github.event_name == 'release' && github.event.action == 'published' - with: - user: __token__ - password: ${{ secrets.pypi_token }} - packages_dir: ./dist diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..9f566fa3 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,82 @@ +name: Build and upload to PyPI + +on: + workflow_dispatch: + pull_request: + push: + branches: + - master + paths: + - '.github/workflows/deploy.yml' + release: + types: + - published + +jobs: + build_wheels: + name: Build wheel on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + if: runner.os == 'Linux' + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + + - uses: actions/setup-python@v5 + name: Install Python + with: + python-version: '3.11' + + - uses: ilammy/msvc-dev-cmd@v1 + if: startsWith(matrix.os, 'windows') + + - name: Run Windows Preinstall Build + if: startsWith(matrix.os, 'windows') + run: | + choco install vcpython27 -f -y + ci\install_libspatialindex.bat + + - name: Build wheels + uses: pypa/cibuildwheel@v2.16.2 + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl + + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Build sdist + run: pipx run build --sdist + + - uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: dist/*.tar.gz + + upload_pypi: + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write + if: github.event_name == 'release' && github.event.action == 'published' + steps: + - uses: actions/download-artifact@v4 + with: + pattern: cibw-* + path: dist + merge-multiple: true + + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..c39c51bd --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,81 @@ +name: Test + +on: + push: + branches: + - master + paths: + - '.github/workflows/test.yml' + pull_request: + workflow_dispatch: + schedule: + - cron: '0 6 * * 1' + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - uses: pre-commit/action@v3.0.0 + + conda: + name: Conda ${{ matrix.python-version }} - ${{ matrix.os }} + defaults: + run: + shell: bash -l {0} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + sidx-version: ['1.8.5','1.9.3'] + + steps: + - uses: actions/checkout@v4 + - uses: conda-incubator/setup-miniconda@v3 + with: + channels: conda-forge + auto-update-conda: true + python-version: ${{ matrix.python-version }} + - name: Setup + run: | + conda install -c conda-forge numpy libspatialindex=${{ matrix.sidx-version }} -y + - name: Install + run: | + pip install -e . + - name: Test with pytest + run: | + pip install pytest + python -m pytest --doctest-modules rtree tests + + ubuntu: + name: Ubuntu Python ${{ matrix.python-version }} + defaults: + run: + shell: bash -l {0} + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + name: Install Python + with: + python-version: '3.11' + - name: Setup + run: | + sudo apt install libspatialindex-c6 python3-pip + python3 -m pip install --upgrade pip + python3 -m pip install setuptools numpy pytest + + - name: Build + run: | + python3 -m pip install --user . + - name: Test with pytest + run: | + python3 -m pytest --doctest-modules rtree tests diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3ac22aba..d914c4c0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,6 +5,11 @@ repos: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.27.3 + hooks: + - id: check-github-workflows + args: ["--verbose"] - repo: https://github.com/psf/black rev: 23.9.1 hooks: