Skip to content

Commit

Permalink
Merge pull request #59 from nhs-r-community/58-gh-action
Browse files Browse the repository at this point in the history
Updated gh-actions and badges
  • Loading branch information
Lextuga007 committed Jul 12, 2023
2 parents 80c321c + 7ce9c83 commit 87800e0
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 119 deletions.
82 changes: 13 additions & 69 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,85 +1,29 @@
# 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
# 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: R-CMD-check

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

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

strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}

runs-on: ubuntu-latest
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-pandoc@v1
use-public-rspm: true

- 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}

- name: Restore R package cache
if: runner.os != 'Windows'
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-

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}
extra-packages: any::rcmdcheck
needs: check

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
- uses: r-lib/actions/check-r-package@v2
58 changes: 30 additions & 28 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -1,46 +1,48 @@
# 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:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

jobs:
pkgdown:
runs-on: macOS-latest
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@v2

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

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

- 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: Cache R packages
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::pkgdown, local::.
needs: website

- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
install.packages("pkgdown", type = "binary")
- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Deploy package
run: |
git config --local user.email "nhs.rcommunity@nhs.net"
git config --local user.name "NHS-R Community"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
clean: false
branch: gh-pages
folder: docs
5 changes: 3 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ knitr::opts_chunk$set(
)
```

# NHS R-community Datasets <a href='https://nhsrcommunity.com/'><img src='https://nhs-r-community.github.io/assets/logo/nhsr-logo.png' align="right" height="80" /></a>
# NHS-R Community Datasets <a href='https://nhsrcommunity.com/'><img src='https://nhs-r-community.github.io/assets/logo/nhsr-logo.png' align="right" height="80" /></a>


<!-- badges: start -->
[![R-CMD-check](https://github.com/nhs-r-community/NHSRdatasets/workflows/R-CMD-check/badge.svg)](https://github.com/nhs-r-community/NHSRdatasets/actions)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![CRAN version](https://www.r-pkg.org/badges/version/NHSRdatasets)](https://cran.r-project.org/package=NHSRdatasets)
[![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/NHSRdatasets)](https://cran.r-project.org/package=NHSRdatasets)
[![R-CMD-check](https://github.com/nhs-r-community/NHSRdatasets/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nhs-r-community/NHSRdatasets/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

<br><br>
Expand All @@ -27,7 +28,7 @@ Please visit: [nhsrcommunity.com](https://nhsrcommunity.com/)

## Datasources for reuse

This package has been created to help NHS, Public Health and related analysts/data scientists learn to use `R`. It contains several free datasets (just one at the moment), help files explaining their structure, and `vignette` examples of their use. We encourage contributions to the package, both to expand the set of training material, but also as development for newer `R`/github users as a first contribution. Please add relevant free, open source data sets that you think may benefit the NHS R-community.
This package has been created to help NHS, Public Health and related analysts/data scientists learn to use `R`. It contains several free datasets (just one at the moment), help files explaining their structure, and `vignette` examples of their use. We encourage contributions to the package, both to expand the set of training material, but also as development for newer `R`/github users as a first contribution. Please add relevant free, open source data sets that you think may benefit the NHS-R Community.

## Installation instructions

Expand Down
41 changes: 21 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# NHS R-community Datasets <a href='https://nhsrcommunity.com/'><img src='https://nhs-r-community.github.io/assets/logo/nhsr-logo.png' align="right" height="80" /></a>
# NHS-R Community Datasets <a href='https://nhsrcommunity.com/'><img src='https://nhs-r-community.github.io/assets/logo/nhsr-logo.png' align="right" height="80" /></a>

<!-- badges: start -->

Expand All @@ -10,6 +10,7 @@ developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.re
[![CRAN
version](https://www.r-pkg.org/badges/version/NHSRdatasets)](https://cran.r-project.org/package=NHSRdatasets)
[![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/NHSRdatasets)](https://cran.r-project.org/package=NHSRdatasets)
[![R-CMD-check](https://github.com/nhs-r-community/NHSRdatasets/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nhs-r-community/NHSRdatasets/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

<br><br>
Expand All @@ -25,7 +26,7 @@ structure, and `vignette` examples of their use. We encourage
contributions to the package, both to expand the set of training
material, but also as development for newer `R`/github users as a first
contribution. Please add relevant free, open source data sets that you
think may benefit the NHS R-community.
think may benefit the NHS-R Community.

## Installation instructions

Expand All @@ -45,27 +46,27 @@ in training or publications.

**To contribute, please:**

- Fork the repository.
- Add your dataset in the `data` folder, in `.rda` format. The best
way to do this is with the `usethis` package with “gzip”
compression: `usethis::use_data(data, compress="gzip")`
- Please add a minimal `R` function to act as a help file. You can use
the `LOS_model` as a guide.
- Please add a `vignette` demonstrating how the data has been/can be
used.
- Create a pull request, detailing your additions, and we will review
it before merging.
- Fork the repository.
- Add your dataset in the `data` folder, in `.rda` format. The best way
to do this is with the `usethis` package with “gzip” compression:
`usethis::use_data(data, compress="gzip")`
- Please add a minimal `R` function to act as a help file. You can use
the `LOS_model` as a guide.
- Please add a `vignette` demonstrating how the data has been/can be
used.
- Create a pull request, detailing your additions, and we will review it
before merging.

<br> ***When contributing a dataset, the contributor certifies that:***

- They are the data owner, or are authorised to republish the dataset
in question.
- The dataset does not contain real patient-level data.
- Where based on patient data, the contributor takes full
responsibility for sharing the data and certifies that. it is has
been processed, anonymised, aggregated or otherwise protected in
accordance with all legal requirements under General Data Protection
Regulation (GDPR), or other relevant legislation.
- They are the data owner, or are authorised to republish the dataset in
question.
- The dataset does not contain real patient-level data.
- Where based on patient data, the contributor takes full responsibility
for sharing the data and certifies that. it is has been processed,
anonymised, aggregated or otherwise protected in accordance with all
legal requirements under General Data Protection Regulation (GDPR), or
other relevant legislation.

Please note that the ‘NHSRdatasets’ project is released with a
[Contributor Code of
Expand Down

0 comments on commit 87800e0

Please sign in to comment.