Skip to content

Commit

Permalink
Merge pull request #234 from EA31337/dev
Browse files Browse the repository at this point in the history
EA Tester refactor
  • Loading branch information
kenorb authored Sep 7, 2024
2 parents de3839b + 0dc9e73 commit e1bf19d
Show file tree
Hide file tree
Showing 29 changed files with 317 additions and 372 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
Pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ hashFiles('.pre-commit-config.yaml') }}
Expand Down
38 changes: 33 additions & 5 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,45 @@ on:
push:
branches:
- 'master'
- 'ci'
- '*dev*'
paths:
- '**/*.mq?'
- '.github/workflows/compile.yml'

jobs:
Compile:
runs-on: windows-latest
Compile-MT4:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: fx31337/mql-compile-action@master
- uses: actions/checkout@v4
- name: Installs platform
uses: dawidd6/action-ansible-playbook@v2
with:
playbook: install-mt4.yml
directory: ./ansible
options: |
--connection local
--inventory localhost,
--verbose
requirements: galaxy-requirements.yml
- uses: fx31337/mql-compile-action@dev
with:
mt-path: ${{ github.workspace }}/../../../.wine/drive_c
verbose: true
Compile-MT5:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Installs platform
uses: dawidd6/action-ansible-playbook@v2
with:
playbook: install-mt5.yml
directory: ./ansible
options: |
--connection local
--inventory localhost,
--verbose
requirements: galaxy-requirements.yml
- uses: fx31337/mql-compile-action@dev
with:
mt-path: ${{ github.workspace }}/../../../.wine/drive_c
verbose: true
13 changes: 4 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ on:
- '**/*.md'
- '**/*.txt'
- '.*'
- '.github/**'
# Sequence of patterns matched against refs/tags.
tags:
- 'v1.*'
Expand All @@ -27,31 +28,25 @@ jobs:
Hadolint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: brpaz/hadolint-action@master
with:
dockerfile: Dockerfile
Docker:
runs-on: ubuntu-latest
needs: Hadolint
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build ubuntu-base
run: docker build --target ubuntu-base -t ubuntu-base .
- name: Build ubuntu-provisioned
run: docker build --target ubuntu-provisioned -t ubuntu-provisioned .
- name: Build ea-tester-base
run: docker build --target ea-tester-base -t ea-tester-base .
- name: Build ea-tester-with-mt4
run: docker build --target ea-tester-with-mt4 -t mt4 .
- name: Build ea-tester-with-mt5
run: docker build --target ea-tester-with-mt5 -t mt5 .
- name: Build ea-tester
run: docker build
--build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
--build-arg VCS_REF=${GITHUB_SHA}
--build-arg VERSION=${GITHUB_REF}
--target ea-tester .
--target ea-tester-base .
- run: docker images
- name: Print GitHub actor, repository and ref
run: echo "${{ github.actor }} @ ${{ github.repository }}:${{ github.ref }}"
Expand Down
114 changes: 114 additions & 0 deletions .github/workflows/platform-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
name: Platform (Linux)

env:
ARTIFACT_NAME: ${{ inputs.artifact_name || 'platform' }}
ARTIFACT_OVERWRITE: ${{ inputs.artifact_overwrite || false }}
CACHE: ${{ inputs.cache || true }}
CHECKOUT_REF: ${{ inputs.ref || 'dev' }}
REPOSITORY: EA31337/EA-Tester
SKIP_CLEANUP: ${{ inputs.skip_cleanup || false }}
VERSION: ${{ inputs.version || 5 }}

# yamllint disable-line rule:truthy
on:
pull_request:
paths:
- '.github/workflows/platform-linux.yml'
push:
branches:
- 'master'
- '*dev*'
paths:
- '.github/workflows/platform-linux.yml'
workflow_call:
inputs:
artifact_name:
default: platform
description: Artifact name.
required: false
type: string
artifact_overwrite:
default: false
description: Whether to overwrite artifact.
required: false
type: boolean
cache:
default: true
description: Whether to use cache.
required: false
type: boolean
ref:
default: dev
description: The branch, tag or SHA to checkout.
required: false
type: string
skip_cleanup:
default: false
description: Whether to skip a clean-up job.
required: false
type: boolean
version:
default: 5
description: Version to install.
type: number
# Map the workflow outputs to job outputs.
outputs:
platform:
description: Platform fact output.
value: ${{ jobs.platform-linux.outputs.platform || '{}' }}

