Skip to content

Commit

Permalink
Merge pull request #189 from EA31337/dev
Browse files Browse the repository at this point in the history
Improves output handling and adds tests
  • Loading branch information
kenorb authored May 28, 2020
2 parents c0191ac + 48adc93 commit 1cc465a
Show file tree
Hide file tree
Showing 20 changed files with 377 additions and 151 deletions.
32 changes: 25 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,34 @@ name: Docker
on:
pull_request:
paths-ignore:
- '*.md'
- '*.txt'
- '**/*.md'
- '**/*.txt'
- '.*'
push:
branches:
- "master"
- "dev*"
paths-ignore:
- '*.md'
- '*.txt'
- '**/*.md'
- '**/*.txt'
- '.*'
release:
types:
- published

jobs:
Hadolint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: brpaz/hadolint-action@master
with:
dockerfile: Dockerfile
Docker:
runs-on: ubuntu-latest
needs: Hadolint
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Build ubuntu-base
run: docker build --target ubuntu-base -t ubuntu-base .
- name: Build ubuntu-provisioned
Expand All @@ -39,25 +49,33 @@ jobs:
--build-arg VERSION=${GITHUB_REF}
--target ea-tester .
- run: docker images
- name: Prints GitHub actor and repository
run: echo "${{ github.actor }} @ ${{ github.repository }}"
- name: Push to Docker Hub
if: github.actor == 'ea31337'
if: >
github.repository == 'EA31337/EA-Tester'
&& github.event_name != 'pull_request'
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ea31337/ea-tester
tag_with_ref: true
- name: Push to GitHub Packages
if: github.actor == 'ea31337'
if: >
github.repository == 'EA31337/EA-Tester'
&& github.event_name != 'pull_request'
uses: docker/build-push-action@v1
with:
add_git_labels: true
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: ea31337/ea-tester/ea-tester
tag_with_ref: true
Test-Docker:
runs-on: ubuntu-latest
needs: Docker
container:
image: ea31337/ea-tester:dev
volumes:
Expand Down
24 changes: 17 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
---
name: Lint

on:
- pull_request
- push
pull_request:
paths:
- '**/*.mq?'
- '**/*.sh'
- '*.y?ml'
push:
paths:
- '**/*.mq?'
- '**/*.sh'
- '**/*.y?ml'

jobs:
YAML:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: YAML check (yamllint)
uses: ibiqlik/action-yamllint@master
with:
strict: true
Markdown:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: markdownlint-cli
uses: nosborn/[email protected]
env:
Expand All @@ -26,7 +36,7 @@ jobs:
ShellCheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Shell Check
uses: luizm/action-sh-checker@master
env:
Expand All @@ -37,14 +47,14 @@ jobs:
MQL:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: DoozyX/[email protected]
with:
extensions: 'h'
Syntax:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Run RunCompileMql
run: docker-compose run RunCompileMql
- name: Run TestSyntaxBash
Expand Down
23 changes: 21 additions & 2 deletions .github/workflows/tests-mql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,33 @@
name: Tests-MQL

on:
- pull_request
- push
pull_request:
paths:
- '**/docker-compose.yml'
- '**/*.mq?'
- '.github/workflows/tests-mql.yml'
push:
paths:
- '**/docker-compose.yml'
- '**/*.mq?'
- '.github/workflows/tests-mql.yml'

jobs:
Tests-MT4:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check dependencies
if: github.actor == 'nektos/act'
run: >
apt-get update
&& apt-get -qq install python-pip
&& pip install docker-compose
- name: Run ScriptDummy
working-directory: tests
run: docker-compose run ScriptDummy
# @fixme
if: false
- name: Run ScriptPrintPaths
working-directory: tests
run: docker-compose run ScriptPrintPaths
Expand Down
25 changes: 19 additions & 6 deletions .github/workflows/tests-shell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
name: Tests-Shell

on:
- pull_request
- push
pull_request:
paths:
- '**/*.sh'
- '.github/workflows/tests-shell.yml'
push:
paths:
- '**/*.sh'
- '.github/workflows/tests-shell.yml'

jobs:
Tests-Scripts:
Expand All @@ -12,8 +18,15 @@ jobs:
image: ea31337/ea-tester:dev
steps:
- uses: actions/checkout@v2
- run: rm -fr /opt/scripts
- run: ln -fs scripts /opt/scripts
- name: Test .vars.inc.sh file
- run: ./test_aliases.sh
working-directory: scripts/tests
- run: ./test_backtest.sh
working-directory: scripts/tests
- run: ./test_bt_data_gen.sh
working-directory: scripts/tests
- run: ./test_cmds.sh
working-directory: scripts/tests
- run: ./test_eval.sh
working-directory: scripts/tests
- run: ./test_vars.sh
working-directory: scripts/tests
run: ./test_vars.sh
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Set the base Ubuntu image.
FROM ubuntu:xenial AS ubuntu-base
MAINTAINER kenorb
ENV DEBIAN_FRONTEND noninteractive

# Setup the default user.
Expand All @@ -23,7 +22,7 @@ ARG PROVISION_SUDO=1
ARG PROVISION_VNC=1

# Provision container image.
ADD scripts /opt/scripts
COPY scripts /opt/scripts
ENV PATH $PATH:/opt/scripts:/opt/scripts/py
ENV PROVISION_HASH KwFCBBn659lGNLNiIGd5131XnknI
RUN provision.sh
Expand All @@ -39,8 +38,8 @@ USER ubuntu
FROM ubuntu-provisioned AS ea-tester-base

# Add files.
ADD conf /opt/conf
ADD tests /opt/tests
COPY conf /opt/conf
COPY tests /opt/tests

# Setup results directory.
ARG BT_DEST=/opt/results
Expand Down
1 change: 1 addition & 0 deletions scripts/.aliases.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ shopt -s expand_aliases
# Define aliases.
alias encode="base64"
alias decode="base64 -d"
alias run="eval.sh"
Loading

0 comments on commit 1cc465a

Please sign in to comment.