-
Notifications
You must be signed in to change notification settings - Fork 3
Cygwin support #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev--cygwin-support
Are you sure you want to change the base?
Cygwin support #17
Changes from all commits
30ee4f7
cef7037
22a79ea
f0b5218
f17b975
5d07ed3
4ce0f15
e13a7a6
865c5fe
646f3d2
f9195ed
b9fe519
43cd798
9d2e3b7
4e5bb47
edf8ee8
1fe86e4
c2cff72
fd81463
4f11b5a
c34606c
bd42334
347fcef
f49a898
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,10 @@ | ||
| # Python's requirements | ||
| # Usage: pip install -r requirements.txt | ||
| ansible | ||
| ansible-lint | ||
| docker>=7.1 | ||
| molecule | ||
| molecule-docker | ||
| pipenv | ||
| pre-commit | ||
| requests==2.31.0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # Copilot Instructions for ansible-role-mt-runner | ||
|
|
||
| You are expected to be an expert in: | ||
|
|
||
| - Ansible | ||
| - Python | ||
| - Jinja2 | ||
| - Molecule | ||
| - Linux (Alpine, Debian/Ubuntu, Nix) | ||
| - YAML | ||
|
|
||
| ## Code Standards | ||
|
|
||
| - Avoid writing trailing whitespace | ||
| - Follow PEP 8 for Python. | ||
| - Include docstrings and type hints where applicable | ||
| - Maintain consistent YAML indentation | ||
| - Optimize for readability first, performance second | ||
| - Prefer modular, DRY approaches and list comprehensions when appropriate | ||
| - Use environment variables for configuration, never hardcode sensitive info | ||
| - Write clean, documented, error-handling code with appropriate logging | ||
|
|
||
| ## General Approach | ||
|
|
||
| - Be accurate, thorough and terse | ||
| - Cite sources at the end, not inline | ||
| - Provide immediate answers with clear explanations | ||
| - Skip repetitive code in responses; use brief snippets showing only changes | ||
| - Suggest alternative solutions beyond conventional approaches | ||
| - Treat the user as an expert | ||
|
|
||
| ## Ansible Guidelines | ||
|
|
||
| - Ensure idempotency in all tasks | ||
| - Ensure indentation is correct, especially for arguments used for ansible modules. | ||
| - Follow standard role structure: tasks/, handlers/, templates/, defaults/, meta/ | ||
| - Use ansible-lint and write Molecule tests for verification | ||
| - Use descriptive task names and include helpful comments | ||
|
|
||
| ## YAML Guidelines | ||
|
|
||
| Ensure the following rules are strictly followed: | ||
|
|
||
| - yaml[indentation]: Avoid wrong indentation | ||
| - yaml[line-length]: No long lines (max. 120 characters) | ||
| - yaml[truthy]: Truthy value should be one of [false, true] | ||
| - When writing inline code, add a new line at the end to maintain proper indentation | ||
|
|
||
| ## Project Specifics | ||
|
|
||
| This role installs and runs trading platform with distribution-specific approaches: | ||
|
|
||
| - **Alpine Linux**: Uses apk package manager | ||
| - **Debian/Ubuntu**: Uses apt package manager | ||
| - **Nix**: Uses nix-env in lightweight Nix environments | ||
|
|
||
| Notes: | ||
|
|
||
| - Project utilizes Codespaces with config file at .devcontainer/devcontainer.json | ||
| and requirements at .devcontainer/requirements.txt | ||
| - GitHub Actions are used to validate the code by running | ||
| pre-commit checks (see .pre-commit-config.yaml file) and Molecule (molecule/). | ||
| - Service management uses supervisord across platforms. | ||
| - Formatting rules are defined in .yamllint (YAML) and .markdownlint.yaml (Markdown) files. | ||
|
|
||
| ### Key Variables | ||
|
|
||
| Variables are defined in defaults/main.yml and vars/main.yml files. | ||
|
|
||
| Notes: | ||
|
|
||
| - On variable changes, update main.yml and README.md files accordingly. | ||
|
|
||
| ### Testing Approach | ||
|
|
||
| - Use Molecule with Docker driver |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| # Ansible Role Code Review Guidelines | ||
|
|
||
| Your goal is to review Ansible role code | ||
| to ensure it meets high-quality standards and follows best practices. | ||
|
|
||
| ## Ensure Code Quality | ||
|
|
||
| - Follow PEP 8 for Python. | ||
| - Maintain consistent YAML indentation. | ||
| - Optimize for readability first, performance second. | ||
| - Ensure idempotency in all Ansible tasks. | ||
| - Use environment variables for configuration, never hardcode sensitive info. | ||
| - Write clean, documented, error-handling code with appropriate logging. | ||
|
|
||
| ## Check for Linting and Formatting | ||
|
|
||
| - Ensure YAML files adhere to [.yamllint](../../.yamllint) rules. | ||
| - Ensure Markdown files adhere to [.markdownlint.yaml](../../.markdownlint.yaml) rules. | ||
| - Ensure Ansible playbooks and roles pass `ansible-lint`. | ||
|
|
||
| ## Review Ansible Role Structure | ||
|
|
||
| - Follow standard role structure: | ||
|
|
||
| - [tasks/](../../tasks/) | ||
| - [handlers/](../../handlers/) | ||
| - [templates/](../../templates/) | ||
| - [defaults/](../../defaults/) | ||
| - [meta/](../../meta/) | ||
|
|
||
| - Use descriptive task names and include helpful comments. | ||
| - Ensure indentation is correct, especially for arguments used for Ansible modules. | ||
|
|
||
| ## Verify Variables and Defaults | ||
|
|
||
| - Ensure variables are defined in | ||
| [defaults/main.yml](../../defaults/main.yml) and [vars/main.yml](../../vars/main.yml). | ||
| - Update [README.md](../../README.md) with any changes to variables. | ||
| - Ensure variables are used consistently across tasks and playbooks. | ||
|
|
||
| ## Check for Idempotency | ||
|
|
||
| - Ensure all tasks are idempotent and do not cause unnecessary changes on repeated runs. | ||
|
|
||
| ## Review Molecule Tests | ||
|
|
||
| - Ensure Molecule scenarios are defined and cover all supported platforms. | ||
| - Verify that Molecule tests are comprehensive and validate the role's functionality. | ||
| - Check [molecule/](../../molecule/) directory for test configurations. | ||
|
|
||
| ## Ensure Proper Error Handling | ||
|
|
||
| - Write error-handling code with appropriate logging. | ||
| - Ensure tasks fail gracefully and provide meaningful error messages. | ||
|
|
||
| ## Check for Dependencies | ||
|
|
||
| - Ensure all dependencies are listed in | ||
| [.devcontainer/requirements.txt](../../.devcontainer/requirements.txt) and [requirements.yml](../../requirements.yml). | ||
| - Verify that the role does not have any missing dependencies. | ||
|
|
||
| ## Review GitHub Actions | ||
|
|
||
| - Ensure GitHub Actions workflows are correctly configured to run pre-commit checks and Molecule tests. | ||
| - Verify that the workflows cover all necessary validation steps. | ||
| - Check [.github/workflows/](../) directory for workflow configurations. | ||
|
|
||
| ## Documentation | ||
|
|
||
| - Ensure the [README.md](../../README.md) file is up-to-date | ||
| and provides clear instructions for installation, usage, and variables. | ||
| - Include any additional documentation as needed for clarity. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,10 +4,19 @@ name: Molecule | |
| # yamllint disable-line rule:truthy | ||
| on: | ||
| pull_request: | ||
| paths-ignore: | ||
| - '**.md' | ||
| - '*.yaml' | ||
| - Pipfile* | ||
| push: | ||
| paths-ignore: | ||
| - '**.md' | ||
| - '*.yaml' | ||
| - Pipfile* | ||
|
|
||
| jobs: | ||
| Test: | ||
| test: | ||
| name: Test | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
|
|
@@ -17,22 +26,62 @@ jobs: | |
| - mt4 | ||
| - mt5-ea | ||
| steps: | ||
| - name: Debug with tmate | ||
| uses: mxschmitt/action-tmate@v3 | ||
| with: | ||
| detached: true | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| path: "${{ github.repository }}" | ||
| path: ${{ github.repository }} | ||
| - name: Install required tools | ||
| run: | | ||
| sudo apt update | ||
| sudo apt install -y x11-apps imagemagick | ||
| - 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 & | ||
|
Comment on lines
+40
to
+61
|
||
| - uses: gofrolist/molecule-action@v2 | ||
| env: | ||
| ANSIBLE_FORCE_COLOR: '1' | ||
| ANSIBLE_STDOUT_CALLBACK: yaml | ||
| MT_RUNNER_MT4_LOGIN: ${{ secrets.MT_RUNNER_MT4_LOGIN || '12345' }} | ||
| ANSIBLE_STDOUT_CALLBACK: ${{ runner.debug == '1' && 'debug' || 'oneline' }} | ||
| MOLECULE_REPORT: molecule-${{ matrix.scenario }}-report.html | ||
| MT_RUNNER_MT4_PASSWORD: ${{ secrets.MT_RUNNER_MT4_PASSWORD || 'SETME' }} | ||
| MT_RUNNER_MT5_LOGIN: ${{ secrets.MT_RUNNER_MT5_LOGIN || '12345' }} | ||
| MT_RUNNER_MT5_PASSWORD: ${{ secrets.MT_RUNNER_MT5_PASSWORD || 'SETME' }} | ||
| with: | ||
| molecule_args: --scenario-name ${{ matrix.scenario }} | ||
| molecule_command: test | ||
| molecule_options: --verbose | ||
| molecule_working_dir: "${{ github.repository }}" | ||
| - if: ${{ failure() }} | ||
| molecule_options: ${{ runner.debug == '1' && '--verbose' || '' }} | ||
| molecule_working_dir: ${{ github.repository }} | ||
| - if: always() | ||
| name: Ensure report file permissions are correct | ||
| run: sudo chmod 644 molecule-${{ matrix.scenario }}-report.html | ||
| working-directory: ${{ github.repository }} | ||
| - if: always() | ||
| name: Converts test report | ||
| uses: patrick-werner/fhir-html-validation-to-markdown@1.0.0 | ||
| with: | ||
| input_file: ${{ github.repository }}/molecule-${{ matrix.scenario }}-report.html | ||
| # Debug with tmate on failure when debug logging is enabled. | ||
| - if: ${{ failure() && runner.debug == '1' }} | ||
| uses: mxschmitt/action-tmate@v3 | ||
| timeout-minutes: 20 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| *.html | ||
| *.png | ||
| .ansible | ||
| .cache | ||
| __pycache__ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| # MD013 line-length - Line length | ||
| MD013: | ||
| line_length: 120 | ||
| # MD033 no-inline-html - Inline HTML | ||
| MD033: | ||
| allowed_elements: [details] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| [[source]] | ||
| url = "https://pypi.org/simple" | ||
| verify_ssl = true | ||
| name = "pypi" | ||
|
|
||
| [packages] | ||
| docker = ">=7.1" | ||
| pipenv = "*" | ||
| molecule = "*" | ||
| molecule-docker = "*" | ||
| requests = "==2.31.0" | ||
|
|
||
| [dev-packages] | ||
|
|
||
| [requires] | ||
| python_version = "3.10" |
There was a problem hiding this comment.
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.