Skip to content

UI: switch to pg services (#325) #215

UI: switch to pg services (#325)

UI: switch to pg services (#325) #215

name: "Build 📦 and release 🚀"
# Triggers
on:
push:
branches:
- master
paths:
- ".github/workflows/builder_releaser.yml"
- "builder/**/*"
- "dicogis/**/*.py"
- "requirements/packaging.txt"
tags:
- "*"
pull_request:
branches:
- master
paths:
- ".github/workflows/builder_releaser.yml"
- "builder/"
- "requirements/packaging.txt"
# Globals
env:
PROJECT_FOLDER: "dicogis"
PYTHON_VERSION: "3.10"
PYINSTALLER_LOG_LEVEL: "DEBUG"
USE_PATH_FOR_GDAL_PYTHON: yes
# Jobs definition
jobs:
build-ubuntu:
name: "🐧 Ubuntu LTS"
runs-on: ubuntu-22.04
env:
export_output_folder: tests/ci/ubuntu
GDAL_VERSION: 3.8.*
steps:
- name: Get source code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
cache-dependency-path: "requirements/*.txt"
- name: Install GDAL binaries
run: |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable && sudo apt-get update
sudo apt install gdal-bin=${{ env.GDAL_VERSION }}
sudo apt install libgdal-dev=${{ env.GDAL_VERSION }}
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
gdal-config --version
- name: Install complementary tools
run: |
sudo apt install python3-tk
- name: Install project requirements
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/base.txt
python -m pip install gdal=="`gdal-config --version`.*"
python -m pip install -e .[gdal]
python -m pip install -U -r requirements/packaging.txt
- name: Generates executable for command-line version
run: |
python -O ./builder/pyinstaller_build_ubuntu_cli.py
chmod +x dist/DicoGIS-cli.bin
- name: Save CLI binary as artifact
uses: actions/upload-artifact@v4
with:
name: DicoGIS_executable_ubuntu_CLI
path: dist/DicoGIS-cli.bin
if-no-files-found: error
- name: Generates executable for graphical version
run: |
python -O ./builder/pyinstaller_build_ubuntu_gui.py
chmod +x dist/DicoGIS-gui.bin
- name: Save it as artifact
uses: actions/upload-artifact@v4
with:
name: DicoGIS_executable_ubuntu_GUI
path: dist/DicoGIS-gui.bin
if-no-files-found: error
- name: Install tests fixtures
run: python -m pip install -U gisdata -t ./tests/fixtures
- name: Get QGIS training data
uses: actions/checkout@v4
with:
repository: qgis/QGIS-Training-Data
path: tests/fixtures/qgisdata
- name: Minimal integration test - help
run: ./dist/DicoGIS-cli.bin --help
- name: Minimal integration test - version
run: ./dist/DicoGIS-cli.bin --version
- name: Minimal integration test - export xlsx
run: ./dist/DicoGIS-cli.bin inventory --input-folder ./tests/ --language EN --output-path "${{ env.export_output_folder }}"/ubuntu/dicogis_ubuntu_build_tests.xlsx --verbose
- name: Minimal integration test - export xlsx
run: ./dist/DicoGIS-cli.bin inventory --input-folder ./tests/ --language EN --output-format json --output-path "${{ env.export_output_folder }}" --verbose
- name: Save generated files as artifact
uses: actions/upload-artifact@v4
with:
name: ubuntu_dicogis_integration_tests
path: ${{ env.export_output_folder }}/*
if-no-files-found: error
build-windows:
name: "🏠 Windows"
runs-on: windows-latest
env:
export_output_folder: tests/ci/windows
GDAL_VERSION: 3.8.4
steps:
- name: Get source code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
cache-dependency-path: "requirements/*.txt"
- name: Install project requirements
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/base.txt
python -m pip install -U https://github.com/cgohlke/geospatial-wheels/releases/download/v2024.2.18/GDAL-3.8.4-cp310-cp310-win_amd64.whl
python -m pip install -U -r requirements/packaging.txt
- name: Install project as a package
run: python -m pip install -e .[gdal]
- name: Generates MS Version Info
run: python .\builder\version_info_templater.py
- name: Generates executable for command-line version
run: |
python -O ./builder/pyinstaller_build_windows_cli.py
- name: Save CLI binary as artifact
uses: actions/upload-artifact@v4
with:
name: DicoGIS_executable_windows_CLI
path: dist/DicoGIS-cli.exe
if-no-files-found: error
- name: Generates executable for graphical version
run: |
python -O ./builder/pyinstaller_build_windows_gui.py
- name: Save it as artifact
uses: actions/upload-artifact@v4
with:
name: DicoGIS_executable_windows_GUI
path: dist/DicoGIS-gui.exe
if-no-files-found: error
- name: Install tests fixtures
run: python -m pip install -U gisdata -t ./tests/fixtures
- name: Get QGIS training data
uses: actions/checkout@v4
with:
repository: qgis/QGIS-Training-Data
path: tests/fixtures/qgisdata
- name: Minimal integration test
run: |
./dist/DicoGIS-cli.exe --help
./dist/DicoGIS-cli.exe --version
./dist/DicoGIS-cli.exe inventory --input-folder ./tests/ --language EN --output-path "${{ env.export_output_folder }}/dicogis_windows_build_tests.xlsx" --verbose
./dist/DicoGIS-cli.exe inventory --input-folder ./tests/ --language EN --output-format json --output-path "${{ env.export_output_folder }}" --verbose
- name: Save generated files as artifact
uses: actions/upload-artifact@v4
with:
name: windows_dicogis_integration_tests
path: ${{ env.export_output_folder }}/*
if-no-files-found: error
release:
name: "🚀 GitHub Release"
runs-on: ubuntu-latest
needs:
- build-ubuntu
- build-windows
permissions:
contents: write
discussions: write
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download built package for Linux (Ubuntu) - GUI
uses: actions/download-artifact@v4
with:
name: DicoGIS_executable_ubuntu_GUI
path: builds/ubuntu/gui/
- name: Download built package for Linux (Ubuntu) - CLI
uses: actions/download-artifact@v4
with:
name: DicoGIS_executable_ubuntu_CLI
path: builds/ubuntu/cli/
- name: Download built package for Windows - GUI
uses: actions/download-artifact@v4
with:
name: DicoGIS_executable_windows_GUI
path: builds/windows/gui/
- name: Download built package for Windows - CLI
uses: actions/download-artifact@v4
with:
name: DicoGIS_executable_windows_CLI
path: builds/windows/cli/
- name: Release
uses: softprops/action-gh-release@v2
with:
discussion_category_name: announcements
fail_on_unmatched_files: true
files: |
builds/ubuntu/cli/*.bin
builds/ubuntu/gui/*.bin
builds/windows/cli/*.exe
builds/windows/gui/*.exe
generate_release_notes: true