Skip to content

Commit

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

* remove frozen

* Remove python 3.13

* Fix uv run

* Add uv run

* Add uv run

* Add env variables

* Update installation test

* Update macos uv

* Update docs build

* Update windows test

* Update docs yml

* Update ubuntu

* Update names

* Add GDAL

* Add pyproj

* Remove python 3.13

* Add gdal

* Fix gdal error

* Add uv.lock
  • Loading branch information
giswqs authored Sep 22, 2024
1 parent 490317d commit c390774
Show file tree
Hide file tree
Showing 13 changed files with 6,996 additions and 228 deletions.
61 changes: 21 additions & 40 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ jobs:
matrix:
python-version: ["3.12"]

defaults:
run:
shell: bash -el {0}

env:
PLANET_API_KEY: ${{ secrets.PLANET_API_KEY }}
USE_FOLIUM: ${{ secrets.USE_FOLIUM }}
Expand All @@ -30,54 +26,39 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: true
python-version: ${{ matrix.python-version }}
channels: conda-forge,defaults
channel-priority: true
miniconda-version: latest

- name: Cache dependencies
uses: actions/cache@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
version: "0.4.12"
enable-cache: true

- name: Testing conda
run: |
conda info
conda list
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install GDAL
run: |
# conda install -c conda-forge mamba --yes
# mamba install -c conda-forge gdal pyproj --yes
pip install --no-cache-dir Cython
pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL
- name: Install dependencies
run: uv sync --python ${{ matrix.python-version }}

- name: Test GDAL installation
- name: Install optional dependencies
run: |
python -c "from osgeo import gdal"
gdalinfo --version
uv pip install --find-links https://girder.github.io/large_image_wheels GDAL pyproj
uv pip install pytest
uv pip install -r requirements_dev.txt
- name: Install dependencies
- name: Test import
run: |
pip install -U pip
pip install --no-cache-dir Cython PyYAML==6.0.1 boto3
pip install -r requirements.txt -r requirements_dev.txt
pip install .
uv run python -c "import leafmap; print('leafmap import successful')"
uv run python -c "from osgeo import gdal; print('gdal import successful')"
uv run gdalinfo --version
- name: PKG-TEST
run: python -m unittest discover tests/
- name: Running pytest
run: |
uv run pytest . --verbose
- name: Install mkdocs
run: |
pip install -r requirements_docs.txt
mkdocs build
uv pip install -r requirements_docs.txt
uv run mkdocs build
- name: Deploy to Netlify
uses: nwtgck/[email protected]
Expand Down
64 changes: 24 additions & 40 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
name: docs

on:
push:
branches:
- master

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

defaults:
run:
shell: bash -el {0}

env:
PLANET_API_KEY: ${{ secrets.PLANET_API_KEY }}
USE_FOLIUM: ${{ secrets.USE_FOLIUM }}
Expand All @@ -24,54 +22,40 @@ jobs:
GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}
EARTHDATA_USERNAME: ${{ secrets.EARTHDATA_USERNAME }}
EARTHDATA_PASSWORD: ${{ secrets.EARTHDATA_PASSWORD }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: true
python-version: ${{ matrix.python-version }}
channels: conda-forge,defaults
channel-priority: true
miniconda-version: latest

- name: Cache dependencies
uses: actions/cache@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
version: "0.4.12"
enable-cache: true

- name: Testing conda
run: |
conda info
conda list
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install GDAL
run: |
# conda install -c conda-forge mamba --yes
# mamba install -c conda-forge gdal pyproj --yes
pip install --no-cache-dir Cython
pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL
- name: Install dependencies
run: uv sync --python ${{ matrix.python-version }}

- name: Test GDAL installation
- name: Install optional dependencies
run: |
python -c "from osgeo import gdal"
gdalinfo --version
uv pip install --find-links https://girder.github.io/large_image_wheels GDAL pyproj
uv pip install pytest
uv pip install -r requirements_dev.txt
- name: Install dependencies
- name: Test import
run: |
pip install --no-cache-dir Cython PyYAML==6.0.1
pip install -r requirements.txt -r requirements_dev.txt
pip install .
uv run python -c "import leafmap; print('leafmap import successful')"
uv run python -c "from osgeo import gdal; print('gdal import successful')"
uv run gdalinfo --version
- name: PKG-TEST
run: python -m unittest discover tests/
- name: Running pytest
run: |
uv run pytest . --verbose
- name: Install mkdocs
run: pip install -r requirements_docs.txt
- run: mkdocs gh-deploy --force
run: |
uv pip install -r requirements_docs.txt
uv run mkdocs gh-deploy --force
19 changes: 13 additions & 6 deletions .github/workflows/installation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +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 .
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 leafmap; print('leafmap import successful')"
run: uv run python -c "import leafmap; print('leafmap import successful')"
23 changes: 15 additions & 8 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +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 }}
- name: Install package
run: pip install .
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 -c "import leafmap; print('leafmap import successful')"
run: |
uv run python -c "import leafmap; print('leafmap import successful')"
46 changes: 46 additions & 0 deletions .github/workflows/py313.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: TestingLeafmapUbuntu

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:
PLANET_API_KEY: ${{ secrets.PLANET_API_KEY }}
USE_FOLIUM: ${{ secrets.USE_FOLIUM }}
USE_MKDOCS: ${{ secrets.USE_MKDOCS }}
HEREMAPS_API_KEY: ${{ secrets.HEREMAPS_API_KEY }}
DP_TOKEN: ${{ secrets.DP_TOKEN }}
MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}

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 leafmap; print('leafmap import successful')"
58 changes: 58 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: TestingLeafmapUbuntu

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

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

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

env:
PLANET_API_KEY: ${{ secrets.PLANET_API_KEY }}
USE_FOLIUM: ${{ secrets.USE_FOLIUM }}
USE_MKDOCS: ${{ secrets.USE_MKDOCS }}
HEREMAPS_API_KEY: ${{ secrets.HEREMAPS_API_KEY }}
DP_TOKEN: ${{ secrets.DP_TOKEN }}
MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}

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: Install optional dependencies
run: |
uv pip install --find-links https://girder.github.io/large_image_wheels gdal pyproj
uv pip install pytest
uv pip install -r requirements_dev.txt
- name: Test import
run: |
uv run python -c "import leafmap; print('leafmap import successful')"
uv run python -c "from osgeo import gdal; print('gdal import successful')"
uv run gdalinfo --version
- name: Running pytest
run: |
uv run pytest . --verbose
Loading

0 comments on commit c390774

Please sign in to comment.