jobs:
platform-linux:
name: Platform
# Map the job outputs to step outputs.
outputs:
platform: ${{ steps.out-mt-fact.outputs.platform }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.CHECKOUT_REF }}
repository: ${{ env.REPOSITORY }}
- id: cache-mt
if: env.CACHE
uses: actions/cache@v4
with:
path: ~/.wine/drive_c
key: ${{ env.CHECKOUT_REF }}/${{ env.VERSION }}/${{ hashFiles('.github/workflows/platform-linux.yml') }}
- if: steps.cache-mt.outputs.cache-hit != 'true'
name: Runs playbook
uses: dawidd6/action-ansible-playbook@v2
with:
configuration: |
[defaults]
nocows = false
stdout_callback = yaml
directory: ansible
options: |
--connection local
--inventory localhost,
--verbose
playbook: install-mt${{ env.VERSION }}.yml
requirements: galaxy-requirements.yml
- id: out-mt-fact
name: Sets output
run: echo "platform=$(cat /etc/ansible/facts.d/metatrader.fact)" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: ${{ env.ARTIFACT_NAME }}
path: |
~/.wine/drive_c/Program Files*/**/*MT*
~/.wine/drive_c/Program Files*/**/*Meta*
overwrite: ${{ env.ARTIFACT_OVERWRITE }}
timeout-minutes: 20
cleanup:
if: inputs.skip_cleanup != true
name: Clean-up
needs: [platform-linux]
runs-on: ubuntu-latest
steps:
- uses: geekyeggo/delete-artifact@v5
with:
name: ${{ env.ARTIFACT_NAME }}
4 changes: 2 additions & 2 deletions .github/workflows/sync-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
if: github.repository != 'EA31337/EA-Tester'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
path: upstream
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests-mql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ jobs:
- TestModellingQuality
- TestTimeframes
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Check dependencies
if: github.actor == 'nektos/act'
run: >
apt-get update
&& apt-get -qq install python-pip
&& pip install docker-compose
- name: Run ${{ matrix.test }}
run: docker-compose run ${{ matrix.test }}
run: docker compose run ${{ matrix.test }}
Tests-MT4-Ignored:
defaults:
run:
Expand All @@ -61,12 +61,12 @@ jobs:
- TestLotstep5 # @fixme: GH-208
- TestSpread # @fixme: GH-209
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Check dependencies
if: github.actor == 'nektos/act'
run: >
apt-get update
&& apt-get -qq install python-pip
&& pip install docker-compose
- name: Run ${{ matrix.test }}
run: docker-compose run ${{ matrix.test }} || true
run: docker compose run ${{ matrix.test }} || true
15 changes: 14 additions & 1 deletion .github/workflows/tests-shell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ jobs:
env:
OPT_TRACE: ${{ runner.debug }}
OPT_VERBOSE: true
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/scripts:/opt/scripts/py
# Refs: https://stackoverflow.com/q/16818101/55075
WINEPREFIX: /tmp/.wine
image: ea31337/ea-tester:dev
options: --user root
strategy:
matrix:
test:
Expand All @@ -35,5 +39,14 @@ jobs:
- ./test_eval.sh
- ./test_vars.sh
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
env:
# Refs: https://github.com/actions/checkout/issues/956
GIT_CEILING_DIRECTORIES: /__w
- name: Link scripts directory to /opt/scripts
run: ln -fsv /__w/EA-Tester/EA-Tester/scripts /opt/scripts
- run: find /__w /opt -print
- run: ${{ matrix.test }}
env:
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/scripts:/opt/scripts/py
timeout-minutes: 20
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
repos:

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.27.1
rev: v1.33.0
hooks:
- id: yamllint
args: ["-c", ".yamllint", "-s"]
Expand All @@ -24,7 +24,7 @@ repos:
# files: '(\.py)$'

- repo: https://github.com/igorshubovych/markdownlint-cli.git
rev: v0.32.1
rev: v0.38.0
hooks:
- id: markdownlint

Expand All @@ -41,7 +41,7 @@ repos:
- id: shfmt

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-ast
Expand Down
Loading

0 comments on commit e1bf19d

Please sign in to comment.