Skip to content

Commit

Permalink
Add uv to GitHub Actions (#2139)
Browse files Browse the repository at this point in the history
* Add uv to GitHub Actions

* Add extra dep

* Add unittests

* Fix tests

* Add env variable

* Load ee crednetials

* Remove uv.lock

* Add uv sync

* Fix basemap test error

* Use ipyleaflet

* Add test for py 3.13

* Add uv installation instructions
  • Loading branch information
giswqs authored Sep 23, 2024
1 parent 1751495 commit 8d4e55c
Show file tree
Hide file tree
Showing 12 changed files with 6,297 additions and 121 deletions.
67 changes: 41 additions & 26 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,55 @@
name: docs-build

on:
pull_request:
branches:
- master

jobs:
deploy:
docs-build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]

env:
USE_MKDOCS: ${{ secrets.USE_MKDOCS }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5

- name: Install uv
uses: astral-sh/setup-uv@v2
with:
python-version: "3.12"
- name: Install GDAL
version: "0.4.12"
enable-cache: true

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --python ${{ matrix.python-version }}

- name: Install optional dependencies
run: |
python -m pip install --upgrade pip
pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL pyproj
- name: Test GDAL installation
uv pip install --find-links https://girder.github.io/large_image_wheels GDAL pyproj
uv pip install -r pyproject.toml --extra all
- name: Test import
run: |
python -c "from osgeo import gdal"
gdalinfo --version
- name: Install dependencies
uv run python -c "import geemap; print('geemap import successful')"
uv run python -c "from osgeo import gdal; print('gdal import successful')"
uv run gdalinfo --version
- name: Running tests
run: |
python -m pip install --upgrade pip
pip install --user --no-cache-dir Cython
pip install .[all]
- name: LOAD EE CREDENTIALS
run: python ./.github/ee_token.py
env:
EARTHENGINE_TOKEN: ${{ secrets.EARTHENGINE_TOKEN }}
- name: GEEMAP-TEST
uv run python -m unittest discover tests/
- name: Install mkdocs
run: |
python -m unittest discover tests/
- run: pip install -r requirements_docs.txt
- run: cp -R examples/data docs/data
- run: mkdocs build
env:
USE_FOLIUM: ${{ secrets.USE_FOLIUM }}
USE_MKDOCS: ${{ secrets.USE_MKDOCS }}
uv pip install -r requirements_docs.txt
uv run mkdocs build
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v3.0
with:
Expand All @@ -52,4 +63,8 @@ jobs:
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 10

- name: Cleanup
if: always()
run: |
echo "Cleaning up resources."
60 changes: 34 additions & 26 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
name: docs

on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]

