Skip to content

Cygwin support#17

Open
kenorb wants to merge 24 commits intoEA31337:dev--cygwin-supportfrom
nseam:dev--cygwin-support
Open

Cygwin support#17
kenorb wants to merge 24 commits intoEA31337:dev--cygwin-supportfrom
nseam:dev--cygwin-support

Conversation

@kenorb
Copy link
Member

@kenorb kenorb commented Mar 24, 2025

Summary by Sourcery

Adds support for Cygwin to the mt_runner role, allowing the execution of MetaTrader tests on Cygwin environments. This includes platform-specific configurations, path conversions, and command execution. Additionally, the pull request enhances report conversion capabilities and updates CI workflows for improved testing and reporting.

Enhancements:

  • Enhances report conversion capabilities by converting reports to CSV format (Orders, Deals, Optimization) and JSON format (Header).
  • Updates CI workflows to include screenshot capture and report conversion, improving debugging and reporting capabilities.
  • Refactors the task execution based on the platform (Unix, Cygwin, Windows) using conditional statements.
  • Improves the reliability of log monitoring by increasing the timeout for waiting for terminal logs.
  • Updates the installation of required tools in CI workflows, including x11-apps and imagemagick.
  • Updates the ansible configuration to use the built-in default callback with result_format instead of community.general.yaml

Tests:

  • Updates Molecule tests to include MT4 and MT5 scenarios.
  • Adds screenshot capture to CI workflows to aid in debugging test failures.
  • Updates CI workflows to convert test reports to markdown format for better readability.
  • Adds debug mode to CI workflows to enable verbose logging and tmate access for debugging.

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 24, 2025

Reviewer's Guide by Sourcery

This pull request introduces Cygwin support, refactors platform detection, enhances report parsing, and improves the GitHub Actions workflow for testing. It also updates Molecule configurations and dependencies.

Sequence diagram for running terminal on different platforms

sequenceDiagram
    participant Ansible
    participant Unix
    participant Cygwin
    participant Windows

    alt platform_name == "Unix"
        Ansible->>Unix: Runs terminal with mt_runner_mt_terminal_path
    else platform_name == "Cygwin"
        Ansible->>Cygwin: Runs terminal with mt_runner_mt_terminal_path
    else platform_name == "Windows"
        Ansible->>Windows: Runs terminal with mt_runner_mt_terminal_path
    end
Loading

Class diagram for MT5 report parsing

classDiagram
    class MT5Report {
        <<lookup_plugin>>
        +run(terms, variables)
        +main(input_file_path, output_file_path, include_titles, type, return_string)
        +extract_header_table(html_content)
        +extract_orders_table(html_content)
        +extract_deals_table(html_content)
        +write_to_csv(data, output_file, include_titles, type, return_string)
        +write_to_json(html_content, output_file, type, return_string)
        +write_opt(input_file, output_file, include_titles, return_string)
        +parse_period(value)
        +parse_val_prc(value)
        +parse_prc_val(value)
        +parse_val_of(value)
        +parse_val_diff(value)
        +parse_time(value)
        +convert_value(value)
    }

    note for MT5Report "This class represents the MT5 report parsing lookup plugin."
Loading

File-Level Changes

Change Details Files
Added Cygwin support to the Ansible role, allowing it to run on Cygwin environments in addition to Windows and Unix-based systems.
  • Added logic to detect Cygwin platform.
  • Modified tasks to run different commands based on the platform (Windows, Cygwin, Unix).
  • Added win_get_url module to support file downloads on Windows.
  • Modified the execution of terminal commands to account for differences between platforms.
tasks/main.yml
Refactored platform detection and path handling to support multiple operating systems.
  • Replaced ansible_os_family checks with platform_name and is_unix variables.
  • Introduced mt_runner_mt_path_host and mt_runner_mt_terminal_path_host variables for Windows and Cygwin.
  • Modified path conversion tasks to use winepath only on Unix systems.
  • Added a task to include paths.yml for path population.
tasks/main.yml
Enhanced report parsing and conversion to CSV format.
  • Added a new lookup plugin parse_mt_report.py to parse MT reports and convert them to CSV format.
  • Added tasks to convert report data (Orders, Deals, Header, Optimization) to CSV format using the new lookup plugin.
  • Installed the bs4 Python package to support HTML parsing.
  • Added logic to become root user when running report conversion tasks on Unix systems.
tasks/main.yml
lookup_plugins/parse_mt_report.py
Improved GitHub Actions workflow for testing and reporting.
  • Added a debug mode using tmate for interactive debugging.
  • Added a background screenshot loop to capture screenshots during testing.
  • Configured Ansible stdout callback and Molecule reporting.
  • Added steps to ensure report file permissions are correct and convert the test report to Markdown format.
