Compare commits

...
Author SHA1 Message Date
Alex38Lyon c67d53a0bd Refactor SFCGAL test script in build-gdal.yml
Refactor SFCGAL test script to improve readability and structure.
2026-08-31 23:21:19 +02:00
Alex38Lyon e08760594d Fix formatting in build-gdal.yml 2026-08-31 23:04:23 +02:00
Alex38Lyon 9c4b6dae18 Improve structure and comments in build-gdal.yml
Refactor GDAL package creation script for clarity and organization.
2026-08-31 22:46:03 +02:00
Alex38Lyon 466c243fe6 Add GitHub Actions workflow for pyThtoQgis 2026-08-31 22:31:03 +02:00
Alex38Lyon 049c48c6bc Fix syntax for writing version information in YAML 2026-08-31 22:27:34 +02:00
Alex38Lyon e9025d659d Add GitHub Actions workflow to build GDAL with SFCGAL
This workflow builds GDAL with SFCGAL support on Ubuntu 24.04, including setup, configuration, compilation, and packaging steps.
2026-08-31 22:24:36 +02:00
github-actions[bot] 2a2e9bea3f Auto-generate outputs from SHP 2026-08-31 20:04:00 +00:00
Alex38Lyon 8f754ee37e Test final 2026-08-31 21:47:23 +02:00
Alex38Lyon 0244776be4 update 2026-08-31 21:46:19 +02:00
Alex38Lyon 2e50ef159c Upgrade actions/checkout and mamba-org/setup-micromamba 2026-08-31 21:45:14 +02:00
github-actions[bot] 9bca1d4e81 Auto-generate outputs from SHP 2026-08-31 19:38:17 +00:00
Alex38Lyon 07a5b54acd Essais 2026-08-31 21:23:03 +02:00
Alex38Lyon 742905f5dd Rename workflow from pyThtoQgis-2 to pyThtoQgis 2026-08-31 21:22:01 +02:00
Alex38Lyon 04a9c6ccbc Enhance pyThtoQgis workflow with SHP checks
Updated the GitHub Actions workflow to include checks for added or modified SHP files, improved comments, and adjusted commit messages for generated outputs.
2026-08-31 21:21:31 +02:00
Alex38Lyon 79df9b7b9d Test ttl 2 2026-08-31 21:01:53 +02:00
Alex38Lyon 99bb0648b9 Rename workflow and enhance file verification
Updated workflow name and modified script execution and file checks.
2026-08-31 21:00:47 +02:00
17 changed files with 7501 additions and 38 deletions
+557
View File
@@ -0,0 +1,557 @@
name: Build GDAL + SFCGAL
on:
workflow_dispatch:
permissions:
contents: write
jobs:
build-gdal:
runs-on: ubuntu-24.04
env:
GDAL_VERSION: 3.13.3
SFCGAL_VERSION: 2.2
GEOS_VERSION: 3.14.1
PYTHON_VERSION: 3.12
steps:
# ============================================================
# 1. Checkout
# ============================================================
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
# ============================================================
# 2. Micromamba
# ============================================================
- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v3.2.1
with:
environment-name: pyThtoQgis
create-args: >-
python=3.12
numpy
sfcgal=2.2
geos
proj
sqlite
libtiff
libjpeg-turbo
libpng
zlib
curl
openssl
swig
cmake
ninja
pkg-config
init-shell: bash
cache-environment: true
cache-downloads: true
# ============================================================
# 3. Informations environnement
# ============================================================
- name: Environment information
shell: bash -el {0}
run: |
echo "========================================"
echo "ENVIRONMENT"
echo "========================================"
echo "CONDA_PREFIX=$CONDA_PREFIX"
python --version
echo ""
echo "Packages :"
conda list | grep -E \
"python|numpy|sfcgal|geos|proj|sqlite"
# ============================================================
# 4. Vérification SFCGAL
# ============================================================
- name: Check SFCGAL
shell: bash -el {0}
run: |
echo "========================================"
echo "SFCGAL"
echo "========================================"
sfcgal-config --version || true
find "$CONDA_PREFIX" \
\( -iname "*sfcgal*.so*" -o -iname "*SFCGAL*.so*" \) \
-print
# ============================================================
# 5. Téléchargement GDAL
# ============================================================
- name: Download GDAL
shell: bash -el {0}
run: |
set -e
cd "$RUNNER_TEMP"
git clone \
--depth 1 \
--branch "v${GDAL_VERSION}" \
https://github.com/OSGeo/gdal.git
cd gdal
mkdir build
cd build
# ============================================================
# 6. Configuration CMake
# ============================================================
- name: Configure GDAL
shell: bash -el {0}
working-directory: ${{ runner.temp }}/gdal/build
run: |
set -e
cmake .. \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX" \
-DCMAKE_PREFIX_PATH="$CONDA_PREFIX" \
-DCMAKE_LIBRARY_PATH="$CONDA_PREFIX/lib" \
-DCMAKE_INCLUDE_PATH="$CONDA_PREFIX/include" \
-DCMAKE_INSTALL_RPATH="$CONDA_PREFIX/lib" \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
-DGDAL_USE_SFCGAL=ON \
-DGDAL_USE_GEOS=ON \
-DGDAL_USE_PROJ=ON \
-DGDAL_USE_SQLITE3=ON \
-DGDAL_USE_CURL=ON \
-DGDAL_BUILD_OPTIONAL_DRIVERS=ON \
-DBUILD_PYTHON_BINDINGS=ON
# ============================================================
# 7. Compilation
# ============================================================
- name: Build GDAL
shell: bash -el {0}
working-directory: ${{ runner.temp }}/gdal/build
run: |
set -e
echo "========================================"
echo "BUILD GDAL"
echo "========================================"
ninja -j"$(nproc)"
# ============================================================
# 8. Installation
# ============================================================
- name: Install GDAL
shell: bash -el {0}
working-directory: ${{ runner.temp }}/gdal/build
run: |
set -e
ninja install
# ============================================================
# 9. Vérification GDAL
# ============================================================
- name: Check GDAL
shell: bash -el {0}
run: |
echo "========================================"
echo "GDAL"
echo "========================================"
gdalinfo --version
python - <<'PY'
from osgeo import gdal
print("GDAL Python:")
print(gdal.VersionInfo("--version"))
print()
print("Build info:")
print(gdal.VersionInfo("--build-info"))
PY
# ============================================================
# 10. Vérification liaison SFCGAL
# ============================================================
- name: Check GDAL SFCGAL linkage
shell: bash -el {0}
run: |
echo "========================================"
echo "GDAL / SFCGAL"
echo "========================================"
echo ""
echo "libgdal :"
ls -lh "$CONDA_PREFIX"/lib/libgdal.so*
echo ""
echo "Dépendances :"
ldd "$CONDA_PREFIX/lib/libgdal.so" \
| grep -Ei "sfcgal|geos"
# ============================================================
# 11. Test SFCGAL
# ============================================================
- name: Test SFCGAL via OGR
shell: bash -el {0}
run: |
python -c '
from osgeo import ogr
from osgeo import gdal
print("GDAL :", gdal.VersionInfo("--version"))
geom = ogr.CreateGeometryFromWkt("""
POLYHEDRALSURFACE Z (
(
(0 0 0,
10 0 0,
10 10 0,
0 10 0,
0 0 0)
)
)
""")
print("Type :", geom.GetGeometryName())
print("Geometry type :", geom.GetGeometryType())
print("Has Z :", ogr.GT_HasZ(geom.GetGeometryType()))
print("IsValid() :", geom.IsValid())
if geom is None:
raise RuntimeError("Impossible de créer la géométrie 3D")
print("SFCGAL accessible par OGR : OK")
'
# ============================================================
# 12. Création du package GDAL + SFCGAL
# ============================================================
- name: Create GDAL package
shell: bash -el {0}
run: |
set -e
PACKAGE_NAME="gdal-${GDAL_VERSION}-sfcgal-${SFCGAL_VERSION}-geos-${GEOS_VERSION}-ubuntu-24.04"
PACKAGE_DIR="$RUNNER_TEMP/$PACKAGE_NAME"
mkdir -p "$PACKAGE_DIR"
echo "========================================"
echo "Création du package"
echo "========================================"
# ========================================================
# Structure du package
# ========================================================
mkdir -p "$PACKAGE_DIR/bin"
mkdir -p "$PACKAGE_DIR/lib"
mkdir -p "$PACKAGE_DIR/lib/python3.12/site-packages"
mkdir -p "$PACKAGE_DIR/share"
# ========================================================
# GDAL executables
# ========================================================
echo "Copie des exécutables GDAL..."
find "$CONDA_PREFIX/bin" \
-maxdepth 1 \
-type f \
-name "gdal*" \
-exec cp -a {} "$PACKAGE_DIR/bin/" \;
# ========================================================
# GDAL library
# ========================================================
echo "Copie de libgdal..."
cp -a \
"$CONDA_PREFIX"/lib/libgdal.so* \
"$PACKAGE_DIR/lib/"
# ========================================================
# Python bindings
# ========================================================
echo "Copie des bindings Python..."
if [ ! -d "$CONDA_PREFIX/lib/python3.12/site-packages/osgeo" ]; then
echo "ERREUR : bindings Python osgeo absents"
find "$CONDA_PREFIX/lib" \
-maxdepth 4 \
-type d \
-name osgeo \
-print
exit 1
fi
cp -a \
"$CONDA_PREFIX/lib/python3.12/site-packages/osgeo" \
"$PACKAGE_DIR/lib/python3.12/site-packages/"
# ========================================================
# GDAL data
# ========================================================
echo "Recherche des données GDAL..."
if [ -d "$CONDA_PREFIX/share/gdal" ]; then
cp -a \
"$CONDA_PREFIX/share/gdal" \
"$PACKAGE_DIR/share/"
else
echo "ATTENTION : share/gdal absent"
fi
# ========================================================
# Bibliothèques SFCGAL
# ========================================================
echo "Copie des bibliothèques SFCGAL..."
find "$CONDA_PREFIX/lib" \
-maxdepth 1 \
\( \
-name "libSFCGAL.so*" \
\) \
-exec cp -a {} "$PACKAGE_DIR/lib/" \;
# ========================================================
# Bibliothèques GEOS
# ========================================================
echo "Copie des bibliothèques GEOS..."
find "$CONDA_PREFIX/lib" \
-maxdepth 1 \
\( \
-name "libgeos.so*" \
-o -name "libgeos_c.so*" \
\) \
-exec cp -a {} "$PACKAGE_DIR/lib/" \;
# ========================================================
# Informations
# ========================================================
cat > "$PACKAGE_DIR/VERSION.txt" <<EOF
GDAL=${GDAL_VERSION}
SFCGAL=${SFCGAL_VERSION}
GEOS=${GEOS_VERSION}
Python=${PYTHON_VERSION}
OS=ubuntu-24.04
GDAL_USE_SFCGAL=ON
GDAL_USE_GEOS=ON
EOF
# ========================================================
# Affichage
# ========================================================
echo ""
echo "========================================"
echo "Contenu du package"
echo "========================================"
find "$PACKAGE_DIR" \
-maxdepth 5 \
-type f \
| sort
# ========================================================
# Taille
# ========================================================
echo ""
echo "Taille :"
du -sh "$PACKAGE_DIR"
# ========================================================
# Compression
# ========================================================
cd "$RUNNER_TEMP"
tar \
-czf \
"${PACKAGE_NAME}.tar.gz" \
"$PACKAGE_NAME"
echo ""
echo "========================================"
echo "Package créé"
echo "========================================"
ls -lh \
"${PACKAGE_NAME}.tar.gz"
echo \
"PACKAGE_NAME=${PACKAGE_NAME}" \
>> "$GITHUB_ENV"
# ============================================================
# 13. Test du package
# ============================================================
- name: Test package
shell: bash -el {0}
run: |
set -e
cd "$RUNNER_TEMP"
mkdir test-package
tar \
-xzf \
"${PACKAGE_NAME}.tar.gz" \
-C test-package
echo "Package testé :"
find test-package \
-maxdepth 2 \
-type f | sort
# ============================================================
# 14. Publication Release
# ============================================================
- name: Publish GDAL package
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
set -e
TAG="gdal-sfcgal-${GDAL_VERSION}"
PACKAGE="${RUNNER_TEMP}/${PACKAGE_NAME}.tar.gz"
echo "========================================"
echo "Publication"
echo "========================================"
echo "Tag : $TAG"
echo "Package : $PACKAGE"
# --------------------------------------------------------
# Suppression éventuelle de l'ancienne release
# --------------------------------------------------------
if gh release view "$TAG" >/dev/null 2>&1; then
echo "Release existante : suppression"
gh release delete "$TAG" \
--yes \
--cleanup-tag
fi
# --------------------------------------------------------
# Création de la Release
# --------------------------------------------------------
gh release create "$TAG" \
"$PACKAGE" \
--title "GDAL ${GDAL_VERSION} + SFCGAL ${SFCGAL_VERSION}" \
--notes "GDAL ${GDAL_VERSION} compiled with SFCGAL ${SFCGAL_VERSION} and GEOS ${GEOS_VERSION} for pyThtoQgis." \
--latest=false
+183 -35
View File
@@ -2,17 +2,25 @@ name: pyThtoQgis
on: on:
push: push:
branches:
- main
paths: paths:
- 'Outputs/SHP/*.shp' - 'Outputs/SHP/*.shp'
# Permet de lancer l'action manuellement
workflow_dispatch: workflow_dispatch:
permissions: permissions:
contents: write contents: write
concurrency:
group: pyThtoQgis
cancel-in-progress: false
jobs: jobs:
build:
pyThtoQgis:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -20,17 +28,72 @@ jobs:
# ============================================================ # ============================================================
# 1. Récupération du dépôt # 1. Récupération du dépôt
# ============================================================ # ============================================================
- name: Checkout
uses: actions/checkout@v4 - name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
# ============================================================ # ============================================================
# 2. Installation de Micromamba # 2. Vérification du type de modification
#
# Le workflow est déclenché par *.shp mais GitHub déclenche
# également l'action lorsqu'un SHP est supprimé.
#
# On ne continue que si au moins un SHP a été AJOUTÉ ou MODIFIÉ.
# ============================================================ # ============================================================
- name: Check SHP changes
id: changed
shell: bash
run: |
echo "========================================"
echo "Recherche des SHP ajoutés/modifiés"
echo "========================================"
SHP_FILES=$(git diff-tree \
--no-commit-id \
--name-only \
--diff-filter=AM \
-r \
"$GITHUB_SHA" \
-- 'Outputs/SHP/*.shp')
echo "Fichiers SHP ajoutés/modifiés :"
echo "$SHP_FILES"
if [ -n "$SHP_FILES" ]; then
echo "shp=true" >> "$GITHUB_OUTPUT"
else
echo "shp=false" >> "$GITHUB_OUTPUT"
fi
# ============================================================
# 3. Arrêt si aucun SHP ajouté/modifié
# ============================================================
- name: Stop if no SHP added or modified
if: steps.changed.outputs.shp != 'true'
shell: bash
run: |
echo "Aucun fichier SHP ajouté ou modifié."
echo "Le workflow s'arrête."
# ============================================================
# 4. Installation de Micromamba
# ============================================================
- name: Setup Micromamba - name: Setup Micromamba
uses: mamba-org/setup-micromamba@v2 if: steps.changed.outputs.shp == 'true'
uses: mamba-org/setup-micromamba@v3
with: with:
environment-name: pyThtoQgis environment-name: pyThtoQgis
create-args: >- create-args: >-
python=3.12 python=3.12
numpy numpy
@@ -48,15 +111,19 @@ jobs:
cmake cmake
ninja ninja
pkg-config pkg-config
init-shell: bash init-shell: bash
cache-environment: true cache-environment: true
cache-downloads: true cache-downloads: true
# ============================================================ # ============================================================
# 3. Informations environnement # 5. Informations environnement
# ============================================================ # ============================================================
- name: Environment information - name: Environment information
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0} shell: bash -el {0}
run: | run: |
@@ -73,14 +140,20 @@ jobs:
echo "CONDA_PREFIX=$CONDA_PREFIX" echo "CONDA_PREFIX=$CONDA_PREFIX"
echo "========================================"
echo "Packages"
echo "========================================"
conda list | grep -E \ conda list | grep -E \
"python|numpy|gdal|geos|sfcgal|proj|sqlite" "python|numpy|gdal|geos|sfcgal|proj|sqlite|cmake"
# ============================================================ # ============================================================
# 4. Vérification SFCGAL # 6. Vérification SFCGAL
# ============================================================ # ============================================================
- name: Check SFCGAL - name: Check SFCGAL
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0} shell: bash -el {0}
run: | run: |
@@ -90,6 +163,7 @@ jobs:
sfcgal-config --version || true sfcgal-config --version || true
echo ""
echo "Bibliothèques SFCGAL :" echo "Bibliothèques SFCGAL :"
find "$CONDA_PREFIX" \ find "$CONDA_PREFIX" \
@@ -98,9 +172,11 @@ jobs:
# ============================================================ # ============================================================
# 5. Compilation de GDAL # 7. Compilation de GDAL avec SFCGAL
# ============================================================ # ============================================================
- name: Build GDAL with SFCGAL - name: Build GDAL with SFCGAL
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0} shell: bash -el {0}
run: | run: |
@@ -125,9 +201,9 @@ jobs:
cd build cd build
# -------------------------------------------------------- echo "========================================"
# CMake echo "Configuration CMake"
# -------------------------------------------------------- echo "========================================"
cmake .. \ cmake .. \
-GNinja \ -GNinja \
@@ -148,28 +224,25 @@ jobs:
echo "========================================" echo "========================================"
echo "Configuration CMake terminée" echo "Compilation"
echo "========================================" echo "========================================"
# --------------------------------------------------------
# Compilation
# --------------------------------------------------------
ninja -j"$(nproc)" ninja -j"$(nproc)"
# -------------------------------------------------------- echo "========================================"
# Installation dans Conda echo "Installation"
# -------------------------------------------------------- echo "========================================"
ninja install ninja install
# ============================================================ # ============================================================
# 6. Vérification de GDAL installé # 8. Vérification GDAL
# ============================================================ # ============================================================
- name: Check GDAL - name: Check GDAL
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0} shell: bash -el {0}
run: | run: |
@@ -178,24 +251,30 @@ jobs:
echo "========================================" echo "========================================"
which gdalinfo which gdalinfo
gdalinfo --version gdalinfo --version
echo "" echo ""
echo "GDAL Python :" echo "GDAL Python :"
python - <<'PY' python - <<'PY'
from osgeo import gdal from osgeo import gdal
print(gdal.VersionInfo("--version")) print(gdal.VersionInfo("--version"))
print() print()
print(gdal.VersionInfo("--build-info")) print(gdal.VersionInfo("--build-info"))
PY PY
# ============================================================ # ============================================================
# 7. Vérification liaison SFCGAL # 9. Vérification liaison GDAL / SFCGAL / GEOS
# ============================================================ # ============================================================
- name: Check GDAL SFCGAL linkage - name: Check GDAL SFCGAL linkage
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0} shell: bash -el {0}
run: | run: |
@@ -203,6 +282,7 @@ jobs:
echo "GDAL / SFCGAL linkage" echo "GDAL / SFCGAL linkage"
echo "========================================" echo "========================================"
echo ""
echo "libgdal :" echo "libgdal :"
find "$CONDA_PREFIX/lib" \ find "$CONDA_PREFIX/lib" \
@@ -211,16 +291,18 @@ jobs:
-print -print
echo "" echo ""
echo "Dépendances :" echo "Dépendances libgdal :"
ldd "$CONDA_PREFIX/lib/libgdal.so" \ ldd "$CONDA_PREFIX/lib/libgdal.so" \
| grep -Ei "sfcgal|geos" || true | grep -Ei "sfcgal|geos" || true
# ============================================================ # ============================================================
# 8. Test OGR / SFCGAL # 10. Test SFCGAL via OGR
# ============================================================ # ============================================================
- name: Test SFCGAL via OGR - name: Test SFCGAL via OGR
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0} shell: bash -el {0}
run: | run: |
@@ -236,7 +318,7 @@ jobs:
print("GDAL :", gdal.VersionInfo("--version")) print("GDAL :", gdal.VersionInfo("--version"))
# -------------------------------------------------------- # --------------------------------------------------------
# Géométrie PolyhedralSurface Z # Création d'une géométrie 3D
# -------------------------------------------------------- # --------------------------------------------------------
wkt = """ wkt = """
@@ -259,6 +341,7 @@ jobs:
) )
print("Type :", geom.GetGeometryName()) print("Type :", geom.GetGeometryName())
print( print(
"Geometry type :", "Geometry type :",
geom.GetGeometryType() geom.GetGeometryType()
@@ -266,7 +349,9 @@ jobs:
print( print(
"Has Z :", "Has Z :",
ogr.GT_HasZ(geom.GetGeometryType()) ogr.GT_HasZ(
geom.GetGeometryType()
)
) )
try: try:
@@ -288,13 +373,15 @@ jobs:
raise raise
print() print()
print("Test terminé.") print("Test SFCGAL terminé avec succès.")
# ============================================================ # ============================================================
# 9. Installation des dépendances Python # 11. Installation des dépendances Python du projet
# ============================================================ # ============================================================
- name: Install Python dependencies - name: Install Python dependencies
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0} shell: bash -el {0}
run: | run: |
@@ -305,15 +392,76 @@ jobs:
# ============================================================ # ============================================================
# 10. Test pyThtoQgis # 12. Affichage des SHP à traiter
# ============================================================ # ============================================================
- name: Test pyThtoQgis
- name: List SHP input files
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0} shell: bash -el {0}
run: | run: |
echo "========================================" echo "========================================"
echo "Test pyThtoQgis" echo "Fichiers SHP"
echo "========================================" echo "========================================"
python Scripts/pyThtoQgis/pyThtoQgis.py \ find Outputs/SHP \
--help -maxdepth 1 \
-type f \
-name "*.shp" \
-print
# ============================================================
# 13. Exécution de pyThtoQgis
# ============================================================
- name: Run pyThtoQgis
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0}
run: |
echo "========================================"
echo "Exécution pyThtoQgis"
echo "========================================"
cd Scripts/pyThtoQgis
python pyThtoQgis.py \
--folder "../../Outputs/SHP/"
# ============================================================
# 14. Affichage des fichiers produits
# ============================================================
- name: Show generated files
if: steps.changed.outputs.shp == 'true'
shell: bash
run: |
echo "========================================"
echo "Fichiers générés / modifiés"
echo "========================================"
git status --short
echo ""
echo "========================================"
echo "Différence Git"
echo "========================================"
git diff --stat
# ============================================================
# 15. Commit des fichiers produits
# ============================================================
- name: Commit generated files
if: steps.changed.outputs.shp == 'true'
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "Auto-generate outputs from SHP"
commit_user_name: "github-actions[bot]"
commit_user_email: "41898282+github-actions[bot]@users.noreply.github.com"
commit_author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
+515
View File
@@ -0,0 +1,515 @@
name: pyThtoQgis
on:
push:
branches:
- main
paths:
- 'Outputs/SHP/*.shp'
workflow_dispatch:
permissions:
contents: write
concurrency:
group: pyThtoQgis
cancel-in-progress: false
jobs:
pyThtoQgis:
runs-on: ubuntu-24.04
steps:
# ============================================================
# 1. Checkout
# ============================================================
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
# ============================================================
# 2. Vérification SHP
# ============================================================
- name: Check SHP changes
id: changed
shell: bash
run: |
SHP_FILES=$(git diff-tree \
--no-commit-id \
--name-only \
--diff-filter=AM \
-r \
"$GITHUB_SHA" \
-- 'Outputs/SHP/*.shp')
echo "SHP ajoutés/modifiés :"
echo "$SHP_FILES"
if [ -n "$SHP_FILES" ]; then
echo "shp=true" >> "$GITHUB_OUTPUT"
else
echo "shp=false" >> "$GITHUB_OUTPUT"
fi
# ============================================================
# 3. Arrêt si suppression uniquement
# ============================================================
- name: Stop if no SHP added or modified
if: steps.changed.outputs.shp != 'true'
shell: bash
run: |
echo "Aucun SHP ajouté ou modifié."
echo "Arrêt du workflow."
# ============================================================
# 4. Micromamba
#
# IMPORTANT :
# PAS de GDAL ici.
#
# GDAL sera fourni par notre package précompilé.
# ============================================================
- name: Setup Micromamba
if: steps.changed.outputs.shp == 'true'
uses: mamba-org/setup-micromamba@v3.2.1
with:
environment-name: pyThtoQgis
create-args: >-
python=3.12
numpy
sfcgal=2.2
geos
proj
sqlite
libtiff
libjpeg-turbo
libpng
zlib
curl
openssl
init-shell: bash
cache-environment: true
cache-downloads: true
# ============================================================
# 5. Informations environnement
# ============================================================
- name: Environment information
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0}
run: |
echo "========================================"
echo "ENVIRONMENT"
echo "========================================"
echo "CONDA_PREFIX=$CONDA_PREFIX"
python --version
echo ""
conda list | grep -E \
"python|numpy|sfcgal|geos|proj|sqlite"
# ============================================================
# 6. Téléchargement package GDAL
# ============================================================
- name: Download GDAL + SFCGAL package
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0}
env:
GH_TOKEN: ${{ github.token }}
run: |
set -e
GDAL_VERSION=3.13.3
PACKAGE_NAME="gdal-${GDAL_VERSION}-sfcgal-2.2-geos-3.14.1-ubuntu-24.04"
TAG="gdal-sfcgal-${GDAL_VERSION}"
echo "========================================"
echo "GDAL PACKAGE"
echo "========================================"
echo "Release : $TAG"
echo "Package : $PACKAGE_NAME"
gh release download "$TAG" \
--repo "$GITHUB_REPOSITORY" \
--pattern "${PACKAGE_NAME}.tar.gz" \
--dir "$RUNNER_TEMP"
echo ""
echo "Package téléchargé :"
ls -lh \
"$RUNNER_TEMP/${PACKAGE_NAME}.tar.gz"
# ============================================================
# 7. Installation package GDAL
# ============================================================
- name: Install GDAL package
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0}
run: |
set -e
GDAL_VERSION=3.13.3
PACKAGE_NAME="gdal-${GDAL_VERSION}-sfcgal-2.2-geos-3.14.1-ubuntu-24.04"
PACKAGE="$RUNNER_TEMP/${PACKAGE_NAME}.tar.gz"
echo "========================================"
echo "INSTALLATION GDAL"
echo "========================================"
cd "$RUNNER_TEMP"
tar \
-xzf \
"$PACKAGE"
# --------------------------------------------------------
# Exécutables
# --------------------------------------------------------
cp -a \
"$PACKAGE_NAME"/gdal* \
"$CONDA_PREFIX/bin/"
# --------------------------------------------------------
# Bibliothèque GDAL
# --------------------------------------------------------
cp -a \
"$PACKAGE_NAME"/libgdal.so* \
"$CONDA_PREFIX/lib/"
# --------------------------------------------------------
# Python bindings
# --------------------------------------------------------
rm -rf \
"$CONDA_PREFIX/lib/python3.12/site-packages/osgeo"
cp -a \
"$PACKAGE_NAME/osgeo" \
"$CONDA_PREFIX/lib/python3.12/site-packages/"
# --------------------------------------------------------
# Headers
# --------------------------------------------------------
rm -rf \
"$CONDA_PREFIX/include/gdal"
cp -a \
"$PACKAGE_NAME/gdal" \
"$CONDA_PREFIX/include/"
# --------------------------------------------------------
# GDAL data
# --------------------------------------------------------
rm -rf \
"$CONDA_PREFIX/share/gdal"
cp -a \
"$PACKAGE_NAME/gdal" \
"$CONDA_PREFIX/share/" \
2>/dev/null || true
echo ""
echo "GDAL installé."
# ============================================================
# 8. Vérification GDAL
# ============================================================
- name: Check GDAL
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0}
run: |
set -e
echo "========================================"
echo "GDAL"
echo "========================================"
which gdalinfo
gdalinfo --version
echo ""
echo "Python GDAL :"
python - <<'PY'
from osgeo import gdal
print(
gdal.VersionInfo("--version")
)
print()
print(
gdal.VersionInfo("--build-info")
)
PY
# ============================================================
# 9. Vérification SFCGAL
# ============================================================
- name: Check SFCGAL linkage
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0}
run: |
set -e
echo "========================================"
echo "GDAL / SFCGAL"
echo "========================================"
ldd "$CONDA_PREFIX/lib/libgdal.so" \
| grep -Ei "sfcgal|geos"
# ============================================================
# 10. Test SFCGAL
# ============================================================
- name: Test SFCGAL via OGR
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0}
run: |
python - <<'PY'
from osgeo import ogr
from osgeo import gdal
print("========================================")
print("TEST SFCGAL")
print("========================================")
print(
gdal.VersionInfo("--version")
)
wkt = """
POLYHEDRALSURFACE Z (
(
(0 0 0,
10 0 0,
10 10 0,
0 10 0,
0 0 0)
)
)
"""
geom = ogr.CreateGeometryFromWkt(wkt)
if geom is None:
raise RuntimeError(
"Impossible de créer la géométrie 3D"
)
print(
"Type :",
geom.GetGeometryName()
)
print(
"Geometry type :",
geom.GetGeometryType()
)
print(
"Has Z :",
ogr.GT_HasZ(
geom.GetGeometryType()
)
)
valid = geom.IsValid()
print(
"IsValid() :",
valid
)
print()
print(
"SFCGAL accessible par OGR : OK"
)
PY
# ============================================================
# 11. Dépendances Python
# ============================================================
- name: Install Python dependencies
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0}
run: |
python -m pip install --upgrade pip
pip install \
alive-progress
# ============================================================
# 12. Affichage des SHP
# ============================================================
- name: List SHP input files
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0}
run: |
echo "========================================"
echo "SHP INPUT"
echo "========================================"
find Outputs/SHP \
-maxdepth 1 \
-type f \
-name "*.shp" \
-print
# ============================================================
# 13. Exécution pyThtoQgis
# ============================================================
- name: Run pyThtoQgis
if: steps.changed.outputs.shp == 'true'
shell: bash -el {0}
run: |
echo "========================================"
echo "pyThtoQgis"
echo "========================================"
cd Scripts/pyThtoQgis
python pyThtoQgis.py \
--folder "../../Outputs/SHP/"
# ============================================================
# 14. Fichiers produits
# ============================================================
- name: Show generated files
if: steps.changed.outputs.shp == 'true'
shell: bash
run: |
echo "========================================"
echo "GENERATED FILES"
echo "========================================"
git status --short
echo ""
git diff --stat
# ============================================================
# 15. Commit
# ============================================================
- name: Commit generated files
if: steps.changed.outputs.shp == 'true'
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "Auto-generate outputs from SHP"
commit_user_name: "github-actions[bot]"
commit_user_email: "41898282+github-actions[bot]@users.noreply.github.com"
commit_author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -8,7 +8,7 @@
""" """
################################################################################################# #################################################################################################
Version = "2026.08.28" Version = "2026.08.31"
################################################################################################# #################################################################################################
pathshp = ".\\Inputs\\" pathshp = ".\\Inputs\\"
@@ -22,4 +22,4 @@ output_log = ".\\" + file_log
errorCount = 0 errorCount = 0
geometryErrors = [] geometryErrors = []
debug_log = True debug_log = False
-1
View File
@@ -1837,7 +1837,6 @@ if __name__ == u'__main__':
################################################################################################# #################################################################################################
elapsed = time.time() - start_time elapsed = time.time() - start_time
if globalDat.errorCount == 0 : if globalDat.errorCount == 0 :
log.info(f"{Colors.HEADER}=========================================================================================================") log.info(f"{Colors.HEADER}=========================================================================================================")
log.info(f"{Colors.HEADER}Execution completed without errors in {Colors.ENDC}{elapsed:.2f}{Colors.HEADER} s") log.info(f"{Colors.HEADER}Execution completed without errors in {Colors.ENDC}{elapsed:.2f}{Colors.HEADER} s")