env:
USE_MKDOCS: ${{ secrets.USE_MKDOCS }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5

- name: Install uv
uses: astral-sh/setup-uv@v2
with:
python-version: "3.12"
- name: Install GDAL
version: "0.4.12"
enable-cache: true

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --python ${{ matrix.python-version }}

- name: Install optional dependencies
run: |
python -m pip install --upgrade pip
pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL pyproj
- name: Test GDAL installation
uv pip install --find-links https://girder.github.io/large_image_wheels GDAL pyproj
uv pip install -r pyproject.toml --extra all
- name: Test import
run: |
python -c "from osgeo import gdal"
gdalinfo --version
- name: Install libgeos
run: sudo apt -y install libgeos-dev
- name: Install dependencies
uv run python -c "import geemap; print('geemap import successful')"
uv run python -c "from osgeo import gdal; print('gdal import successful')"
uv run gdalinfo --version
- name: Running tests
run: |
python -m pip install --upgrade pip
pip install --user --no-cache-dir Cython
pip install .[all]
- name: LOAD EE CREDENTIALS
run: python ./.github/ee_token.py
env:
EARTHENGINE_TOKEN: ${{ secrets.EARTHENGINE_TOKEN }}
- name: GEEMAP-TEST
uv run python -m unittest discover tests/
- name: Install mkdocs
run: |
python -m unittest discover tests/
- run: pip install -r requirements_docs.txt
- run: cp -R examples/data docs/data
- run: mkdocs gh-deploy --force
env:
USE_FOLIUM: ${{ secrets.USE_FOLIUM }}
USE_MKDOCS: ${{ secrets.USE_MKDOCS }}
uv pip install -r requirements_docs.txt
uv run mkdocs gh-deploy --force
21 changes: 13 additions & 8 deletions .github/workflows/installation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ jobs:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5

- name: Install uv
uses: astral-sh/setup-uv@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install package
run: |
pip install setuptools
pip install .
version: "0.4.12"
enable-cache: true

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --python ${{ matrix.python-version }}

- name: Test import
run: python -c "import geemap; print('geemap import successful')"
run: uv run python -c "import geemap; print('geemap import successful')"
23 changes: 14 additions & 9 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,20 @@ jobs:
env:
SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
steps:
- name: CHECKOUT CODE
uses: actions/checkout@v4
- name: SETUP PYTHON
uses: actions/setup-python@v5
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v2
with:
python-version: ${{ matrix.config.py }}
version: "0.4.12"
enable-cache: true

- name: Set up Python ${{ matrix.config.py }}
run: uv python install ${{ matrix.config.py }}

- name: Install dependencies
run: uv sync --python ${{ matrix.config.py }}

- name: Test import
run: |
python -m pip install --upgrade pip
pip install --no-cache-dir Cython
pip install -r requirements.txt
pip install .
uv run python -c "import geemap; print('geemap import successful')"
42 changes: 42 additions & 0 deletions .github/workflows/py313.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: TestingUbuntu

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

jobs:
test-ubuntu:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ["3.13"]

env:
USE_MKDOCS: ${{ secrets.USE_MKDOCS }}

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v2
with:
version: "0.4.12"
enable-cache: true

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --python ${{ matrix.python-version }}

- name: Test import
run: |
uv run python -c "import geemap; print('geemap import successful')"
- name: Running tests
run: |
uv run python -m unittest discover tests/
52 changes: 30 additions & 22 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,47 @@
name: TestingUbuntu

on:
push:
branches:
- master
branches: ["master"]
pull_request:
branches:
- master
branches: ["master"]

name: Linux build
jobs:
test-ubuntu:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

env:
USE_MKDOCS: ${{ secrets.USE_MKDOCS }}

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5

- name: Install uv
uses: astral-sh/setup-uv@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install GDAL
run: |
python -m pip install --upgrade pip
pip install --no-cache-dir Cython
pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL
- name: Test GDAL installation
run: |
python -c "from osgeo import gdal"
gdalinfo --version
version: "0.4.12"
enable-cache: true

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --python ${{ matrix.python-version }}

- name: Install optional dependencies
run: |
uv pip install --find-links https://girder.github.io/large_image_wheels gdal pyproj
- name: Test import
run: |
pip install .[all]
- name: PKG-TEST
uv run python -c "import geemap; print('geemap import successful')"
uv run python -c "from osgeo import gdal; print('gdal import successful')"
uv run gdalinfo --version
- name: Running tests
run: |
python -m unittest discover tests/
env:
EARTHENGINE_TOKEN: ${{ secrets.EARTHENGINE_TOKEN }}
uv run python -m unittest discover tests/
40 changes: 24 additions & 16 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
name: "TestingWindows"

on:
push:
branches:
- master
pull_request:
branches:
- master

name: Windows build
jobs:
test-windows:
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.12"]

env:
USE_FOLIUM: ${{ secrets.USE_FOLIUM }}
USE_MKDOCS: ${{ secrets.USE_MKDOCS }}
MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN }}

steps:
- uses: actions/checkout@v4
- name: Install miniconda
uses: conda-incubator/setup-miniconda@v3

- name: Install uv
uses: astral-sh/setup-uv@v2
with:
auto-activate-base: true
python-version: "3.12"
- name: Install GDAL
run: conda install -c conda-forge gdal --yes
- name: Test GDAL installation
run: |
python -c "from osgeo import gdal"
gdalinfo --version
version: "0.4.12"
enable-cache: true

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --python ${{ matrix.python-version }}

- name: Test import
run: |
python -m pip install --upgrade pip
pip install --no-cache-dir Cython
pip install -r requirements.txt
pip install .
uv run python -c "import geemap; print('geemap import successful')"
Loading

0 comments on commit 8d4e55c

Please sign in to comment.