.github/workflows/molecule.yml
Updated Molecule configurations and dependencies.
  • Enabled yamllint and ansible-lint in Molecule configurations.
  • Added wine_release: stable to group_vars in Molecule configurations.
  • Updated Python package requirements in requirements.txt and Pipfile.
  • Removed unused requirements.yml files.
  • Updated pre-commit action version in .github/workflows/check.yml.
molecule/mt4/molecule.yml
molecule/mt5-ea/molecule.yml
molecule/default/molecule.yml
requirements.yml
.devcontainer/requirements.txt
molecule/requirements.txt
.github/workflows/check.yml
Pipfile

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link

coderabbitai bot commented Mar 24, 2025

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Validation error: Unrecognized key(s) in object: 'version'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @kenorb, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request focuses on enhancing the project's compatibility with Cygwin and improving the overall development workflow. It includes changes to the .ansible.cfg file to adjust callback settings, updates the .devcontainer/devcontainer.json to add/reorder VS Code extensions and include pre-commit installation, modifies .devcontainer/requirements.txt to add new Python dependencies, introduces new .github files for Copilot instructions and code review guidelines, updates GitHub Actions workflows, adds .gitignore entries, introduces new linting configurations, and updates dependency management files (Pipfile, Pipfile.lock, requirements.yml). Additionally, the parse_mt_report.py lookup plugin is updated to handle different file encodings and improve data extraction, and the main Ansible task file is modified to handle path conversions and terminal execution based on the detected platform.

Highlights

  • Cygwin Support: The pull request adds support for Cygwin by adjusting path handling and terminal execution commands based on the detected platform.
  • Dependency Management: New Python dependencies like docker>=7.1, pipenv, and requests==2.31.0 are added to .devcontainer/requirements.txt and Pipfile to ensure all necessary tools are available.
  • Linting and Formatting: New linting configurations (.yamllint, .markdownlint.yaml) are introduced to enforce code quality and consistency.
  • GitHub Actions Workflow Improvements: The pull request enhances GitHub Actions workflows by adding screenshot capabilities, improving report generation, and enabling debugging with tmate on failure.
  • Code Review and Copilot Instructions: The pull request introduces .github/prompts/code-review.prompt.md and .github/copilot-instructions.md to improve code review quality and provide guidance for Copilot.
  • Lookup Plugin Enhancements: The parse_mt_report.py lookup plugin is updated to handle different file encodings (UTF-16LE) and improve data extraction from MT reports.

Changelog

