Skip to content

Commit

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

* Fix build error

* Add uv.lock

* Update mergify
  • Loading branch information
giswqs authored Sep 29, 2024
1 parent 5cdeb6d commit ba598f5
Show file tree
Hide file tree
Showing 8 changed files with 4,650 additions and 99 deletions.
47 changes: 30 additions & 17 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,45 @@ on:
jobs:
test-docs-build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]

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

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
python-version: "3.11"
- name: Install GDAL
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
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: |
pip install --no-cache-dir Cython
pip install -r requirements.txt -r requirements_dev.txt
pip install .
- name: PKG-TEST
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: |
python -m unittest discover tests/
- name: Build docs
uv run python -c "import hypercoast; print('hypercoast import successful')"
uv run python -c "from osgeo import gdal; print('gdal import successful')"
uv run gdalinfo --version
- name: Running pytest
run: |
mkdocs build
uv run pytest . --verbose
- name: Install mkdocs
run: uv run mkdocs build
env:
EARTHDATA_USERNAME: ${{ secrets.EARTHDATA_USERNAME }}
EARTHDATA_PASSWORD: ${{ secrets.EARTHDATA_PASSWORD }}
Expand Down
41 changes: 31 additions & 10 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,45 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]

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

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
python-version: "3.11"
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 --user --no-cache-dir Cython
pip install --user -r requirements.txt -r requirements_dev.txt
pip install .
- name: PKG-TEST
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: |
python -m unittest discover tests/
- name: Build docs
run: mkdocs gh-deploy --force
uv run python -c "import hypercoast; print('hypercoast 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
- name: Install mkdocs
run: uv run mkdocs gh-deploy --force
env:
EARTHDATA_USERNAME: ${{ secrets.EARTHDATA_USERNAME }}
EARTHDATA_PASSWORD: ${{ secrets.EARTHDATA_PASSWORD }}
21 changes: 14 additions & 7 deletions .github/workflows/installation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,22 @@ jobs:
fail-fast: false
matrix:
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@v3
with:
python-version: ${{ matrix.python-version }}
version: "0.4.16"
# enable-cache: true

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

- name: Install dependencies
run: |
uv venv
uv pip install -e .
- name: Install package
run: pip install .
- name: Test import
run: python -c "import hypercoast; print('hypercoast import successful')"
run: uv run python -c "import hypercoast; print('hypercoast import successful')"
40 changes: 19 additions & 21 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,30 @@ on:
name: macOS build
jobs:
test-macOS:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} (${{ matrix.python-version}})

runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.py }})
strategy:
fail-fast: false
matrix:
os: ["macOS-latest"]
python-version: ["3.12"]

config:
- { os: macOS-latest, py: "3.12" }
env:
SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
python-version: ${{ matrix.python-version}}
- name: Install GDAL
run: |
brew install gdal
- name: Test GDAL installation
run: |
gdalinfo --version
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 hypercoast; print('hypercoast import successful')"
50 changes: 26 additions & 24 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,36 @@ on:

name: Linux build
jobs:
py-check:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.py }})
test-ubuntu:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
config:
- { os: ubuntu-latest, py: "3.9" }
- { os: ubuntu-latest, py: "3.10" }
- { os: ubuntu-latest, py: "3.11" }
- { os: ubuntu-latest, py: "3.12" }
python-version: ["3.9", "3.10", "3.11", "3.12"]

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@v3
with:
python-version: ${{ matrix.config.py }}
- 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
uv pip install pytest
- name: Test import
run: |
pip install --user -r requirements.txt
pip install .
uv run python -c "import hypercoast; print('hypercoast import successful')"
uv run python -c "from osgeo import gdal; print('gdal import successful')"
uv run gdalinfo --version
30 changes: 16 additions & 14 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,25 @@ name: Windows build
jobs:
test-windows:
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.12"]

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

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
auto-activate-base: true
python-version: "3.11"
version: "0.4.12"
enable-cache: true

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

- name: Install GDAL
run: conda install -c conda-forge gdal --yes
- name: Test GDAL installation
run: |
python -c "from osgeo import gdal"
gdalinfo --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 hypercoast; print('hypercoast import successful')"
12 changes: 6 additions & 6 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ pull_request_rules:
# If the requirement are satisfied
# The bot will trigger automerge
- label=ready-to-merge
- check-success=ubuntu-latest (3.9)
- check-success=ubuntu-latest (3.10)
- check-success=ubuntu-latest (3.11)
- check-success=ubuntu-latest (3.12)
- check-success=test-ubuntu (3.9)
- check-success=test-ubuntu (3.10)
- check-success=test-ubuntu (3.11)
- check-success=test-ubuntu (3.12)
- check-success=macOS-latest (3.12)
- check-success=test-windows
- check-success=test-windows (3.12)
- check-success=test-docs-build
- check-success=test-linux-installation (3.12)
# Approval by reviewer at least one maintainer
Expand All @@ -34,7 +34,7 @@ pull_request_rules:
actions:
comment:
# Message if there's conflict on pull request
message: Your pull request are conflict @{{author}}, please fix it!
message: Your pull request are in conflict @{{author}}, please fix it!
label:
# adding label on pull request if get trigger
add:
Expand Down
Loading

0 comments on commit ba598f5

Please sign in to comment.