Skip to content

Commit

Permalink
Show all the inputs and outputs for setup-r in the README
Browse files Browse the repository at this point in the history
  • Loading branch information
jimhester committed Aug 26, 2021
1 parent c5d00d0 commit dbe8796
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/render-readme.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
on:
push:
paths:
- '**/README.Rmd'
- 'examples/README.Rmd'
- 'examples/*yaml'

name: Render README
Expand Down
78 changes: 78 additions & 0 deletions setup-r/README.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
output: github_document
---

<!-- README.md is generated from README.Rmd. Please edit that file -->

# setup-r

[![RStudio community](https://img.shields.io/badge/community-github--actions-blue?style=social&logo=rstudio&logoColor=75AADB)](https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions)

This action sets up an R environment for use in actions by:

- Downloading and caching a version of R by version and adding to PATH
- Registering [problem matchers](https://github.com/r-lib/actions/tree/master/setup-r/.github) for error output
- Setting the following environment variables
- `NOT_CRAN=true`
- `TZ=UTC`
- `R_LIBS_USER=tempdir/Library`
- `_R_CHECK_SYSTEM_CLOCK_=FALSE`
- Removing the `-fopenmp` flags from Makeconf on macOS, which are not supported
with Apple's default Command Line Tools compilers.
- Appending 'on GitHub Actions' to the default HTTP user agent. This is useful to
distinguish GitHub Actions package requests from other sources.
- Supplying the installed R version as a `installed-r-version` output.

## Inputs

```{r, echo = FALSE, results = "asis"}
action <- yaml::read_yaml("action.yml")
action_df <- tibble::tibble(
name = names(action$inputs),
description = purrr::map_chr(action$inputs, "description"),
default = purrr::map_chr(action$inputs, "default")
)
cat(glue::glue_data(action_df, "- **{name}** (`{default}`) - {description}"), sep = "\n")
```

## Outputs

- **installed-r-version** - The full R version installed by the action

## Usage

Basic:
```yaml
steps:
- uses: actions/checkout@master
- uses: r-lib/actions/setup-r@v1
with:
r-version: '3.5.3' # The R version to download (if necessary) and use.
- run: Rscript -e 'print("hello")'
```
Matrix Testing:
```yaml
jobs:
build:
runs-on: ubuntu-18.04
strategy:
matrix:
R: [ '3.5.3', '3.6.1' ]
name: R ${{ matrix.R }} sample
steps:
- uses: actions/checkout@master
- name: Setup R
uses: r-lib/actions/setup-r@v1
with:
r-version: ${{ matrix.R }}
- run: Rscript -e 'print("hello")'
```
## License
The scripts and documentation in this project are released under the [MIT License](LICENSE)
## Contributions
Contributions are welcome!
80 changes: 60 additions & 20 deletions setup-r/README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,66 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# setup-r

[![RStudio community](https://img.shields.io/badge/community-github--actions-blue?style=social&logo=rstudio&logoColor=75AADB)](https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions)
[![RStudio
community](https://img.shields.io/badge/community-github--actions-blue?style=social&logo=rstudio&logoColor=75AADB)](https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions)

This action sets up an R environment for use in actions by:

- Downloading and caching a version of R by version and adding to PATH
- Registering [problem matchers](https://github.com/r-lib/actions/tree/master/setup-r/.github) for error output
- Setting the following environment variables
- `NOT_CRAN=true`
- `TZ=UTC`
- `R_LIBS_USER=tempdir/Library`
- `_R_CHECK_SYSTEM_CLOCK_=FALSE`
- Removing the `-fopenmp` flags from Makeconf on macOS, which are not supported
with Apple's default Command Line Tools compilers.
- Appending 'on GitHub Actions' to the default HTTP user agent. This is useful to
distinguish GitHub Actions package requests from other sources.
- Supplying the installed R version as a `installed-r-version` output.
- Downloading and caching a version of R by version and adding to PATH
- Registering [problem
matchers](https://github.com/r-lib/actions/tree/master/setup-r/.github)
for error output
- Setting the following environment variables
- `NOT_CRAN=true`
- `TZ=UTC`
- `R_LIBS_USER=tempdir/Library`
- `_R_CHECK_SYSTEM_CLOCK_=FALSE`
- Removing the `-fopenmp` flags from Makeconf on macOS, which are not
supported with Apple’s default Command Line Tools compilers.
- Appending ‘on GitHub Actions’ to the default HTTP user agent. This
is useful to distinguish GitHub Actions package requests from other
sources.
- Supplying the installed R version as a `installed-r-version` output.

## Inputs

- **r-version** (`release`) - Version range or exact version of an R
version to use.
- **rtools-version** (\`\`) - Exact version of Rtools to use. Default
uses latest suitable rtools for the given version of R.
- **Ncpus** (`1`) - Value to set the R option `Ncpus` to.
- **crayon.enabled** (`NULL`) - Value to set the R option
`crayon.enabled` to.
- **remove-openmp-macos** (`TRUE`) - If true, remove `-fopenmp` from
the default compilation flags, e.g. `SHLIB_OPENMP_CFLAGS`, as the
macOS Command Line Tools do not support OpenMP.
- **http-user-agent** (`default`) - If “default” or "“, sets the
HTTPUserAgent option to e.g. for R 3.6.3 running on macOS
Catalina,”R/3.6.3 R (3.6.3 x86\_64-apple-darwin17.0 x86\_64
darwin17.0) on GitHub Actions“. If”release" sets the user agent to
the default user agent for the current R release. Otherwise uses
whatever value is passed to `http-user-agent`.
- **install-r** (`TRUE`) - Wether to install R during the setup or use
the existing installation in the GitHub Action image.
- **windows-path-include-mingw** (`TRUE`) - If “true” put the 64 bit
mingw directory from Rtools on the PATH for Windows builds.
- **update-rtools** (`FALSE`) - Update rtools40 compilers and
libraries to the latest builds.
- **use-public-rspm** (`FALSE`) - Use the public version of RStudio
package manager available at <https://packagemanager.rstudio.com/>
to serve binaries for Linux and Windows.

# Usage
## Outputs

See [action.yml](action.yml) for details on the available inputs and outputs.
- **installed-r-version** - The full R version installed by the action

## Usage

Basic:
```yaml

``` yaml
steps:
- uses: actions/checkout@master
- uses: r-lib/actions/setup-r@v1
Expand All @@ -32,7 +70,8 @@ steps:
```
Matrix Testing:
```yaml
``` yaml
jobs:
build:
runs-on: ubuntu-18.04
Expand All @@ -49,10 +88,11 @@ jobs:
- run: Rscript -e 'print("hello")'
```
# License
## License
The scripts and documentation in this project are released under the [MIT License](LICENSE)
The scripts and documentation in this project are released under the
[MIT License](LICENSE)
# Contributions
## Contributions
Contributions are welcome!
10 changes: 6 additions & 4 deletions setup-r/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ inputs:
rtools-version:
description: 'Exact version of Rtools to use. Default uses latest suitable
rtools for the given version of R.'
default: ''
Ncpus:
description: 'Value to set the R option `Ncpus` to.'
default: '1'
Expand All @@ -17,7 +18,7 @@ inputs:
remove-openmp-macos:
description: 'If true, remove `-fopenmp` from the default compilation
flags, e.g. `SHLIB_OPENMP_CFLAGS`, as the macOS Command Line Tools do not
support OpenMP'
support OpenMP.'
default: true
http-user-agent:
description: 'If "default" or "", sets the HTTPUserAgent option to e.g. for
Expand All @@ -27,18 +28,19 @@ inputs:
release. Otherwise uses whatever value is passed to `http-user-agent`.'
default: 'default'
install-r:
description: 'Wether to install R during the setup or use the existing installation in the GitHub Action image.'
default: true
windows-path-include-mingw:
description: 'If "true" put the 64 bit mingw directory from Rtools on the
PATH for Windows builds'
PATH for Windows builds.'
default: true
update-rtools:
description: 'Update rtools40 compilers and libraries to the latest builds'
description: 'Update rtools40 compilers and libraries to the latest builds.'
default: false
use-public-rspm:
description: 'Use the public version of RStudio package manager available
at https://packagemanager.rstudio.com/ to serve binaries for Linux and
Windows'
Windows.'
default: false
outputs:
installed-r-version:
Expand Down

0 comments on commit dbe8796

Please sign in to comment.