ConservationInternational / cplus-plugin

QGIS plugin for using CPLUS framework in effective land-use planning
https://conservationinternational.github.io/cplus-plugin/
GNU General Public License v3.0
3 stars 6 forks source link

Investigation on Github actions tests runs on Windows and MacOS #51

Open Samweli opened 1 year ago

Samweli commented 1 year ago

We need to develop workflow that will enable running plugin tests on GitHub actions under Windows and macOS images, currently there are already known ways for one to use GitHub actions tests runs for QGIS plugins using linux based OS images.

This is part of efforts that will enable extensive plugin testing during development and deployment that will ensure plugin reliability during usage across multiple platforms.

See QGIS Animation Workbench and QGIS STAC Browser for examples on how to current run GitHub actions tests runs with QGIS images for the Ubuntu OS.

vermeulendivan commented 1 year ago

Info on all runners available for github actions, this includes ubuntu, windows and macOS: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners

Latest versions with links to build-in tools for each OS:

Samweli commented 1 year ago

Info on all runners available for github actions, this includes ubuntu, windows and macOS: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners

@vermeulendivan do you know if there are QGIS docker images supported in the mentioned runners?

vermeulendivan commented 1 year ago

@Samweli Tested Windows, getting error that OS not supported on this image: image Which is what you mentioned will likely happen.

For MacOS, it seems to be more complex. Docker is NOT installed on MacOS: https://github.com/orgs/community/discussions/25777 because of some licensing issues (more https://github.com/actions/runner-images/issues/17). Looking into working around this. Because macos is also unix-based, maybe the image will work here? I have no idea, have no knowledge of macos and have never used it before. The console commands seems to be the same!

Will add more info as I continue

vermeulendivan commented 1 year ago

More on why its not in macos: https://github.com/actions/runner-images/issues/2150.

image Same issue here, last post in comments section: https://github.com/docker/for-mac/issues/882

vermeulendivan commented 1 year ago

@Samweli After a learning some basics of docker, which helped, and a lot of struggle, I thought I want to give you feedback.

Here is how to set up qgis in a linux container: https://docs.qgis.org/3.28/en/docs/server_manual/containerized_deployment.html. But this is mostly useless for a Windows container as the console commands will be useless in windows.

Windows docker images: https://hub.docker.com/_/microsoft-windows-base-os-images

Just some info on Windows containers: https://learn.microsoft.com/en-us/virtualization/windowscontainers/ An example for .net core: https://learn.microsoft.com/en-us/virtualization/windowscontainers/quick-start/building-sample-app Dockerize Windows apps: https://blog.sixeyed.com/how-to-dockerize-windows-applications/ I have more links, but found those to be useful.

So I did get something working after with a Dockerfile. But it came with a lot of problems and difficulties and pre-requisites:

image

This needs to be run in Windows to activate Hyper-V: Enable-WindowsOptionalFeature -Online -FeatureName $("Microsoft-Hyper-V","Containers") -All

image

image

Oky, but that is only running the Windows image on its own, no Dockerfile yet. So lets get to that:

image