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: R Package Validation report | |
on: | |
workflow_dispatch: | |
inputs: | |
r-version: | |
description: 'The version of R to use' | |
default: '4.1' | |
required: false | |
type: choice | |
options: | |
- '4.1' | |
- '4.2' | |
- '4.3' | |
workflow_call: | |
inputs: | |
r-version: | |
description: 'The version of R to use' | |
default: '4.1' | |
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/[email protected] | |
- name: Checkout repo (PR) 🛎 | |
uses: actions/checkout@v3 | |
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/checkout@v3 | |
if: github.event_name != 'pull_request' | |
with: | |
ref: ${{ steps.branch-name.outputs.head_ref_branch }} | |
- name: Normalize inputs | |
id: normalizer | |
run: | | |
R_VERSION="${{ inputs.r-version }}" | |
if [ "$R_VERSION" == "" ] | |
then { | |
R_VERSION="4.1" | |
} | |
fi | |
echo "R_VERSION=$R_VERSION" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Restore cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.staged.dependencies | |
key: staged-deps | |
- name: Run Staged dependencies | |
uses: insightsengineering/[email protected] | |
with: | |
run-system-dependencies: false | |
renv-restore: false | |
enable-check: false | |
cran-repos: "RSPM=${{ env.R_REPOS }}" | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
##################### END boilerplate steps ##################### | |
- name: Build report | |
uses: insightsengineering/[email protected] | |
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 |