Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install requests>=2.12.4, asyncssh>=1.16.1, matplotlib
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
env:
NCS_AUTH_TOKEN: ${{ secrets.NCS_AUTH_TOKEN }}
run: |
#pwd
#ls -al
ssh-keygen -q -f ~/.ssh/id_rsa -t rsa -N ''
#echo PYTHONPATH $PYTHONPATH
export PYTHONPATH=$PWD
export PATH=$PWD'/ncscli':$PATH
cd examples/batchMode
./pytestQuick.sh
- name: Upload output data as artifacts
uses: actions/upload-artifact@v2
with:
name: batchExamples-data-${{ matrix.python-version }}
path: examples/batchMode/data
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
2 changes: 1 addition & 1 deletion examples/batchMode/pytestQuick.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

pytest -v --junitxml data/pytest.xml -o 'junit_family = xunit2' \
pytest -v --rootdir . --junitxml data/pytest.xml -o 'junit_family = xunit2' \
--deselect test_runBatchExamples.py::test_runBatchBlender \
--deselect test_runBatchExamples.py::test_runBatchJMeter \
--deselect test_runBatchExamples.py::test_runBatchPuppeteerLighthouse
Expand Down
15 changes: 15 additions & 0 deletions examples/batchMode/test_runBatchExamples.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
import json
import os
import re
import sys
import subprocess

import pytest


def check_batchRunner_results( jlogFilePath ):
with open( jlogFilePath, 'r') as inFile:
for line in inFile:
Expand All @@ -27,6 +31,8 @@ def check_batchRunner_example( exampleName, frameFilePattern=None ):
binPath = './' + exampleName + '.py'
proc = subprocess.run( [binPath], stderr=subprocess.PIPE )
rc = proc.returncode
if rc:
print( proc.stderr.decode('utf-8'), file=sys.stderr )
assert rc==0, exampleName+' returned non-zero rc'
stderr = proc.stderr.decode('utf-8')
assert 'args.outDataDir' in stderr, 'no args.outDataDir in stderr'
Expand All @@ -45,6 +51,14 @@ def check_batchRunner_example( exampleName, frameFilePattern=None ):
def test_authToken():
assert os.getenv('NCS_AUTH_TOKEN'), 'env var NCS_AUTH_TOKEN not found'

def test_imports():
import ncscli
import ncscli.batchRunner

def test_path():
subprocess.check_call( 'ncs.py --version', shell=True )

@pytest.mark.xfail
def test_runBatchBinary():
# check if the built ARM executable already exists
if not os.path.isfile('helloFrame_aarch64'):
Expand All @@ -57,6 +71,7 @@ def test_runBatchBinary():

check_batchRunner_example( 'runBatchBinary', 'frame_*.out' )

@pytest.mark.xfail
def test_runBatchBinaryGo():
# check if the built ARM executable already exists
if not os.path.isfile('helloFrameGo_aarch64'):
Expand Down