"include/git@developer.sourcefind.cn:yangql/googletest.git" did not exist on "e1cdce5f761ed0fb04be0aea4d1b9138e9dbc1f7"
Unverified Commit d32b96eb authored by Yifan Xiong's avatar Yifan Xiong Committed by GitHub
Browse files

Setup: Add Test - Add Codecov (#9)

Add code coverage configuration.
parent b1a42c38
...@@ -11,7 +11,7 @@ insert_final_newline = true ...@@ -11,7 +11,7 @@ insert_final_newline = true
[*.py] [*.py]
max_line_length = 120 max_line_length = 120
[*.yaml] [*.{yml,yaml}]
indent_size = 2 indent_size = 2
[*.json] [*.json]
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
[![Build Status](https://dev.azure.com/msrasrg/SuperBenchmark/_apis/build/status/microsoft.superbenchmark?branchName=dev)](https://dev.azure.com/msrasrg/SuperBenchmark/_build?definitionId=77) [![Build Status](https://dev.azure.com/msrasrg/SuperBenchmark/_apis/build/status/microsoft.superbenchmark?branchName=dev)](https://dev.azure.com/msrasrg/SuperBenchmark/_build?definitionId=77)
[![Lint](https://github.com/microsoft/superbenchmark/workflows/Lint/badge.svg)](https://github.com/microsoft/superbenchmark/actions?query=workflow%3ALint) [![Lint](https://github.com/microsoft/superbenchmark/workflows/Lint/badge.svg)](https://github.com/microsoft/superbenchmark/actions?query=workflow%3ALint)
[![Codecov](https://codecov.io/gh/microsoft/superbenchmark/branch/dev/graph/badge.svg?token=DDiDLW7pSd)](https://codecov.io/gh/microsoft/superbenchmark/branch/dev)
SuperBench is a benchmarking and diagnosis tool for AI infrastructure, SuperBench is a benchmarking and diagnosis tool for AI infrastructure,
...@@ -144,7 +145,7 @@ SuperBenchmark is an open-source project. Your participation and contribution ar ...@@ -144,7 +145,7 @@ SuperBenchmark is an open-source project. Your participation and contribution ar
1. Bug fixes for existing features. 1. Bug fixes for existing features.
2. New features for benchmark module (micro-benchmark, model-benchmark, etc.) 2. New features for benchmark module (micro-benchmark, model-benchmark, etc.)
If you would like to contribute a new feature on SuperBenchmark, please submit your proposal first. In [GitHub Issues](https://github.com/microsoft/superbenchmark/issues) module, choose `Enhancement Request` to finish the submission. If the proposal is accepted, you can submit pull request to origin dev branch. If you would like to contribute a new feature on SuperBenchmark, please submit your proposal first. In [GitHub Issues](https://github.com/microsoft/superbenchmark/issues) module, choose `Enhancement Request` to finish the submission. If the proposal is accepted, you can submit pull request to origin dev branch.
#### Contribution steps #### Contribution steps
......
...@@ -7,13 +7,14 @@ ...@@ -7,13 +7,14 @@
# https://aka.ms/yaml # https://aka.ms/yaml
trigger: trigger:
- master - master
- dev - dev
resources: resources:
- repo: self - repo: self
variables: variables:
imageName: test
tag: '$(Build.BuildId)' tag: '$(Build.BuildId)'
steps: steps:
...@@ -22,5 +23,12 @@ steps: ...@@ -22,5 +23,12 @@ steps:
inputs: inputs:
command: build command: build
dockerfile: '$(Build.SourcesDirectory)/test.dockerfile' dockerfile: '$(Build.SourcesDirectory)/test.dockerfile'
repository: $(imageName)
tags: | tags: |
$(tag) $(tag)
- script: |
ci_env=`bash <(curl -s https://codecov.io/env)`
docker run $ci_env --entrypoint /bin/bash $(imageName):$(tag) -c 'bash <(curl -s https://codecov.io/bash)'
displayName: Report coverage results
env:
CODECOV_TOKEN: $(codecovToken)
codecov:
require_ci_to_pass: yes
coverage:
status:
project:
default:
target: 80%
threshold: 1%
branches:
- main
- dev
...@@ -99,7 +99,7 @@ def finalize_options(self): ...@@ -99,7 +99,7 @@ def finalize_options(self):
def run(self): def run(self):
"""Run pytest.""" """Run pytest."""
errno = os.system('python3 -m pytest -v') errno = os.system('python3 -m pytest -v --cov=superbench --cov-report=xml --cov-report=term-missing tests/')
sys.exit(0 if errno == 0 else 1) sys.exit(0 if errno == 0 else 1)
...@@ -143,6 +143,7 @@ def run(self): ...@@ -143,6 +143,7 @@ def run(self):
'flake8-docstrings>=1.5.0', 'flake8-docstrings>=1.5.0',
'pydocstyle>=5.1.1', 'pydocstyle>=5.1.1',
'pytest>=6.2.2', 'pytest>=6.2.2',
'pytest-cov>=2.11.1',
], ],
}, },
package_data={}, package_data={},
......
...@@ -5,6 +5,8 @@ FROM ubuntu:18.04 ...@@ -5,6 +5,8 @@ FROM ubuntu:18.04
# Install the python3.7 and pip # Install the python3.7 and pip
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
git \
curl \
python3.7-dev \ python3.7-dev \
python3-pip python3-pip
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
Get it from https://docs.pytest.org/en/stable/. Get it from https://docs.pytest.org/en/stable/.
""" """
import superbench
def inc(x): def inc(x):
"""Increase an integer. """Increase an integer.
...@@ -22,3 +24,9 @@ def inc(x): ...@@ -22,3 +24,9 @@ def inc(x):
def test_answer(): def test_answer():
"""Test inc function.""" """Test inc function."""
assert inc(3) == 4 assert inc(3) == 4
def test_superbench():
"""Test SuperBench."""
assert (superbench.__version__ == '0.0.0')
assert (superbench.__author__ == 'Microsoft')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment