generated from pharmaverse/admiraltemplate
-
Notifications
You must be signed in to change notification settings - Fork 4
99 lines (89 loc) · 2.87 KB
/
r-pkg-validation.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: R Package Validation report
on:
workflow_dispatch:
inputs:
r-version:
description: "The version of R to use"
default: "release"
required: false
type: choice
options:
- devel
- latest
workflow_call:
inputs:
r-version:
description: "The version of R to use"
default: "release"
required: false
type: string
release:
types: [published]
jobs:
r-pkg-validation:
name: Generate
runs-on: ubuntu-latest
container:
image: "ghcr.io/pharmaverse/admiralci-${{ inputs.r-version }}:latest"
# Set Github token permissions
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_REPOS: "https://packagemanager.posit.co/cran/2021-03-31/"
permissions:
contents: write
packages: write
deployments: write
steps:
##################### BEGIN boilerplate steps #####################
- name: Get branch names
id: branch-name
uses: tj-actions/branch-names@v8
- name: Checkout repo (PR) 🛎
uses: actions/[email protected]
if: github.event_name == 'pull_request'
with:
ref: ${{ steps.branch-name.outputs.head_ref_branch }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Checkout repository
uses: actions/[email protected]
if: github.event_name != 'pull_request'
with:
ref: ${{ steps.branch-name.outputs.head_ref_branch }}
- name: Restore cache
uses: actions/cache@v4
with:
path: |
~/.staged.dependencies
key: staged-deps
- name: Run Staged dependencies
uses: insightsengineering/staged-dependencies-action@v1
with:
run-system-dependencies: false
renv-restore: false
enable-check: false
cran-repos: "RSPM=${{ env.R_REPOS }}"
direction: upstream
git-ref: ${{ steps.branch-name.outputs.current_branch }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies from DESCRIPTION
run: |
remotes::install_local(force = TRUE, dependencies = TRUE)
shell: Rscript {0}
##################### END boilerplate steps #####################
- name: Build report
uses: insightsengineering/thevalidatoR@v2
id: validation
with:
disable_install_dev_deps: true
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- name: Upload report to release
if: success()
uses: svenstaro/upload-release-action@v2
with:
file: ${{ steps.validation.outputs.report_output_filename }}
asset_name: ${{ steps.validation.outputs.report_output_filename }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: false