Skip to content

Commit

Permalink
Merge branch 'main' into 11-gh-package-release-checks
Browse files Browse the repository at this point in the history
  • Loading branch information
sorinvoicu authored Jun 5, 2024
2 parents 9f23598 + 20eb87f commit 9b031ac
Show file tree
Hide file tree
Showing 21 changed files with 502 additions and 122 deletions.
13 changes: 0 additions & 13 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@
name: Check 📦

on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
push:
branches:
- main
workflow_call:

concurrency:
Expand All @@ -25,8 +14,6 @@ jobs:
runs-on: ubuntu-latest
container:
image: ${{ vars.CI_IMAGE }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout project ⬇️
Expand Down
13 changes: 1 addition & 12 deletions .github/workflows/gitleaks.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
---
name: Gitleaks 🌧️

on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
push:
branches:
- main
on:
workflow_call:
inputs:
gitleaks-version:
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/lintr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@
name: Lintr 🔍

on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
push:
branches:
- main
workflow_call:
inputs:
lintr_error_on_lint:
Expand All @@ -31,8 +20,6 @@ jobs:
runs-on: ubuntu-latest
container:
image: ${{ vars.CI_IMAGE }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout project ⬇️
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@
name: Pkgdown 📖

on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
push:
branches:
- main
workflow_call:

concurrency:
Expand All @@ -25,8 +14,6 @@ jobs:
runs-on: ubuntu-latest
container:
image: ${{ vars.CI_IMAGE }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout project ⬇️
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/roxygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@
name: Roxygen 📄

on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
push:
branches:
- main
workflow_call:

concurrency:
Expand All @@ -25,8 +14,6 @@ jobs:
runs-on: ubuntu-latest
container:
image: ${{ vars.CI_IMAGE }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout project ⬇️
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/shared_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
name: Checks 🧩

on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
push:
branches:
- main
workflow_call:

jobs:
Expand All @@ -10,7 +21,7 @@ jobs:
uses: boehringer-ingelheim/dv.templates/.github/workflows/check.yml@main

test:
name: Test 📦
name: Test and QC 🧪
uses: boehringer-ingelheim/dv.templates/.github/workflows/test.yml@main

lintr:
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/styler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@
name: Styler 🦄

on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
push:
branches:
- main
workflow_call:

concurrency:
Expand All @@ -25,8 +14,6 @@ jobs:
runs-on: ubuntu-latest
container:
image: ${{ vars.CI_IMAGE }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout project ⬇️
Expand Down
41 changes: 18 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,47 @@
---
name: Test 📦

on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
push:
branches:
- main
name: Test and QC 🧪

on:
workflow_call:

concurrency:
group: test-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
TEMPLATE_REF: main
TEMPLATE_REPO: boehringer-ingelheim/dv.templates

jobs:
test:
name: ${{ vars.CI_IMAGE }}
runs-on: ubuntu-latest
container:
image: ${{ vars.CI_IMAGE }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout project ⬇️
uses: actions/checkout@v4

- name: Checkout Repo Templates
- name: Checkout templates repo ⬇️
uses: actions/checkout@v4
with:
ref: main
repository: boehringer-ingelheim/dv.templates
ref: ${{env.TEMPLATE_REF}}
repository: ${{env.TEMPLATE_REPO}}
sparse-checkout: |
scripts/
inst/validation
path: templates

- name: Install package dependencies 📄
uses: boehringer-ingelheim/dv.templates/.github/actions/dependencies@main

- name: Test 📦
run: Rscript templates/scripts/test.R
- name: Test and QC 🧪
run: templates/scripts/test_qc_pkg.R
shell: Rscript {0}

- name: Archive validation results
- name: Archive validation results ⬆️
uses: actions/upload-artifact@v4
with:
name: val_results
path: inst/validation/results
path: inst/validation/results
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# dv.templates <img src="man/figures/repo-logo.svg" align="right" height="138" alt="" />

[![Build status](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/check.yml/badge.svg)](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/check.yml?query=workflow)
[![Build status](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/test.yml/badge.svg)](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/test.yml?query=workflow)
[![Build status](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/gitleaks.yml/badge.svg)](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/gitleaks.yml?query=workflow)
[![Build status](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/lintr.yml/badge.svg)](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/lintr.yml?query=workflow)
[![Build status](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/pkgdown.yml/badge.svg)](https://github.com/boehringer-ingelheim/dv.templates/actions/workflows/pkgdown.yml?query=workflow)
Expand Down
Empty file.
40 changes: 40 additions & 0 deletions inst/validation/run_validation.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
local({
# This is evaluated inside a local because, otherwise, all the variables created in the chunks of the rendered
# document leak into the environment

validation_root <- "./inst/validation"
validation_report_rmd <- file.path(validation_root, "val_report.Rmd")
validation_report_html <- "val_report.html"
validation_results <- file.path(validation_root, "results")
val_param_rds <- file.path(validation_results, "val_param.rds")

stopifnot(dir.exists(validation_root))
stopifnot(file.exists(validation_report_rmd))

stopifnot(dir.exists(validation_results))
unlink(list.files(validation_results))

saveRDS(
list(
package = pkg_name,
tests = test_results,
version = pkg_version
),
val_param_rds
)

rmarkdown::render(
input = validation_report_rmd,
params = list(
package = pkg_name,
tests = test_results,
version = pkg_version
),
output_dir = validation_results,
output_file = validation_report_html
)

# We use one of the leaked variables, created inside the validation report to asses if the validation is
# succesful or not
VALIDATION_PASSED
})
7 changes: 7 additions & 0 deletions inst/validation/specs.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Use a list to declare the specs

specs_list <- list

example_spec <- specs_list(
a_spec = "spec"
)
Loading

0 comments on commit 9b031ac

Please sign in to comment.