From 3e991e4352d79be1563e1c69bc026f270db4d74a Mon Sep 17 00:00:00 2001 From: Qingyun Wu Date: Mon, 26 Apr 2021 20:04:57 -0400 Subject: [PATCH] code coverage (#79) * add codecov.yml * change tests to test * condition * windows * install coverage * remove conditions * revert remove conditions * check build failure * code coverage * Revert "check build failure" This reverts commit bc06b3f961d05c923c2974451961f5c252c9e042. * del codecov.yml Co-authored-by: Chi Wang (MSR) Co-authored-by: Chi Wang Co-authored-by: Eric Zhu --- .coveragerc | 2 +- .github/workflows/python-package.yml | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.coveragerc b/.coveragerc index ca97263d23..1d8d57370d 100644 --- a/.coveragerc +++ b/.coveragerc @@ -2,4 +2,4 @@ branch = True source = flaml omit = - *tests* \ No newline at end of file + *test* \ No newline at end of file diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index a3a570472d..7cef0a948b 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -7,7 +7,7 @@ on: push: branches: ['main'] pull_request: - branches: ['*'] + branches: ['main'] jobs: build: @@ -49,13 +49,17 @@ jobs: # 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 + if: ${{ matrix.python-version != '3.7' || matrix.os == 'macos-latest' }} run: | pytest test - name: Coverage + if: ${{ matrix.python-version == '3.7' && matrix.os != 'macos-latest' }} run: | + pip install coverage coverage run -a -m pytest test coverage xml - name: Upload coverage to Codecov + if: ${{ matrix.python-version == '3.7' && matrix.os != 'macos-latest' }} uses: codecov/codecov-action@v1 with: file: ./coverage.xml