diff --git a/tests/README.md b/tests/README.md index bdd57bd54..79abd7de2 100644 --- a/tests/README.md +++ b/tests/README.md @@ -2,6 +2,8 @@ This project uses unit, smoke and integration tests with Python files and notebooks. For more information, see a [quick introduction to unit, smoke and integration tests](https://miguelgfierro.com/blog/2018/a-beginners-guide-to-python-testing/). To manually execute the unit tests in the different environments, first **make sure you are in the correct environment as described in the [SETUP.md](/SETUP.md)**. +Tests are automatically run as part of a DevOps pipeline. The pipelines are defined in .yml files in tests/ci with filenames that align with pipeline names. + ## Test execution Click on the following menus to see more details on how to execute the unit, smoke and integration tests: diff --git a/tests/ci/unit-tests.yml b/tests/ci/unit-tests.yml new file mode 100644 index 000000000..3c83dadcc --- /dev/null +++ b/tests/ci/unit-tests.yml @@ -0,0 +1,46 @@ + +# Pull request against these branches will trigger this build +pr: +- master +- staging + +#Any commit to this branch will trigger the build. +trigger: +- staging +- master + +pool: + vmImage: 'ubuntu-16.04' + +steps: + +- bash: | + echo "##vso[task.prependpath]/usr/share/miniconda/bin" + displayName: Add Conda to PATH + +- bash: | + conda remove -q -n nlp --all -y + python tools/generate_conda_file.py --gpu + conda env create -n nlp_gpu -f nlp_gpu.yaml + conda env list + source activate nlp_gpu + displayName: 'Creating Conda Environment with dependencies' + +- bash: | + source activate nlp_gpu + python -m ipykernel install --user --name nlp_gpu --display-name "nlp_gpu" + # Commenting out pytest since it contains bunch of tests from other project which are not applicable. + # But keeping the line here to show how to run it once tests relevant to this project are added + # pytest --junitxml=junit/test-unitttest.xml #not running any tests for now + displayName: 'Run Unit tests' + +- task: PublishTestResults@2 + inputs: + testResultsFiles: '**/test-unitttest.xml' + testRunTitle: 'Test results for PyTest' + +- task: ComponentGovernanceComponentDetection@0 + inputs: + scanType: 'Register' + verbosity: 'Verbose' + alertWarningLevel: 'High'