From 51edab29be195db44a7c9a91be443dde46a1b563 Mon Sep 17 00:00:00 2001 From: "Michael J. Coffey" <22627691+xoffey@users.noreply.github.com> Date: Mon, 28 Sep 2020 17:00:14 -0700 Subject: [PATCH 01/12] Create python-package.yml --- .github/workflows/python-package.yml | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..ad7b5e2 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,48 @@ +# 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 ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8] + + 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: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + cd ncscli/examples/batchMode + ./pytestQuick.sh + - name: Upload pytest test results + uses: actions/upload-artifact@v2 + with: + name: pytest-results-${{ matrix.python-version }} + path: ncscli/examples/batchMode/data/pytest.xml + # Use always() to always run this step to publish test results when there are test failures + if: ${{ always() }} From 27f874f85b05153d7cc673c44f8e925150827a02 Mon Sep 17 00:00:00 2001 From: "Michael J. Coffey" <22627691+xoffey@users.noreply.github.com> Date: Mon, 28 Sep 2020 17:08:25 -0700 Subject: [PATCH 02/12] not using flake8 now --- .github/workflows/python-package.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index ad7b5e2..06e8427 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -29,12 +29,6 @@ jobs: 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: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | cd ncscli/examples/batchMode From a582312617448666ab36ced8878f4a48d0c66ede Mon Sep 17 00:00:00 2001 From: "Michael J. Coffey" <22627691+xoffey@users.noreply.github.com> Date: Wed, 30 Sep 2020 17:12:57 -0700 Subject: [PATCH 03/12] no artifacting (#2) * no artifacting * fix cd * with burner auth * export pythonpath * redundant pythonpath * Update test_runBatchExamples.py * export PATH * export path with better quotes * Update test_runBatchExamples.py * import sys * prepend $PWD to the path * prepend $PWD to pythonpath * does ssh-keygen * Update pytestQuick.sh * simple pytest.mark.xfail --- .github/workflows/python-package.yml | 19 ++++++++++--------- examples/batchMode/pytestQuick.sh | 2 +- examples/batchMode/test_runBatchExamples.py | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 06e8427..de40bfe 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8] + python-version: [3.7] steps: - uses: actions/checkout@v2 @@ -31,12 +31,13 @@ jobs: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Test with pytest run: | - cd ncscli/examples/batchMode + pwd + ls -al + ssh-keygen -q -f ~/.ssh/id_rsa -t rsa -N '' + echo PYTHONPATH $PYTHONPATH + export PYTHONPATH=$PWD:$PWD'/ncscli':$PWD'/ncscli/ncscli' + export PATH=$PWD:$PWD'/ncscli':$PATH + export NCS_AUTH_TOKEN=VnvnwNggQz7NDEeMJQQmDfdS85Jjzs4g + cd examples/batchMode ./pytestQuick.sh - - name: Upload pytest test results - uses: actions/upload-artifact@v2 - with: - name: pytest-results-${{ matrix.python-version }} - path: ncscli/examples/batchMode/data/pytest.xml - # Use always() to always run this step to publish test results when there are test failures - if: ${{ always() }} + diff --git a/examples/batchMode/pytestQuick.sh b/examples/batchMode/pytestQuick.sh index 63b930c..ee283bd 100755 --- a/examples/batchMode/pytestQuick.sh +++ b/examples/batchMode/pytestQuick.sh @@ -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 diff --git a/examples/batchMode/test_runBatchExamples.py b/examples/batchMode/test_runBatchExamples.py index 4491610..43ac832 100644 --- a/examples/batchMode/test_runBatchExamples.py +++ b/examples/batchMode/test_runBatchExamples.py @@ -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: @@ -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' @@ -45,6 +51,13 @@ 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_import(): + import ncs + +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'): @@ -57,6 +70,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'): From fbf8a3b124bfb0b1aa23b53aa55d3c16554e28e2 Mon Sep 17 00:00:00 2001 From: "Michael J. Coffey" <22627691+xoffey@users.noreply.github.com> Date: Wed, 30 Sep 2020 17:34:36 -0700 Subject: [PATCH 04/12] uploads pytest.xml --- .github/workflows/python-package.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index de40bfe..ce45f25 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -40,4 +40,10 @@ jobs: export NCS_AUTH_TOKEN=VnvnwNggQz7NDEeMJQQmDfdS85Jjzs4g cd examples/batchMode ./pytestQuick.sh - + - name: Upload pytest test results + uses: actions/upload-artifact@v2 + with: + name: pytest-results-${{ matrix.python-version }} + path: data/pytest.xml + # Use always() to always run this step to publish test results when there are test failures + if: ${{ always() }} From 7571b214739a2b124c0c63a7e0e0b3789c778de5 Mon Sep 17 00:00:00 2001 From: "Michael J. Coffey" <22627691+xoffey@users.noreply.github.com> Date: Wed, 30 Sep 2020 18:18:55 -0700 Subject: [PATCH 05/12] upload from --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index ce45f25..98fb744 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -44,6 +44,6 @@ jobs: uses: actions/upload-artifact@v2 with: name: pytest-results-${{ matrix.python-version }} - path: data/pytest.xml + path: examples/batchMode/data/pytest.xml # Use always() to always run this step to publish test results when there are test failures if: ${{ always() }} From e962b88f04895b9fb6f1e8e0b2a6913a3145c286 Mon Sep 17 00:00:00 2001 From: "Michael J. Coffey" <22627691+xoffey@users.noreply.github.com> Date: Wed, 30 Sep 2020 18:41:25 -0700 Subject: [PATCH 06/12] uploads whole data dir --- .github/workflows/python-package.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 98fb744..a6bf605 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -40,10 +40,10 @@ jobs: export NCS_AUTH_TOKEN=VnvnwNggQz7NDEeMJQQmDfdS85Jjzs4g cd examples/batchMode ./pytestQuick.sh - - name: Upload pytest test results + - name: Upload output data as artifacts uses: actions/upload-artifact@v2 with: - name: pytest-results-${{ matrix.python-version }} - path: examples/batchMode/data/pytest.xml + 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() }} From e10a12eb1856d9018f0bce47f1e82f0a52b008f2 Mon Sep 17 00:00:00 2001 From: "Michael J. Coffey" <22627691+xoffey@users.noreply.github.com> Date: Thu, 1 Oct 2020 14:47:28 -0700 Subject: [PATCH 07/12] added workflow_dispatch to yml --- .github/workflows/python-package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index a6bf605..6e5edb1 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -8,6 +8,7 @@ on: branches: [ master ] pull_request: branches: [ master ] + workflow_dispatch: jobs: build: From 4e2a908983b08d0276cd84edaa1195d8297c0b49 Mon Sep 17 00:00:00 2001 From: "Michael J. Coffey" <22627691+xoffey@users.noreply.github.com> Date: Fri, 2 Oct 2020 12:40:20 -0700 Subject: [PATCH 08/12] cleaned up oaths --- .github/workflows/python-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 6e5edb1..3292c19 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -36,8 +36,8 @@ jobs: ls -al ssh-keygen -q -f ~/.ssh/id_rsa -t rsa -N '' echo PYTHONPATH $PYTHONPATH - export PYTHONPATH=$PWD:$PWD'/ncscli':$PWD'/ncscli/ncscli' - export PATH=$PWD:$PWD'/ncscli':$PATH + export PYTHONPATH=$PWD + export PATH=$PWD:$PATH export NCS_AUTH_TOKEN=VnvnwNggQz7NDEeMJQQmDfdS85Jjzs4g cd examples/batchMode ./pytestQuick.sh From 95e71ea26f92c4e12eef711eaca4af825e9a6f57 Mon Sep 17 00:00:00 2001 From: "Michael J. Coffey" <22627691+xoffey@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:13:25 -0700 Subject: [PATCH 09/12] path=$PWD'/ncscli':$PATH --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 3292c19..c613904 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -37,7 +37,7 @@ jobs: ssh-keygen -q -f ~/.ssh/id_rsa -t rsa -N '' echo PYTHONPATH $PYTHONPATH export PYTHONPATH=$PWD - export PATH=$PWD:$PATH + export PATH=$PWD'/ncscli':$PATH export NCS_AUTH_TOKEN=VnvnwNggQz7NDEeMJQQmDfdS85Jjzs4g cd examples/batchMode ./pytestQuick.sh From 6cfdb34e065b39186651f1f50b5b95bf9df8b4bb Mon Sep 17 00:00:00 2001 From: "Michael J. Coffey" <22627691+xoffey@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:39:11 -0700 Subject: [PATCH 10/12] replace test_import with corrected test_imports --- examples/batchMode/test_runBatchExamples.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/batchMode/test_runBatchExamples.py b/examples/batchMode/test_runBatchExamples.py index 43ac832..d528b50 100644 --- a/examples/batchMode/test_runBatchExamples.py +++ b/examples/batchMode/test_runBatchExamples.py @@ -51,8 +51,9 @@ 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_import(): - import ncs +def test_imports(): + import ncscli + import ncscli.batchRunner def test_path(): subprocess.check_call( 'ncs.py --version', shell=True ) From 3e674553f193175f5bdd13ca1733d7e46948446d Mon Sep 17 00:00:00 2001 From: "Michael J. Coffey" <22627691+xoffey@users.noreply.github.com> Date: Fri, 2 Oct 2020 14:17:46 -0700 Subject: [PATCH 11/12] uses secrets.NCS_AUTH_TOKEN --- .github/workflows/python-package.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index c613904..f3d50c3 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -31,6 +31,8 @@ jobs: 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 @@ -38,7 +40,7 @@ jobs: echo PYTHONPATH $PYTHONPATH export PYTHONPATH=$PWD export PATH=$PWD'/ncscli':$PATH - export NCS_AUTH_TOKEN=VnvnwNggQz7NDEeMJQQmDfdS85Jjzs4g + #export NCS_AUTH_TOKEN=VnvnwNggQz7NDEeMJQQmDfdS85Jjzs4g cd examples/batchMode ./pytestQuick.sh - name: Upload output data as artifacts From 9bce45792b1adacc79c8cbdb8951e31d98c27e2f Mon Sep 17 00:00:00 2001 From: "Michael J. Coffey" <22627691+xoffey@users.noreply.github.com> Date: Fri, 2 Oct 2020 15:53:31 -0700 Subject: [PATCH 12/12] delete and comment out obsolete lines in yml --- .github/workflows/python-package.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index f3d50c3..3f6327f 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -34,13 +34,12 @@ jobs: env: NCS_AUTH_TOKEN: ${{ secrets.NCS_AUTH_TOKEN }} run: | - pwd - ls -al + #pwd + #ls -al ssh-keygen -q -f ~/.ssh/id_rsa -t rsa -N '' - echo PYTHONPATH $PYTHONPATH + #echo PYTHONPATH $PYTHONPATH export PYTHONPATH=$PWD export PATH=$PWD'/ncscli':$PATH - #export NCS_AUTH_TOKEN=VnvnwNggQz7NDEeMJQQmDfdS85Jjzs4g cd examples/batchMode ./pytestQuick.sh - name: Upload output data as artifacts