Update R/dbetabinom.R #29
Workflow file for this run
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: Coverage π | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- pre-release | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- ready_for_review | ||
branches: | ||
- main | ||
- pre-release | ||
workflow_dispatch: | ||
workflow_call: | ||
inputs: | ||
install-system-dependencies: | ||
description: Check for and install system dependencies | ||
required: false | ||
default: false | ||
type: boolean | ||
enable-staged-dependencies-check: | ||
description: Enable staged dependencies YAML check | ||
required: false | ||
default: false | ||
type: boolean | ||
publish-coverage-report: | ||
description: Publish the coverage report as a pull request comment | ||
required: false | ||
default: true | ||
type: boolean | ||
allow-failure: | ||
description: Allow workflow failure if errors from covtracer are generated | ||
required: false | ||
type: boolean | ||
default: false | ||
enable-covtracer: | ||
description: Enable the covtracer job | ||
required: false | ||
type: boolean | ||
default: false | ||
secrets: | ||
GITHUB_TOKEN: | ||
description: | | ||
Github token with read access to repositories, required | ||
for staged.dependencies installation | ||
required: false | ||
concurrency: | ||
group: coverage-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
coverage: | ||
name: Coverage π | ||
runs-on: ubuntu-latest | ||
if: > | ||
!contains(github.event.commits[0].message, '[skip coverage]') | ||
&& github.event.pull_request.draft == false | ||
container: | ||
image: ghcr.io/insightsengineering/rstudio_4.2.1_bioc_3.15:latest | ||
steps: | ||
- name: Get branch names πΏ | ||
id: branch-name | ||
uses: tj-actions/branch-names@v5 | ||
- name: Checkout repo π | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ steps.branch-name.outputs.head_ref_branch }} | ||
path: ${{ github.event.repository.name }} | ||
- name: Run Staged dependencies π¦ | ||
uses: insightsengineering/staged-dependencies-action@v1 | ||
with: | ||
run-system-dependencies: ${{ inputs.install-system-dependencies }} | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
SD_REPO_PATH: ${{ github.event.repository.name }} | ||
SD_ENABLE_CHECK: ${{ inputs.enable-staged-dependencies-check }} | ||
- name: Install R package π§ | ||
run: | | ||
setwd("${{ github.event.repository.name }}") | ||
if (file.exists("renv.lock")) renv::restore() | ||
install.packages(".", repos=NULL, type="source") | ||
shell: Rscript {0} | ||
- name: Install covr πͺ | ||
run: if (!require("covr")) install.packages("covr") | ||
shell: Rscript {0} | ||
- name: Run coverage π | ||
run: | | ||
oldwd <- getwd() | ||
setwd("${{ github.event.repository.name }}") | ||
if (file.exists("renv.lock")) { | ||
renv::restore() | ||
} | ||
setwd(oldwd) | ||
tryCatch( | ||
expr = { | ||
x <- covr::package_coverage( | ||
path="${{ github.event.repository.name }}", | ||
clean = FALSE, | ||
quiet = FALSE | ||
) | ||
print(x) | ||
covr::to_cobertura(x, filename = "coverage.xml") | ||
p <- covr::percent_coverage(x) | ||
cat(p, file = "coverage.txt", sep = "") | ||
covr::report( | ||
x, | ||
file = "coverage-report.html", | ||
browse = FALSE | ||
) | ||
}, | ||
error = function(e) { | ||
message("Errors generated during coverage analysis:") | ||
print(e) | ||
error_file <- stringr::str_match(e, "\`(.*?)\`")[, 2] | ||
if (file.exists(error_file)) { | ||
cat("__________FULL OUTPUT__________") | ||
writeLines(readLines(error_file)) | ||
} | ||
}, | ||
warning = function(w) { | ||
message("Warnings generated during coverage analysis:") | ||
print(w) | ||
} | ||
) | ||
shell: Rscript {0} | ||
- name: Check whether coverage reports exists π | ||
id: check_coverage_reports | ||
uses: andstor/file-existence-action@v1 | ||
with: | ||
files: "coverage.xml, coverage.txt, coverage-report.html" | ||
- name: Post coverage report π | ||
if: steps.check_coverage_reports.outputs.files_exists == 'true' | ||
uses: insightsengineering/coverage-action@v1 | ||
with: | ||
path: coverage.xml | ||
threshold: 80 | ||
fail: false | ||
publish: ${{ inputs.publish-coverage-report }} | ||
- name: Upload report πΌ | ||
if: steps.check_coverage_reports.outputs.files_exists == 'true' | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: coverage-report | ||
path: "coverage-report.html" | ||
covtracer: | ||
name: Covtracer π | ||
runs-on: ubuntu-latest | ||
if: > | ||
!contains(github.event.commits[0].message, '[skip coverage]') | ||
&& github.event.pull_request.draft == false | ||
&& contains(inputs.enable-covtracer, 'true') | ||
container: | ||
image: ghcr.io/insightsengineering/rstudio_4.2.1_bioc_3.15:latest | ||
steps: | ||
- name: Get branch names πΏ | ||
id: branch-name | ||
uses: tj-actions/branch-names@v5 | ||
- name: Checkout repo π | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ steps.branch-name.outputs.head_ref_branch }} | ||
path: ${{ github.event.repository.name }} | ||
- name: Run Staged dependencies π¦ | ||
uses: insightsengineering/staged-dependencies-action@v1 | ||
with: | ||
run-system-dependencies: ${{ inputs.install-system-dependencies }} | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
SD_REPO_PATH: ${{ github.event.repository.name }} | ||
SD_ENABLE_CHECK: ${{ inputs.enable-staged-dependencies-check }} | ||
- name: Run Covtracer π | ||
uses: insightsengineering/covtracer-action@v1 | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
path: ${{ github.event.repository.name }} | ||
allow-failure: ${{ inputs.allow-failure }} |