Files
Synthese-PSM_LARRA/.github/workflows/pyThtoQgis.yml
T
Alex38Lyon c1b9f6a28f Refactor pyThtoQgis workflow for better diagnostics
Updated workflow to improve GDAL and SFCGAL installation checks, added diagnostics for SHP files, and enhanced Python dependency verification.
2026-08-28 15:19:32 +02:00

175 lines
5.3 KiB
YAML

name: pyThtoQgis
on:
push:
paths:
- 'Outputs/SHP/*.shp'
# Permet de lancer l'action manuellement
workflow_dispatch:
permissions:
contents: write
jobs:
convert:
runs-on: ubuntu-latest
steps:
# ------------------------------------------------------------
# Récupération du dépôt
# ------------------------------------------------------------
- name: Checkout repository
uses: actions/checkout@v6
# ------------------------------------------------------------
# Installation de Python
# ------------------------------------------------------------
- name: Setup Python
uses: actions/setup-python@v7
with:
python-version: '3.12'
# ------------------------------------------------------------
# Installation de GDAL et SFCGAL
# ------------------------------------------------------------
- name: Install GDAL and SFCGAL
run: |
sudo apt-get update
sudo apt-get install -y \
gdal-bin \
libgdal-dev \
libsfcgal-dev
# ------------------------------------------------------------
# Vérification de GDAL
# ------------------------------------------------------------
- name: Check GDAL
run: |
echo "========================================"
echo "GDAL système"
echo "========================================"
gdal-config --version
echo
echo "gdal-config :"
which gdal-config
echo
echo "GDAL --version :"
gdalinfo --version
# ------------------------------------------------------------
# Installation des bibliothèques Python
# ------------------------------------------------------------
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install numpy
pip install alive-progress
# Installation des bindings Python GDAL
# correspondant à la version de GDAL du système
pip install "gdal[numpy]==$(gdal-config --version).*"
# ------------------------------------------------------------
# Vérification des bibliothèques Python
# ------------------------------------------------------------
- name: Test Python dependencies
run: |
echo "========================================"
echo "Python"
echo "========================================"
python --version
echo
echo "========================================"
echo "NumPy"
echo "========================================"
python -c "import numpy; print(numpy.__version__)"
echo
echo "========================================"
echo "GDAL Python"
echo "========================================"
python -c "from osgeo import gdal; print(gdal.__version__)"
echo
echo "========================================"
echo "OGR"
echo "========================================"
python -c "from osgeo import ogr; print('OGR OK')"
echo
echo "========================================"
echo "alive-progress"
echo "========================================"
python -c "from alive_progress import alive_bar; print('alive-progress OK')"
# ------------------------------------------------------------
# Diagnostic des fichiers SHP
#
# Uniquement les SHP directement dans Outputs/SHP/
# ------------------------------------------------------------
- name: Inspect SHP geometry
run: |
echo "========================================"
echo "Fichiers SHP détectés"
echo "========================================"
shopt -s nullglob
files=(Outputs/SHP/*.shp)
if [ ${#files[@]} -eq 0 ]; then
echo "Aucun fichier SHP trouvé."
exit 0
fi
for file in "${files[@]}"; do
echo
echo "========================================"
echo "$file"
echo "========================================"
ogrinfo -al -so "$file"
done
# ------------------------------------------------------------
# Exécution de pyThtoQgis
# ------------------------------------------------------------
- name: Run pyThtoQgis
working-directory: Scripts/pyThtoQgis
run: |
python pyThtoQgis.py --folder "../../Outputs/SHP/"
# ------------------------------------------------------------
# Affichage des fichiers générés/modifiés
# ------------------------------------------------------------
- name: Show generated files
run: |
echo "========================================"
echo "Fichiers modifiés"
echo "========================================"
git status --short
# ------------------------------------------------------------
# Commit des résultats
# ------------------------------------------------------------
- name: Commit generated files
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "Auto-run pyThtoQgis"