From e86eb1717d08f987265aa6973ca0d59946e3e3d2 Mon Sep 17 00:00:00 2001 From: marscher Date: Tue, 15 Oct 2019 12:00:49 +0200 Subject: [PATCH] [ci/test-reports] publish to agent working dir --- devtools/azure-pipelines-osx.yml | 1 + devtools/conda-recipe/meta.yaml | 5 +---- devtools/conda-recipe/run_test.py | 15 +++++++-------- devtools/conda-setup+build.yml | 2 +- devtools/test-results.yml | 14 ++++++++++++-- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/devtools/azure-pipelines-osx.yml b/devtools/azure-pipelines-osx.yml index c1c671e59..7c0f1cbb1 100644 --- a/devtools/azure-pipelines-osx.yml +++ b/devtools/azure-pipelines-osx.yml @@ -16,6 +16,7 @@ jobs: - script: sudo chmod -R 777 /usr/local/miniconda displayName: Fix Conda permissions + - script: env - template: conda-setup+build.yml - template: test-results.yml diff --git a/devtools/conda-recipe/meta.yaml b/devtools/conda-recipe/meta.yaml index e691a6ddb..5b0adc5f1 100644 --- a/devtools/conda-recipe/meta.yaml +++ b/devtools/conda-recipe/meta.yaml @@ -8,8 +8,8 @@ source: build: script_env: - - CIRCLE_TEST_REPORTS - OMP_NUM_THREADS + - AGENT_BUILDDIRECTORY script: "{{ PYTHON }} -m pip install . --no-deps --ignore-installed --no-cache-dir -vvv" requirements: @@ -22,14 +22,11 @@ requirements: host: - cython - intel-openmp # [osx] - - mdtraj - numpy - python - scipy - setuptools - pip -# we ship this in the repo -# - pybind11 run: #- bhmm >=0.6.3,<0.7 diff --git a/devtools/conda-recipe/run_test.py b/devtools/conda-recipe/run_test.py index 3ae34b5d3..13c68fc59 100644 --- a/devtools/conda-recipe/run_test.py +++ b/devtools/conda-recipe/run_test.py @@ -2,17 +2,16 @@ import sys import pytest +import tempfile cover_pkg = 'sktime' - +xml_results_dest = os.getenv('SYSTEM_DEFAULTWORKINGDIRECTORY', tempfile.gettempdir()) +assert os.path.isdir(xml_results_dest), 'no dest dir available' # where to write junit xml -junit_xml = os.path.join(os.getenv('CIRCLE_TEST_REPORTS', os.path.expanduser('~')), - 'reports', 'junit.xml') -target_dir = os.path.dirname(junit_xml) -if not os.path.exists(target_dir): - os.makedirs(target_dir) +junit_xml = os.path.join(xml_results_dest, 'junit.xml') +cov_xml = os.path.join(xml_results_dest, 'coverage.xml') print('junit destination:', junit_xml) - +print('coverage dest:', cov_xml) pytest_args = ("-vv " "--cov={cover_pkg} " "--cov-report=xml:{dest_report} " @@ -22,7 +21,7 @@ "tests/ " .format(cover_pkg=cover_pkg, junit_xml=junit_xml, - dest_report=os.path.join(os.path.expanduser('~/'), 'coverage.xml'), + dest_report=cov_xml, ) .split(' ')) diff --git a/devtools/conda-setup+build.yml b/devtools/conda-setup+build.yml index 656d8fa9c..f493a82e2 100644 --- a/devtools/conda-setup+build.yml +++ b/devtools/conda-setup+build.yml @@ -3,7 +3,7 @@ steps: conda config --add channels conda-forge conda config --set always_yes true conda config --set quiet true - conda install conda-build + conda install conda-build conda-verify displayName: 'Install dependencies' continueOnError: false - bash: | diff --git a/devtools/test-results.yml b/devtools/test-results.yml index b3bed55a4..2b870e2ed 100644 --- a/devtools/test-results.yml +++ b/devtools/test-results.yml @@ -3,7 +3,17 @@ steps: - task: PublishTestResults@2 inputs: testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit, cTest - testResultsFiles: '**/junit.xml' - searchFolder: '$(HOME)' # Optional + testResultsFiles: '**/*junit.xml' failTaskOnFailedTests: true # Optional publishRunAttachments: true # Optional + +- task: PublishCodeCoverageResults@1 + inputs: + codeCoverageTool: 'cobertura' # Options: cobertura, jaCoCo + summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage.xml' + pathToSources: '$(Build.SourcesDirectory)/sktime' # Optional + #reportDirectory: # Optional + #additionalCodeCoverageFiles: # Optional + #failIfCoverageEmpty: false # Optional + +- bash: curl -s https://codecov.io/bash | bash