Skip to content

Commit

Permalink
Merge pull request #323 from mixOmicsTeam/configure-codecov3
Browse files Browse the repository at this point in the history
Configure codecov3
  • Loading branch information
evaham1 authored Oct 20, 2024
2 parents 619b3e4 + 0f63291 commit 2e0d474
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 17 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ Library
ignore
.Renviron
^codecov\.yml$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
18 changes: 1 addition & 17 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,20 +205,4 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}
repository: mixomicsteam/mixomics
tags: ${{ needs.versions.outputs.docker_tag }}
build_args: BIOC_VERSION=${{ needs.versions.outputs.bioc }}

- name: Test coverage 🔍
if: (runner.os == 'Linux' && github.event_name == 'schedule' && github.repository == 'mixOmicsTeam/mixOmics') || (runner.os == 'Linux' && github.event_name == 'workflow_dispatch' && github.repository == 'mixOmicsTeam/mixOmics')
# the commands between 'set +e' and 'set -e' are run without throwing any error
run: |
set +e
Rscript -e "covr::codecov(type = c('tests', 'examples'))"
set -e
# - name: Notify Slack 📣
# uses: 8398a7/action-slack@v3
# with:
# status: ${{ job.status }}
# fields: repo,message,commit,author,action,eventName,ref,workflow,job,took # selectable (default: repo,message)
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # set in rep's setting >> secrets
build_args: BIOC_VERSION=${{ needs.versions.outputs.bioc }}
61 changes: 61 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: Code Coverage

permissions: read-all

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr, any::xml2
needs: coverage

- name: Test coverage
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package

0 comments on commit 2e0d474

Please sign in to comment.