Click here to see the changelog
  • .ansible.cfg
    • Changed stdout_callback to default and added callback_result_format = yaml.
  • .devcontainer/devcontainer.json
    • Reordered VS Code extensions and added github.vscode-github-actions.
    • Added pre-commit install to postCreateCommand to install pre-commit hooks.
  • .devcontainer/requirements.txt
    • Added docker>=7.1, pipenv, and requests==2.31.0 as dependencies.
  • .github/copilot-instructions.md
    • Added a new file with instructions for Copilot to assist with the project.
  • .github/prompts/code-review.prompt.md
    • Added a new file with guidelines for code review.
  • .github/workflows/check.yml
    • Updated pre-commit/action version to v3.0.1.
  • .github/workflows/molecule.yml
    • Added paths-ignore to pull_request and push triggers to ignore markdown and YAML files.
    • Added steps to install required tools (x11-apps, imagemagick) and start a background screenshot loop.
    • Modified ANSIBLE_STDOUT_CALLBACK based on runner.debug and added MOLECULE_REPORT environment variable.
    • Added steps to ensure report file permissions are correct and convert the test report to markdown.
    • Added conditional debugging with tmate on failure when debug logging is enabled.
  • .gitignore
    • Added *.html and *.png to ignore HTML reports and screenshots.
  • .markdownlint.yaml
    • Added a new file to configure Markdown linting rules, including line length and allowed HTML elements.
  • .yamllint
    • Added .cache to ignore list.
    • Added rules for comments, braces, line length, and octal values.
  • Pipfile
    • Added docker = ">=7.1", pipenv = "*", molecule = "*", molecule-docker = "*", and requests = "==2.31.0" as dependencies.
  • Pipfile.lock
    • Updated lock file with new dependencies and versions.
  • lookup_plugins/parse_mt_report.py
    • Added argparse import.
    • Handled UTF-16LE encoding for OPT reports.
    • Added a check for an empty table in OPT reports to avoid errors.
  • meta/main.yml
    • Updated the version of ea31337.metatrader dependency to v1.0.1.
  • meta/requirements.txt
    • Removed file.
  • molecule/default/converge.yml
    • Replaced mt_runner_mt_path with mt_runner_mt_path_host in mt_runner_get_url_list.
  • molecule/default/molecule.yml
    • Enabled yamllint and ansible-lint.
    • Added stdout_callback and result_format to config_options.defaults.
    • Added wine_release: stable to group_vars.all.
  • molecule/default/requirements.yml
    • Removed file.
  • molecule/mt4/molecule.yml
    • Enabled yamllint and ansible-lint.
    • Added stdout_callback and result_format to config_options.defaults.
    • Added wine_release: stable to group_vars.all.
  • molecule/mt4/requirements.yml
    • Removed file.
  • molecule/mt5-ea/molecule.yml
    • Enabled yamllint and ansible-lint.
    • Added stdout_callback and result_format to config_options.defaults.
    • Added wine_release: stable to group_vars.all.
  • molecule/mt5-ea/requirements.yml
    • Removed file.
  • molecule/requirements.txt
    • Replaced specific versions with version ranges and added pipenv.
  • requirements.yml
    • Added comment about apk module.
    • Changed src to git+https://github.com/EA31337/ansible-role-metatrader.git and updated version to v1.0.1.
  • tasks/main.yml
    • Added debug tasks for is_unix and platform_name.
    • Included paths.yml from ea31337.metatrader role.
    • Added conditional installation of winbind package based on is_unix.
    • Added conditional population of MT host paths based on platform_name.
    • Added conditional conversion of paths to wine paths based on is_unix.
    • Added /portable argument to terminal execution commands.
    • Added conditional execution of terminal based on platform (Unix, Cygwin, Windows).
    • Added conditional installation of bs4 Python package based on is_unix.
    • Made become conditional based on is_unix for copy tasks.
    • Changed destination of Header report to .json
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Did you know?

The name 'Cygwin' is a portmanteau of 'Cygnus' (the original name of Red Hat) and 'Windows'. It provides a Unix-like environment on Windows.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces Cygwin support, enhances report conversion, and updates CI workflows. The changes seem well-structured and address the intended enhancements. However, some areas require closer examination and potential adjustments to ensure robustness and maintainability.

Summary of Findings

  • Report Conversion Logic: The report conversion logic in parse_mt_report.py involves multiple steps of reading, parsing, and writing data. Ensure that error handling is comprehensive and that all edge cases are properly addressed to prevent data loss or corruption.
  • Conditional Task Execution: The refactoring of task execution based on the platform (Unix, Cygwin, Windows) using conditional statements could lead to increased complexity. Consider using more modular approaches, such as separate task files for each platform, to improve maintainability.
  • Screenshot Capture in CI: The screenshot capture loop in CI workflows commits and pushes changes, which might interfere with other CI processes. Evaluate the necessity of this approach and consider alternative methods for storing and accessing screenshots.

Merge Readiness

The pull request introduces significant enhancements and new features. While the changes are generally well-structured, addressing the identified issues related to report conversion, task execution, and CI workflows is crucial before merging. I am unable to approve this pull request, and recommend that it not be merged until the critical and high severity issues are addressed, and that others review and approve this code before merging.

- name: Clean-up before the test (non-Windows)
when: ansible_os_family != "Windows"
- name: Clean-up before the test (Unix)
when: is_unix and false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Why is this block disabled (and false)? If cleanup is needed, it should be enabled, or the block should be removed if it's no longer necessary.

  when: is_unix

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest a fix.

Comment on lines +322 to +323
if table is None:
return write_to_csv([["Pass", "Result", "Profit", "Expected Payoff", "Profit Factor", "Recovery Factor", "Sharpe Ratio", "Custom", "Equity DD %"], []], output_file, include_titles, "opt", return_string=return_string)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

What happens if the file is empty or corrupted? Should there be an explicit check for file validity before attempting to parse it?

Suggested change
if table is None:
return write_to_csv([["Pass", "Result", "Profit", "Expected Payoff", "Profit Factor", "Recovery Factor", "Sharpe Ratio", "Custom", "Equity DD %"], []], output_file, include_titles, "opt", return_string=return_string)
if not os.path.exists(input_file) or os.path.getsize(input_file) == 0:
return write_to_csv([["Pass", "Result", "Profit", "Expected Payoff", "Profit Factor", "Recovery Factor", "Sharpe Ratio", "Custom", "Equity DD %"], []], output_file, include_titles, "opt", return_string=return_string)
if table is None:

