Skip to content

Closes #143 and modifies #139 for removal of admiral.test and adding pharmaverse sdtm #464

Closes #143 and modifies #139 for removal of admiral.test and adding pharmaverse sdtm

Closes #143 and modifies #139 for removal of admiral.test and adding pharmaverse sdtm #464

Workflow file for this run

on:
workflow_dispatch:
workflow_call:
inputs:
r-version:
description: 'The version of R to use'
default: '4.1'
required: false
type: string
push:
branches:
- main
- devel
- pre-release
pull_request:
branches:
- main
- devel
- pre-release
name: Man Pages
concurrency:
group: roxygen-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
get_r_version:
name: Get R version
runs-on: ubuntu-latest
if: >
!contains(github.event.commits[0].message, '[skip lint]')
outputs:
r-version: ${{ steps.normalizer.outputs.R_VERSION }}
steps:
- 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
lint:
name: Roxygen
runs-on: ubuntu-latest
container:
image: "ghcr.io/pharmaverse/admiralci-${{needs.get_r_version.outputs.r-version}}:latest"
if: >
!contains(github.event.commits[0].message, '[skip lint]')
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
needs: get_r_version
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/staged-dependencies-action@v1
with:
run-system-dependencies: false
renv-restore: false
enable-check: false
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
##################### END boilerplate steps #####################
- name: Generate man pages
run: roxygen2::roxygenize('.', roclets = c('rd', 'collate', 'namespace'))
shell: Rscript {0}
- name: Set-up safe dir
run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
shell: bash
- name: Roxygen check
if: "!startsWith(github.event.comment.body, '/roxygenize')"
run: |
git status -s
if [[ -n `git status -s | grep -E "man|DESCRIPTION"` ]]
then {
ROXYGEN_VERSION="$(Rscript -e 'packageVersion("roxygen2")' | awk '{print $NF}')"
echo "🙈 Manuals are not up-to-date with roxygen comments!"
echo "🔀 The following differences were noted:"
git diff man/* DESCRIPTION
echo -e "\n💻 Please rerun the following command on your workstation and push your changes"
echo "--------------------------------------------------------------------"
echo "roxygen2::roxygenize('.', roclets = c('rd', 'collate', 'namespace'))"
echo "--------------------------------------------------------------------"
echo "ℹ roxygen2 version that was used in this workflow: $ROXYGEN_VERSION"
echo "🙏 Please ensure that the 'RoxygenNote' field in the DESCRIPTION file matches this version"
exit 1
} else {
echo "💚 Manuals are up-to-date with roxygen comments"
}
fi
shell: bash