Add Windows installer infrastructure with GitHub Actions workflow#56
Merged
Conversation
- Add Inno Setup script (setup.iss) for creating Windows installer - Add MSYS2 provisioning script for CI builds - Add Windows launcher batch file (StartOpenPLC.bat) - Add GitHub Actions workflow for automated installer builds - Workflow triggers on version tags and manual dispatch - Installer bundles pre-provisioned MSYS2 with GCC, Python, and dependencies - Per-user installation (no admin rights required) - Creates Start Menu shortcuts automatically Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
- Add is_msys2() function to detect MSYS2/MinGW/Cygwin environments - Skip root check on MSYS2 (not required/meaningful on Windows) - Add install_deps_msys2() function for pacman-based package installation - Handle runtime directory creation appropriately for MSYS2 - Update check_installation() message to not suggest sudo on MSYS2 Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
- Add environment marker to requirements.txt to skip psutil on cygwin platforms - Add conditional import with HAS_PSUTIL flag in runtimemanager.py - Gracefully degrade when psutil is not available: - find_running_process() returns None (cannot detect existing processes) - is_runtime_alive() and stop() handle subprocess.Popen only - Log informational message when psutil is not available Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
- Add conditional compilation for Linux-specific real-time features: - mlockall/MCL_CURRENT/MCL_FUTURE (memory locking) - sched_setscheduler/SCHED_FIFO (real-time scheduling) - clock_nanosleep with TIMER_ABSTIME (absolute time sleep) - Use HAS_REALTIME_FEATURES macro to detect platform support - Provide fallback implementations for MSYS2/Cygwin: - sleep_until() uses nanosleep with relative time calculation - set_realtime_priority() and lock_memory() log info message and return - Add -Wno-error=cpp flag on Cygwin/MSYS2 to handle _POSIX_C_SOURCE redefinition warning from Python headers Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
- Use CMAKE_SYSTEM_NAME MATCHES instead of CYGWIN/MSYS variables - Use -Wno-error to disable all warnings-as-errors on MSYS2/Cygwin - The -Werror=format-security is still applied after -Wno-error Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
- Add OPENPLC_CLOCK macro to use CLOCK_MONOTONIC on MSYS2/Cygwin (CLOCK_MONOTONIC_RAW is Linux-specific) - Use proper #ifdef blocks instead of CMake -Wno-error workaround - Change CMake from -Wno-error to -Wno-cpp to only suppress the _POSIX_C_SOURCE redefinition warning from Python headers Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
- Wrap Python.h includes with GCC diagnostic push/pop to suppress the _POSIX_C_SOURCE redefinition warning on MSYS2/Cygwin - Fix applied to python_plugin_bridge.h and plugin_driver.c - Remove CMake -Wno-cpp workaround since the fix is now in the code - This is more robust than CMake platform detection which was unreliable Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
- Use WIN32 AND UNIX detection which is more reliable than CMAKE_SYSTEM_NAME - WIN32 AND UNIX is true on MSYS2/Cygwin but not on native Windows or Linux - Keep GCC diagnostic pragmas in Python.h includes as additional safety - The -Wno-error flag comes after -Werror to properly override it Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
- Wrap priority inheritance mutex code with conditional compilation - Use __CYGWIN__ and __MSYS__ preprocessor definitions for detection - On MSYS2/Cygwin, use a regular mutex without priority inheritance - Priority inheritance is a Linux-specific feature not available on MSYS2 Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
- Patch ssl.SSLSocket.recv to handle EAGAIN/EWOULDBLOCK (errno 11) errors - On non-Linux platforms, return empty bytes instead of raising exception - This fixes 'Resource temporarily unavailable' error on MSYS2/Cygwin - Same fix as applied in OpenPLC_v3 commit 3ac3252 Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
- GitHub Actions workflow now uses install.sh instead of manual dependency installation - provision-msys2.sh now delegates to install.sh for consistent installation - This ensures all MSYS2-specific fixes in install.sh are used during CI builds Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Windows installer infrastructure with GitHub Actions workflow
Summary
This PR adds the infrastructure to build a Windows installer for OpenPLC Runtime v4 using MSYS2 and Inno Setup. The installer bundles a complete MSYS2 environment with GCC, Python, and all dependencies so users can run the runtime on Windows without installing additional software.
Key components added:
windows-installer.yml) - Triggers on version tags or manual dispatch, builds the installer and publishes to GitHub Releasessetup.iss) - Creates a per-user Windows installer (no admin rights required)StartOpenPLC.bat) - Starts the runtime inside the MSYS2 environmentprovision-msys2.sh) - Installs required packages during CI buildwindows/README.md) - Explains the build process and troubleshootingUpdates to core scripts for MSYS2 compatibility:
install.shandstart_openplc.shto detect MSYS2/MinGW/Cygwin environments usinguname -sinstall_deps_msys2()function for pacman-based package installation/run/runtimeinstead of/var/run/runtime)Python dependency changes:
psutiloptional inrequirements.txtusing environment marker (psutil; sys_platform != "cygwin") since psutil doesn't support MSYS2/Cygwinruntimemanager.pywhen psutil is unavailableC code portability fixes using
#ifdefblocks:core/src/plc_app/utils/utils.c:HAS_REALTIME_FEATURESmacro to detect Linux vs MSYS2/Cygwinmlockall()/MCL_CURRENT/MCL_FUTURE- disabled on MSYS2 (memory locking not available)sched_setscheduler()/SCHED_FIFO- disabled on MSYS2 (real-time scheduling not available)clock_nanosleep()withTIMER_ABSTIME- replaced withnanosleep()fallback on MSYS2core/src/plc_app/scan_cycle_manager.c:OPENPLC_CLOCKmacro - usesCLOCK_MONOTONICon MSYS2/Cygwin instead of Linux-specificCLOCK_MONOTONIC_RAWcore/src/CMakeLists.txt:-Wno-cppflag on MSYS2/Cygwin to suppress_POSIX_C_SOURCEredefinition warning from Python headersCMAKE_SYSTEM_NAME MATCHES "CYGWIN|MSYS"Review & Testing Checklist for Human
This PR has not been tested on Windows/MSYS2 - all changes were developed based on analysis and iterative feedback. The following items need verification:
build/directory and runcmake .. && make. Verify no errors frommlockall,CLOCK_MONOTONIC_RAW,sched_setscheduler, or_POSIX_C_SOURCEredefinitionCMAKE_SYSTEM_NAME MATCHES "CYGWIN|MSYS"actually triggers on MSYS2 (the-Wno-cppflag should appear in compile commands)./install.shand verify it detects MSYS2, skips root check, and completes successfullynanosleep/CLOCK_MONOTONICfallbacksRecommended test plan:
build/directory./install.shin MSYS2 terminal - verify compilation completes without errors./start_openplc.shand verify the webserver starts at https://localhost:8443Notes
is_msys2()shell detection usesuname -sto check for MSYS*/MINGW*/CYGWIN* patternsHAS_REALTIME_FEATURESandOPENPLC_CLOCKC macros use__CYGWIN__and__MSYS__preprocessor definitionssleep_until()fallback calculates relative sleep time from absolute target; may have slightly less precise timingStartOpenPLC.batonly handles C:, D:, E: drive letters for path conversionLink to Devin run: https://app.devin.ai/sessions/64ffd9e3ddb84cc08e3e414b5296e07d
Requested by: Thiago Alves (thiago.alves@autonomylogic.com) / @thiagoralves