Skip to content

Commit

Permalink
Merge branch 'main' into modify-building-rcmd-matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
galachad authored Sep 23, 2024
2 parents 25b2c07 + 8fe712f commit 46b4a7e
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ jobs:

- name: Upload report for review
if: steps.check_coverage_reports.outputs.files_exists == 'true' && github.event_name == 'pull_request'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: "coverage-report.html"
Expand Down
78 changes: 44 additions & 34 deletions .github/workflows/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ on:
workflow_dispatch:
inputs:
r-version:
description: 'The version of R to use'
default: 'release'
description: "The version of R to use"
default: "release"
required: false
type: choice
options:
- devel
- latest
skip-multiversion-docs:
description: 'Skip creation of multi-version docs'
description: "Skip creation of multi-version docs"
default: false
required: false
type: boolean
multiversion-docs-landing-page:
description: 'Ref to use for the multiversion docs landing page'
description: "Ref to use for the multiversion docs landing page"
default: main
required: false
type: string
Expand All @@ -36,17 +36,22 @@ on:
workflow_call:
inputs:
r-version:
description: 'The version of R to use'
default: 'release'
description: "The version of R to use"
default: "release"
required: false
type: string
skip-multiversion-docs:
description: 'Skip creation of multi-version docs'
description: "Skip creation of multi-version docs"
default: false
required: false
type: boolean
insert-tweak-page-hook:
description: "This option customizes the pkgdown::tweak_page function by adding a new custom hook to fix rdrr.io links"
default: true
required: false
type: boolean
multiversion-docs-landing-page:
description: 'Ref to use for the multiversion docs landing page'
description: "Ref to use for the multiversion docs landing page"
default: main
required: false
type: string
Expand Down Expand Up @@ -162,6 +167,7 @@ jobs:

- name: Add script to fix rdrr.io links for pharmaverse packages
uses: "DamianReeves/[email protected]"
if: inputs.insert-tweak-page-hook
with:
path: ./.Rprofile
write-mode: append
Expand Down Expand Up @@ -203,8 +209,10 @@ jobs:
invisible()
}
setHook("UserHook::admiralci::tweak_page", tweak_rdrr_url)
print("Tweak rdrr.io links for admiral pharmaverse packages.")
if ("${{ inputs.insert-tweak-page-hook }}" == "true") {
setHook("UserHook::admiralci::tweak_page", tweak_rdrr_url)
print("Tweak rdrr.io links for admiral pharmaverse packages.")
}
- name: Publish documentation
run: |
Expand All @@ -217,32 +225,34 @@ jobs:
}
fi
Rscript - <<EOF
pkgdown_env <- asNamespace("pkgdown")
rlang::env_unlock(env = pkgdown_env)
rlang::env_binding_unlock(env = pkgdown_env)
pkgdown_env\$call_hook <- function(hook_name, ...) {
hooks <- getHook(paste0("UserHook::admiralci::", hook_name))
if (!is.list(hooks)) {
hooks <- list(hooks)
if ("${{ inputs.insert-tweak-page-hook }}" == "true") {
pkgdown_env <- asNamespace("pkgdown")
rlang::env_unlock(env = pkgdown_env)
rlang::env_binding_unlock(env = pkgdown_env)
pkgdown_env\$call_hook <- function(hook_name, ...) {
hooks <- getHook(paste0("UserHook::admiralci::", hook_name))
if (!is.list(hooks)) {
hooks <- list(hooks)
}
purrr::map(hooks, function(fun) {
fun(...)
}) |>
invisible()
}
purrr::map(hooks, function(fun) {
fun(...)
}) %>%
invisible()
}
environment(pkgdown_env\$call_hook) <- pkgdown_env
tweak_page <- body(pkgdown_env\$tweak_page)
body(pkgdown_env\$tweak_page) <-
as.call(
append(
as.list(tweak_page),
expression(call_hook("tweak_page", html, name, pkg)),
after=length(tweak_page)
environment(pkgdown_env\$call_hook) <- pkgdown_env
tweak_page <- body(pkgdown_env\$tweak_page)
body(pkgdown_env\$tweak_page) <-
as.call(
append(
as.list(tweak_page),
expression(call_hook("tweak_page", html, name, pkg)),
after=length(tweak_page)
)
)
)
rlang::env_binding_lock(env = pkgdown_env)
rlang::env_lock(pkgdown_env)
require(desc::desc_get("Package"), character.only = TRUE)
rlang::env_binding_lock(env = pkgdown_env)
rlang::env_lock(pkgdown_env)
require(desc::desc_get("Package"), character.only = TRUE)
}
clean = FALSE
if ("${{ inputs.skip-multiversion-docs }}" == "true"){
clean = TRUE
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/push-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
run: |
package_name=$(grep "Package:" DESCRIPTION | awk '{print $NF}')
if [ "${{ matrix.tags }}" == "latest" ]; then image_name="$package_name-release"; else image_name="$package_name-${{ matrix.tags }}"; fi
if [ "${{ matrix.tags }}" == "devel" ]; then R_REPOS="https://packagemanager.posit.co/cran/__linux__/focal/latest"; fi
if [ "${{ matrix.tags }}" == "devel" ]; then R_REPOS="https://packagemanager.posit.co/cran/__linux__/focal/latest"; fi
echo "r_repos=$R_REPOS" >> $GITHUB_OUTPUT
r_version="${{ matrix.tags }}"
if [ "$r_version" == "${{ env.OLD_RELEASE }}" ]; then image_name="$package_name-oldrel"; fi # TODO: del temporary -test suffix for testing
Expand All @@ -71,7 +71,7 @@ jobs:
sysdeps: qpdf,libxt-dev,curl,npm,libicu-dev,libcurl4-openssl-dev,libssl-dev,make,zlib1g-dev,libfontconfig1-dev,libfreetype6-dev,libfribidi-dev,libharfbuzz-dev,libjpeg-dev,libpng-dev,libtiff-dev,pandoc,libxml2-dev,libgit2-dev,libgit2-dev,jq
description-file: "https://raw.githubusercontent.com/pharmaverse/admiral/main/DESCRIPTION"
repository-owner: ${{ github.repository_owner }}
repo-user: ${{ github.actor }}
repo-user: ${{ github.actor }}
repo-token: "${{ secrets.GITHUB_TOKEN }}"
repos: ${{ steps.image_specs.outputs.r_repos }}
packages: "DT,R.cache,R.methodsS3,R.oo,R.utils,backports,cellranger,collections,covr,crosstalk,cyclocomp,diffdf,git2r,hunspell,languageserver,lazyeval,lintr,progress,readxl,rematch,renv,rex,spelling,staged.dependencies,styler,xmlparsedata"
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
shell: Rscript {0}

- name: Upload deps.csv artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: deps
path: "/workspace/deps-${{ steps.store_deps.outputs.r_version }}.csv"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/r-cmd-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ jobs:
shell: Rscript {0}

- name: Upload deps.csv and renv.lock artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: deps
name: deps-${{ matrix.r_version }}
path: |
/workspace/tmp/
Expand Down Expand Up @@ -231,7 +231,7 @@ jobs:

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
uses: actions/upload-artifact@v4
with:
name: r${{ matrix.r_version }}-results
path: check

0 comments on commit 46b4a7e

Please sign in to comment.