diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 80880757de..0f2f4123fc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -536,6 +536,13 @@ jobs: - name: Run Python unit tests (Ubuntu ${{ matrix.UbuntuVersion }}) timeout-minutes: 30 run: docker exec mlos-build-python-${{ matrix.UbuntuVersion }} make python-test + - name: Upload coverage to codecov + if: ${{ github.repository == 'microsoft/mlos' }} + uses: codecov/codecov-action@v1 + with: + file: ./coverage.xml + flags: unittests + fail_ci_if_error: true - name: Cleanup docker instance for Ubuntu ${{ matrix.UbuntuVersion }} shell: bash run: | diff --git a/Dockerfile b/Dockerfile index 6fc52639ba..059b02c06f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -174,6 +174,7 @@ RUN python3.7 -m pip install pip && \ COPY ./source/Mlos.Python/requirements.txt /tmp/ RUN python3.7 -m pip install -r /tmp/requirements.txt +RUN python3.7 -m pip install pytest-cov # Expose the typical port that we start mlos microservice optimizer on by default. EXPOSE 50051/tcp diff --git a/README.md b/README.md index 0a5ec03543..5476de11cf 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![codecov](https://codecov.io/gh/microsoft/MLOS/branch/main/graph/badge.svg?token=14T6RFL2KR)](https://codecov.io/gh/microsoft/MLOS) + # MLOS: Machine Learning Optimized Systems ## MLOS: An Infrastructure for Automated Software Performance Engineering diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000000..69cb76019a --- /dev/null +++ b/codecov.yml @@ -0,0 +1 @@ +comment: false diff --git a/scripts/run-python-tests.sh b/scripts/run-python-tests.sh index be361ff624..6674070135 100755 --- a/scripts/run-python-tests.sh +++ b/scripts/run-python-tests.sh @@ -10,4 +10,4 @@ set -eu scriptdir=$(readlink -f "$(dirname "$0")") cd "$scriptdir/.." -pytest -svxl source/Mlos.Python $* +pytest -svxl source/Mlos.Python --cov=mlos --cov-report=xml $*