Merge pull request #536 from bbayukari/master #445
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code Coverage | |
on: | |
push: | |
paths: | |
- "python/**" | |
- "R-package/**" | |
- "src/**" | |
- ".github/workflows/code_coverage.yml" | |
- "!R-package/.gitignore" | |
- "!R-package/README.md" | |
- "!R-package/LICENSE" | |
- "!R-package/cran-comments.md" | |
- "!R-package/pre-release.R" | |
- "!R-package/data-raw/**" | |
- "!python/.gitignore" | |
- "!python/README.rst" | |
- "!python/LICENSE" | |
pull_request: | |
paths: | |
- "python/**" | |
- "R-package/**" | |
- "src/**" | |
- ".github/workflows/code_coverage.yml" | |
- "!R-package/.gitignore" | |
- "!R-package/README.md" | |
- "!R-package/LICENSE" | |
- "!R-package/cran-comments.md" | |
- "!R-package/pre-release.R" | |
- "!R-package/data-raw/**" | |
- "!python/.gitignore" | |
- "!python/README.rst" | |
- "!python/LICENSE" | |
workflow_dispatch: | |
jobs: | |
codecovPy: | |
name: Codecov workflow for Python-package | |
runs-on: ubuntu-latest | |
env: | |
PYTHON: "3.9" | |
steps: | |
- uses: actions/checkout@master | |
- name: Setup Python | |
uses: actions/setup-python@master | |
with: | |
python-version: 3.9 | |
- name: Install abess & dependencies | |
run: | | |
pip install "pandas<2.0.0" | |
pip install lifelines | |
pip install pybind11[global] | |
# pip install codecov | |
# pip install gcovr | |
# export CFLAGS="--coverage" | |
cd python | |
pip install . | |
ls * -al | |
- name: Generate coverage report | |
run: | | |
pip install pytest | |
pip install pytest-cov | |
cd ./python/pytest | |
pytest --cov=abess -v --cov-report=xml | |
# gcovr ./python/src/ --xml | |
ls * -al | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./python/pytest/coverage.xml | |
fail_ci_if_error: true | |
flags: Python | |
verbose: true | |
codecovR: | |
name: Codecov for R-package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
- uses: r-lib/actions/setup-pandoc@v1 | |
- name: Ubuntu dependencies | |
run: | | |
sudo apt-get install libomp5 | |
sudo apt-get install libomp-dev | |
sudo apt-get install libxml2-dev | |
sudo apt-get install libcurl4-openssl-dev | |
sudo apt-get install python3 | |
sudo apt-get install python3-pip | |
- name: Query dependencies | |
run: | | |
install.packages('remotes') | |
saveRDS(remotes::dev_package_deps("R-package", dependencies = TRUE), ".github/depends.Rds", version = 2) | |
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") | |
shell: Rscript {0} | |
- name: Install dependencies | |
run: | | |
remotes::install_deps("R-package", dependencies = TRUE) | |
install.packages("covr") | |
install.packages("xml2") | |
shell: Rscript {0} | |
- name: Install package | |
run: R CMD INSTALL R-package | |
- name: Generate coverage report | |
run: | | |
Rscript -e 'library(covr); x <- package_coverage(path = "./R-package", quiet = FALSE, type = c("tests"), function_exclusions = "\\.onUnload"); to_cobertura(x, "rpackage.xml")' | |
- name: Upload coverage report | |
run: | | |
pip install --upgrade pip | |
pip3 install --user codecov | |
codecov -F rpackage -f rpackage.xml |