Comment on lines 111 to +112
loop: "{{ mt_runner_get_url_list }}"
when: is_unix or platform_name == "Cygwin"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider adding error handling to the get_url task to handle cases where the URL is unreachable or the file download fails. This could prevent the role from failing silently.

      ansible.builtin.get_url:
        dest: "{{ item.dest }}"
        mode: "{{ item.mode | default('u=rw,g=r') }}"
        url: "{{ item.url }}"
      rescue:
        - name: "Handle get_url failure"
          ansible.builtin.debug:
            msg: "Failed to download {{ item.url }} to {{ item.dest }}"

- "{{ mt_runner_mt_terminal_path }}"
- "{{ '/config:tester.ini' if (mt_runner_mt_version | int) == 5 else 'tester.ini' }}"
args:
chdir: '{{ mt_runner_mt_path_host }}'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

What is the purpose of this task? It seems to be ensuring that the bs4 Python package is installed, but it's being done after the report conversion tasks. It should be done before, to ensure that the parse_mt_report lookup plugin can use it.

Comment on lines +173 to 177
- set_fact: cmd_terminal_async="{{cmd_terminal_async_result}}"
when: (cmd_terminal_async_result is defined) and (cmd_terminal_async_result.ansible_job_id is defined)

- name: Check for terminal log
block:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider adding a rescue block to handle potential errors during the report conversion process. This could involve logging the error and/or attempting to retry the conversion.

  ansible.builtin.copy:
    content: |
      {{ lookup('parse_mt_report', mt_runner_mt_path ~ '/' ~ mt_runner_bt_mt5_config.Tester.Report, 'orders', True) }}
    dest: >-
      {{ mt_runner_mt_path }}/{{ mt_runner_bt_mt5_config.Tester.Report }}-Orders.csv
    mode: '0644'
  rescue:
    - name: "Handle copy failure"
      ansible.builtin.debug:
        msg: "Failed to convert report to CSV (Orders)"

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We encountered an error and are unable to review this PR. We have been notified and are working to fix it.

You can try again by commenting this pull request with @sourcery-ai review, or contact us for help.

@kenorb kenorb requested a review from Copilot January 4, 2026 21:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds comprehensive Cygwin support to the mt_runner Ansible role, enabling MetaTrader tests to run on Cygwin environments alongside existing Unix and Windows support. The changes introduce platform-specific task execution, enhanced report conversion capabilities, and improved CI workflows for debugging.

Key Changes:

  • Platform-conditional task execution for Unix, Cygwin, and Windows environments with appropriate path handling
  • New Python lookup plugin for converting MT reports to CSV and JSON formats
  • Enhanced CI workflows with debugging capabilities and screenshot capture features

Reviewed changes

