Skip to content

Commit

Permalink
various changes from merging into main
Browse files Browse the repository at this point in the history
Merge commit '9b72b8a0cee89664e0944e22dd7155b05a6bda7e'

#Conflicts:
#	NAMESPACE
#	R/package.R
  • Loading branch information
njtierney committed Dec 9, 2024
2 parents 9e6ad45 + 9b72b8a commit cac53de
Show file tree
Hide file tree
Showing 23 changed files with 949 additions and 297 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
^codecov\.yml$
^CODE_OF_CONDUCT\.md$
^\.github$
^_pkgdown\.yml$
^docs$
^pkgdown$
133 changes: 71 additions & 62 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# NOTE: This workflow is overkill for most R packages
# check-standard.yaml is likely a better choice
# usethis::use_github_action("check-standard") will install it.
#
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
on:
push:
branches:
Expand All @@ -13,96 +7,111 @@ on:
branches:
- main
- master
schedule:
- cron: '1 23 * * Sun'

name: R-CMD-check

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
defaults:
run:
shell: Rscript {0}

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

name: ${{ matrix.os }}, tf-${{ matrix.tf }}, R-${{ matrix.r}}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: windows-latest, r: 'oldrel'}
- {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
- {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
- {os: ubuntu-18.04, r: 'oldrel-1', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
- {os: ubuntu-18.04, r: 'oldrel-2', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
include:
- {os: 'ubuntu-latest' , tf: 'default', r: 'release'}
- {os: 'windows-latest', tf: 'default', r: 'release'}
- {os: 'macOS-latest' , tf: 'default', r: 'release'}

runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.tf == 'nightly' || contains(matrix.tf, 'rc') || matrix.r == 'devel' }}
env:
RSPM: ${{ matrix.config.rspm }}
R_REMOTES_NO_ERRORS_FROM_WARNINGS: 'true'
R_COMPILE_AND_INSTALL_PACKAGES: 'never'
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
RETICULATE_AUTOCONFIGURE: 'FALSE'
TF_VERSION: '1.14.0'

steps:

- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v2
id: install-r
id: setup-r
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
r-version: ${{ matrix.r }}
Ncpus: '2L'
use-public-rspm: true

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r-dependencies@v2
- name: Get Date
id: get-date
shell: bash
run: |
echo "::set-output name=year-week::$(date -u "+%Y-%U")"
echo "::set-output name=date::$(date -u "+%F")"
- name: Restore R package cache
uses: actions/cache@v2
id: r-package-cache
with:
cache-version: 2
extra-packages: |
local::.
any::keras
any::rcmdcheck
path: ${{ env.R_LIBS_USER }}
key: ${{ matrix.os }}-${{ steps.setup-r.outputs.installed-r-version }}-${{ steps.get-date.outputs.year-week }}-1

- name: Install Miniconda
run: |
reticulate::install_miniconda()
shell: Rscript {0}
- name: Install remotes
if: steps.r-package-cache.outputs.cache-hit != 'true'
run: install.packages("remotes")

- name: Set options for conda binary for macOS
if: runner.os == 'macOS'
- name: Install system dependencies
if: runner.os == 'Linux'
shell: bash
run: |
echo "options(reticulate.conda_binary = reticulate:::miniconda_conda())" >> .Rprofile
. /etc/os-release
while read -r cmd
do
echo "$cmd"
sudo $cmd
done < <(Rscript -e "writeLines(remotes::system_requirements('$ID-$VERSION_ID'))")
- name: Install package + deps
run: remotes::install_local(dependencies = TRUE, force = TRUE)

- name: Install TensorFlow
- name: Install greta deps
run: |
cat("::group::Create Environment", sep = "\n")
reticulate::conda_create('r-reticulate', packages = c('python==3.7'))
cat("::endgroup::", sep = "\n")
library(greta)
greta::install_greta_deps(timeout = 50)
cat("::group::Install Tensorflow", sep = "\n")
keras::install_keras(tensorflow = Sys.getenv('TF_VERSION'),
extra_packages = c('IPython', 'requests', 'certifi', 'urllib3', 'tensorflow-probability==0.7.0', 'numpy==1.16.4'))
cat("::endgroup::", sep = "\n")
shell: Rscript {0}
- name: Situation Report on greta install
run: greta::greta_sitrep()

- name: Install rcmdcheck
run: remotes::install_cran("rcmdcheck")

- name: Python + TF details
run: |
tensorflow::tf_config()
tensorflow::tf_version()
reticulate::py_module_available("tensorflow_probability")
reticulate::py_config()
shell: Rscript {0}
- name: Check
run: rcmdcheck::rcmdcheck(args = '--no-manual', error_on = 'warning', check_dir = 'check')

- name: Show testthat output
if: always()
shell: bash
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true

- name: Don't use tar from old Rtools to store the cache
if: ${{ runner.os == 'Windows' && startsWith(steps.install-r.outputs.installed-r-version, '3') }}
shell: bash
run: echo "C:/Program Files/Git/usr/bin" >> $GITHUB_PATH

- name: Check on single core machine
if: runner.os != 'Windows'
env:
R_PARALLELLY_AVAILABLE_CORES: 1
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--no-multiarch"))

- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}

- uses: r-lib/actions/check-r-package@v2
with:
args: 'c("--no-manual", "--as-cran", "--no-multiarch")'

49 changes: 49 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
release:
types: [published]
workflow_dispatch:

name: pkgdown.yaml

permissions: read-all

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
113 changes: 63 additions & 50 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,76 +1,89 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches:
- main
- master
branches: [main, master]
pull_request:
branches:
- main
- master
branches: [main, master]

name: test-coverage
name: test-coverage.yaml

permissions: read-all

jobs:
test-coverage:
runs-on: macOS-latest
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1

- uses: r-lib/actions/setup-pandoc@v1
steps:
- uses: actions/checkout@v4

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Restore R package cache
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
extra-packages: |
any::covr
any::xml2
any::remotes
needs: coverage

- name: Install dependencies
- name: Install system dependencies
if: runner.os == 'Linux'
shell: bash
run: |
install.packages(c("remotes"))
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("covr")
. /etc/os-release
while read -r cmd
do
echo "$cmd"
sudo $cmd
done < <(Rscript -e "writeLines(remotes::system_requirements('$ID-$VERSION_ID'))")
- name: Install package + deps
run: remotes::install_local(dependencies = TRUE, force = TRUE)
shell: Rscript {0}

###
- name: Install Miniconda
- name: Install greta deps
run: |
install.packages(c("remotes", "keras"))
reticulate::install_miniconda()
library(greta)
greta::install_greta_deps(timeout = 50)
shell: Rscript {0}

- name: Set options for conda binary for macOS
if: runner.os == 'macOS'
run: |
echo "options(reticulate.conda_binary = reticulate:::miniconda_conda())" >> .Rprofile
- name: Situation Report on greta install
run: greta::greta_sitrep()
shell: Rscript {0}

# Perhaps here is where we can install / change the environment that we are
# installing into? Can we call our own greta install functions here?
- name: Install TensorFlow
- name: Test coverage
run: |
reticulate::conda_create(envname = "greta-env",python_version = "3.7")
reticulate::conda_install(envname = "greta-env", packages = c("numpy==1.16.4", "tensorflow-probability==0.7.0", "tensorflow==1.14.0"))
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}

- name: Python + TF details
- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
Rscript -e 'tensorflow::tf_config()'
Rscript -e 'tensorflow::tf_version()'
Rscript -e 'reticulate::py_module_available("tensorflow_probability")'
Rscript -e 'reticulate::py_config()'
###
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Test coverage
run: covr::codecov()
shell: Rscript {0}
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.Rhistory
.RData
.Rproj.user
docs
Loading

0 comments on commit cac53de

Please sign in to comment.