Skip to content

fix: gdal: test if conda issue #1177

fix: gdal: test if conda issue

fix: gdal: test if conda issue #1177

Workflow file for this run

# for this workflow to work, need to release LPF=1.0.5, map2model=1.0.1,
name: release-please
on: [push, pull_request]
permissions:
contents: write
pull-requests: write
jobs:
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black ruff
- name: Autoformat with black
run: |
black .
- name: Lint with ruff
run: |
ruff check . --fix
- name: Check for local changes
run: |
if [ -n "$(git status --porcelain)" ]; then
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "style: style fixes by ruff and autoformatting by black"
fi
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: style fixes by ruff and autoformatting by black"
pypi-build-sdist:
name: Build SDist
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Build SDist
run: |
pip install build
python -m build
- uses: actions/upload-artifact@v4
with:
name: map2loop-dist
path: dist/*.tar.gz
compression-level: 0
pypi-test-sdist:
name: Test sdist
needs: pypi-build-sdist
runs-on: ubuntu-24.04
steps:
- name: Install GDAL
run: |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install -y libgdal-dev gdal-bin
- name: Download sdist from artifacts
uses: actions/download-artifact@v4
with:
name: map2loop-dist
path: dist
- name: Build Map2Loop from sdist and install test dependencies
shell: bash
run: |
pip install --upgrade pip
pip install numpy==1.26.4
pip install geopandas shapely networkx owslib map2model beartype gdal pytest scikit-learn
pip install git+https://github.com/loop3d/loopprojectfile.git@fix_thicknesses
pip install --no-cache dist/*.tar.gz
pip list
pypi-build-wheels:
needs: pypi-test-sdist
name: Build Wheels
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build Wheels
run: |
pip install build
python -m build --wheel
- uses: actions/upload-artifact@v4
with:
name: map2loop-wheels-${{ matrix.os }}
path: dist/*.whl
compression-level: 0
pypi-test-wheels:
name: Test wheels on ${{ matrix.os }}
needs: pypi-build-wheels
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-24.04
include:
- os: "ubuntu-24.04"
artifact: map2loop-wheels-ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Install GDAL - Linux
if: runner.os == 'Linux'
run: |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install -y libgdal-dev gdal-bin
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Download wheels from artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact }}
path: dist
- name: Install dependencies and Map2Loop wheel
shell: bash
run: |
pip install --upgrade pip
pip install numpy==1.26.4
pip install -r dependencies.txt
pip uninstall loopprojectfile -y
pip install git+https://github.com/loop3d/loopprojectfile.git@fix_thicknesses
pip install --no-cache --pre --no-index --find-links dist map2loop
pip list
- name: Testing
shell: bash -l {0}
run: |
pytest
conda-build:
name: Conda Build and Deploy ${{ matrix.os }} - Python Version-${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-24.04
# - macos-latest # currently not supported because needs libgcc>= 14 and not available for macos-latest (version available is 4.x.x)
- windows-latest
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: anaconda-client-env.
- name: Installing dependencies
shell: bash -l {0}
run: |
conda update conda -y
conda install -c conda-forge conda-build anaconda-client conda-verify -y
conda install -c loop3d -c conda-forge --file dependencies.txt -y
pip uninstall loopprojectfile -y
pip install git+https://github.com/loop3d/loopprojectfile.git@fix_thicknesses
conda install pytest -y
- name: Building and install
shell: bash -l {0}
run: |
pip install .
- name: Testing
shell: bash -l {0}
run: |
pytest
- name: Conda Build
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
path: ~/conda_pkgs_dir
shell: bash -l {0}
run: |
conda build -c anaconda -c conda-forge -c loop3d --output-folder conda conda --python ${{ matrix.python-version }}
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: map2loop-conda-${{ matrix.os }}-${{ matrix.python-version }}
path: conda
release-please:
needs: [pypi-test-wheels, conda-build]
runs-on: ubuntu-24.04
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- uses: googleapis/release-please-action@v4
id: release
with:
release-type: "python"
config-file: "release-please-config.json"
manifest-file: ".release-please-manifest.json"
outputs:
release_created: ${{ steps.release.outputs.release_created }}
#if a release is created then run the deploy scripts for github.io, conda, pypi and docker
documentation-test:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: |
cp CHANGELOG.md docs/source/CHANGELOG.md
docker build . -t=docs -f docs/Dockerfile
docker run -v $(pwd):/map2loop docs bash map2loop/docs/build_docs.sh
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/build/html
documentation-deploy:
runs-on: ubuntu-24.04
needs: [release-please, documentation-test]
if: ${{ needs.release-please.outputs.release_created }} && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: docs
path: docs
- name: ls
run: |
ls -l docs
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs # The folder the action should deploy.
conda-upload:
needs: [conda-build]
if: github.ref == 'refs/heads/master'
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-24.04
# - macos-latest
- windows-latest
python-version: ["3.9", "3.10", "3.11", "3.12"]
# if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: actions/download-artifact@v4
with:
name: map2loop-conda-${{ matrix.os }}-${{ matrix.python-version }}
path: conda
- uses: conda-incubator/setup-miniconda@v3
- name: upload all files to conda-forge
shell: bash -l {0}
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
with:
skip-existing: true
verbose: true
run: |
conda install -c anaconda anaconda-client -y
anaconda upload --label main conda/*/*.tar.bz2
pypi-upload:
needs: [pypi-test-wheels]
if: github.ref == 'refs/heads/master'
runs-on:
- ubuntu-24.04 # https://github.com/actions/runner-images/issues/10636
# if: ${{ needs.release-please.outputs.release_created }}
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: map2loop-dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true