Skip to content

Install kadas libraries #787

Install kadas libraries

Install kadas libraries #787

Workflow file for this run

---
name: πŸͺŸ Build - Windows
on:
push:
branches:
- main
pull_request:
release:
types: ['published']
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: build (windows)
runs-on: windows-2019
steps:
- name: 🐣 Checkout
uses: actions/checkout@v4
- name: 🐩 Install CMake and Ninja
uses: lukka/get-cmake@latest
with:
# Pin to specific version to avoid rebuilding too often
# Also helps to avoid spurious build failures like https://github.com/qgis/QGIS/pull/47098
cmakeVersion: 3.29.0
- name: 🧽 Developer Command Prompt for Microsoft Visual C++
uses: ilammy/msvc-dev-cmd@v1
- name: πŸ“¦ Prepare msi
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
shell: bash
run: |
echo "CREATE_MSI_CMAKE_VAR=-D CREATE_MSI=ON" >> $GITHUB_ENV
- name: 🌱 Install dependencies and generate project files
shell: bash
run: |
RELEASE=$(curl -s "https://api.github.com/repos/kadas-albireo/kadas-albireo2/tags" | jq -r '.[0].name')
MAJOR=$(echo ${RELEASE:1} | cut -d. -f1)
MINOR=$(echo ${RELEASE} | cut -d. -f2)
PATCH=$(echo ${RELEASE} | cut -d. -f3 | cut -d- -f1)
PRE=$(echo ${RELEASE} | cut -s -d- -f2)
if [[ -n "${{ github.event.pull_request.number }}" ]]; then
PRE="${PRE}-PR${{ github.event.pull_request.number }}"
fi
echo "KADAS Version: v${MAJOR}.${MINOR}.${PATCH}-${PRE}"
cmake -S . \
-G Ninja \
-B build \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX="C:\kadas" \
-D WITH_BINDINGS=ON \
-D INSTALL_DEMO_DATA=ON \
-D VCPKG_TARGET_TRIPLET="x64-windows" \
-D VCPKG_INSTALL_OPTIONS="--x-buildtrees-root=C:/src" \
-D SIP_BUILD_EXECUTABLE="$(pwd)\build\vcpkg_installed\x64-windows\tools\python3\Scripts\sip-build.exe" \
-D QGIS_PYTHON_MODULE_DIR="$(pwd)\build\vcpkg_installed\x64-windows\tools\python3\Lib\site-packages\qgis" \
-D CPACK_PACKAGE_FILE_NAME="kadas-win64-$(date +'%Y-%m-%d_%H%M')" \
-D NUGET_USERNAME=kadas-albireo \
-D NUGET_TOKEN=${{ secrets.GITHUB_TOKEN }} \
-D KADAS_VERSION_MAJOR=${MAJOR} \
-D KADAS_VERSION_MINOR=${MINOR} \
-D KADAS_VERSION_PATCH=${PATCH} \
-D KADAS_VERSION_PRE=${PRE} \
${CREATE_MSI_CMAKE_VAR}
- name: πŸ“‘ Upload vcpkg build logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: build-logs-x64-windows
path: |
C:/src/**/*.log
- name: πŸ“¦ Create SDK
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
run: |
./build/_deps/vcpkg-src/vcpkg.exe export --zip --output-dir=./sdk --x-install-root=build/vcpkg_installed --x-manifest-root=vcpkg
- name: πŸ“€ Upload sdk
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
uses: actions/upload-artifact@v4
with:
name: kadas-albireo2-sdk-x64-windows
path: |
sdk/vcpkg-export-*.zip
- name: Compile plugins translation
shell: bash
run: |
# lrelease is run from cmake for app
# plugins need to be handled
export PATH="${{ github.workspace }}\build\vcpkg_installed\x64-windows\tools\qt5\bin:${PATH}"
for PLUGIN in about gpkg print; do
lrelease share/python/plugins/kadas_${PLUGIN}/kadas_${PLUGIN}_ts.pro
done
- name: πŸŒ‹ Build
run: |
cmake --build build --config Release
- name: πŸ“¦ Package
run: |
cmake --build build --target bundle --config Release
- name: πŸ“€ Upload portable
uses: actions/upload-artifact@v4
with:
name: kadas-albireo2-portable
path: |
build/kadas-*.zip
- name: πŸ“€ Upload msi
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
uses: actions/upload-artifact@v4
with:
name: kadas-albireo2-msi
path: |
build/kadas-win64-*.msi
# A preliminary smoke test to determine basic functional python
# To be replaced with something proper when testing lands
- name: 🚭 PySmokeTest
shell: bash
env:
PYTHONPATH: build/output/python/
run: |
set -e
$(./build/vcpkg_installed/x64-windows/tools/python3/python.exe <<EOF
import os
os.add_dll_directory(os.getcwd() + '/build/output/bin')
from kadas.kadasgui import *
from kadas.kadascore import *
from kadas.kadasanalysis import *
EOF
)
- name: Upload release assets
uses: softprops/action-gh-release@v2
if: ${{ github.event_name == 'release' }}
with:
files: |
build/kadas-*.zip
build/kadas-*.msi