Copilot reviewed 23 out of 25 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
tasks/main.yml Refactored to support three platforms (Unix, Cygwin, Windows) with conditional task execution, path conversion logic, and new report conversion tasks
lookup_plugins/parse_mt_report.py New Python plugin for parsing MT HTML reports and converting them to CSV/JSON formats
requirements.yml Updated metatrader role dependency version and Git URL format
molecule/requirements.txt Updated Docker version requirement and added pipenv and requests dependencies
molecule/*/molecule.yml Standardized Ansible callback configuration across all test scenarios
molecule/*/requirements.yml Removed redundant role dependencies (now centralized)
molecule/default/converge.yml Updated path variable to use host-specific path variant
Pipfile & Pipfile.lock Added for Python dependency management with specific version pins
.github/workflows/molecule.yml Enhanced with debug mode, screenshot capture loop, and report conversion
.github/workflows/check.yml Updated pre-commit action version
.github/prompts/code-review.prompt.md New code review guidelines for the Ansible role
.github/copilot-instructions.md New Copilot configuration with project-specific guidelines
.devcontainer/* Updated requirements and configuration for development environment
.markdownlint.yaml New markdown linting configuration
.gitignore Added HTML files to ignore list

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ToDate: 2024.01.11
mt_runner_get_url_list:
- dest: "{{ mt_runner_mt_path }}/MQL5/Experts"
- dest: "{{ mt_runner_mt_path_host }}/MQL5/Experts"
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path formatting is inconsistent. Line 28 uses 'mt_runner_mt_path_host' while line 29 in the original code uses 'mt_runner_mt_path'. For Cygwin and Windows platforms, these should both use the host path variant to ensure consistency. Consider whether this variable name change is intentional and correctly reflects the platform requirements.

Copilot uses AI. Check for mistakes.
Comment on lines +156 to +157
- set_fact: cmd_terminal_async="{{cmd_terminal_async_result}}"
when: (cmd_terminal_async_result is defined) and (cmd_terminal_async_result.ansible_job_id is defined)
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing module name before 'set_fact'. Ansible task declarations must include the module name. This should be 'ansible.builtin.set_fact:' instead of just 'set_fact:'.

Copilot uses AI. Check for mistakes.
Comment on lines +173 to +174
- set_fact: cmd_terminal_async="{{cmd_terminal_async_result}}"
when: (cmd_terminal_async_result is defined) and (cmd_terminal_async_result.ansible_job_id is defined)
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing module name before 'set_fact'. Ansible task declarations must include the module name. This should be 'ansible.builtin.set_fact:' instead of just 'set_fact:'.

Copilot uses AI. Check for mistakes.
Comment on lines +72 to +73
- name: Clean-up before the test (Unix)
when: is_unix and false
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Clean-up block has been disabled with 'when: is_unix and false', which means it will never execute. This appears to be debug code that should either be removed or have a proper condition. Dead code should not be committed to the codebase.

Copilot uses AI. Check for mistakes.
become: "{{ is_unix | bool }}"
become_user: root

- name: Converts report to CSV (Header)
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The task name is misleading. The comment says "Converts report to CSV (Header)" but the output file is saved as JSON format (.json extension) and the function write_to_json is being used. The task name should be "Converts report to JSON (Header)" to accurately reflect what it does.

Suggested change
- name: Converts report to CSV (Header)
- name: Converts report to JSON (Header)

Copilot uses AI. Check for mistakes.
Comment on lines +139 to +140
- set_fact: cmd_terminal_async="{{cmd_terminal_async_result}}"
when: (cmd_terminal_async_result is defined) and (cmd_terminal_async_result.ansible_job_id is defined)
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing module name before 'set_fact'. Ansible task declarations must include the module name. This should be 'ansible.builtin.set_fact:' instead of just 'set_fact:'.

Copilot uses AI. Check for mistakes.
ansible.windows.win_command:
argv:
- "{{ mt_runner_cmd_prefix }}"
- "{{ mt_runner_mt_terminal_path }}"
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Windows terminal execution is missing the '/portable' flag that is present in both Unix and Cygwin versions. This inconsistency could lead to different behavior across platforms. If this is intentional, it should be documented; otherwise, the flag should be added for consistency.

Suggested change
- "{{ mt_runner_mt_terminal_path }}"
- "{{ mt_runner_mt_terminal_path }}"
- '/portable'

Copilot uses AI. Check for mistakes.
Comment on lines +40 to +61
- name: Start background screenshot loop
run: |
cd $GITHUB_WORKSPACE
mkdir -p screenshots
echo "Starting screenshot loop..."
while true; do
sleep 120
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
SCREENSHOT_FILE="screenshots/latest_screenshot.png"

# Take screenshot
DISPLAY=:0 xwd -root -out temp_screenshot.xwd || true
convert temp_screenshot.xwd "$SCREENSHOT_FILE" || true
rm temp_screenshot.xwd || true

if [ -f "$SCREENSHOT_FILE" ]; then
# Commit latest screenshot with amend
git add "$SCREENSHOT_FILE"
git commit --amend -m "Update latest screenshot taken at $TIMESTAMP"
git push --force-with-lease
fi
done &
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The background screenshot loop has several issues: 1) It uses git operations (add, commit, push) within CI that could fail or cause conflicts. 2) Using --force-with-lease can overwrite other changes. 3) The loop runs indefinitely without proper cleanup. 4) This approach is unconventional for CI debugging. Consider using CI artifacts instead of git commits for screenshots.

Copilot uses AI. Check for mistakes.
- mt4
- mt5-ea
steps:
- name: Debug with tmate
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tmate debug action is configured to run at the start of every job with 'detached: true', which means debugging will always be enabled. This should be conditional (e.g., only when runner.debug == '1' or on failure) to avoid leaving debug sessions open unnecessarily and potentially exposing the CI environment.

Suggested change
- name: Debug with tmate
- name: Debug with tmate
if: ${{ runner.debug == '1' }}

Copilot uses AI. Check for mistakes.
return write_to_csv([columns, data], output_file, include_titles, "opt", return_string=return_string)

def main(input_file_path, output_file_path, include_titles = False, type = None, return_string=False):
if type == None:
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing for None should use the 'is' operator.

Suggested change
if type == None:
if type is None:

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants