From 2a30a91fa2b985614aabbfbde5745d827ed17967 Mon Sep 17 00:00:00 2001 From: k-motwani <40220212+k-motwani@users.noreply.github.com> Date: Mon, 17 Jan 2022 18:31:07 -0500 Subject: [PATCH 1/5] Create r.yml --- .github/workflows/r.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/r.yml diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml new file mode 100644 index 0000000..9003470 --- /dev/null +++ b/.github/workflows/r.yml @@ -0,0 +1,37 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# +# See https://github.com/r-lib/actions/tree/master/examples#readme for +# additional example workflows available for the R community. + +name: R + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: macos-latest + strategy: + matrix: + r-version: ['3.6.3', '4.1.1', '4.1.2'] + + steps: + - uses: actions/checkout@v2 + - name: Set up R ${{ matrix.r-version }} + uses: r-lib/actions/setup-r@f57f1301a053485946083d7a45022b278929a78a + with: + r-version: ${{ matrix.r-version }} + - name: Install dependencies + run: | + install.packages(c("remotes", "rcmdcheck")) + remotes::install_deps(dependencies = TRUE) + shell: Rscript {0} + - name: Check + run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error") + shell: Rscript {0} From 7902e2990842ea6804ebecd681ce587fa7448c9e Mon Sep 17 00:00:00 2001 From: k-motwani <40220212+k-motwani@users.noreply.github.com> Date: Fri, 28 Jan 2022 21:22:34 -0500 Subject: [PATCH 2/5] Create rcmdcheck.yml --- .github/workflows/rcmdcheck.yml | 82 +++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .github/workflows/rcmdcheck.yml diff --git a/.github/workflows/rcmdcheck.yml b/.github/workflows/rcmdcheck.yml new file mode 100644 index 0000000..9dfb594 --- /dev/null +++ b/.github/workflows/rcmdcheck.yml @@ -0,0 +1,82 @@ +on: + push: + paths: ['**.R', '**.svg', '**.Rd', 'DESCRIPTION', 'NAMESPACE'] + pull_request: + paths: ['**.R', '**.svg', '**.Rd', 'DESCRIPTION', 'NAMESPACE'] + +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: '4.1.0'} + - {os: windows-latest, r: 'release'} + - {os: macOS-latest, r: '4.1.0'} + - {os: macOS-latest, r: 'release'} + - {os: ubuntu-latest, r: '4.1.0', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-latest, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + + env: + R_REMOTES_NO_ERRORS_FROM_WARNINGS: true + RSPM: ${{ matrix.config.rspm }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@v1 + with: + r-version: ${{ matrix.config.r }} + + - uses: r-lib/actions/setup-pandoc@v1 + + - 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: Cache R packages + if: runner.os != 'Windows' + uses: actions/cache@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} + + - 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 From 166254e3e51f8ec81951c2f84089c74888f9d389 Mon Sep 17 00:00:00 2001 From: k-motwani <40220212+k-motwani@users.noreply.github.com> Date: Fri, 28 Jan 2022 21:27:05 -0500 Subject: [PATCH 3/5] Update r.yml --- .github/workflows/r.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index 9003470..6aef9b5 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -30,6 +30,7 @@ jobs: - name: Install dependencies run: | install.packages(c("remotes", "rcmdcheck")) + library(remotes) remotes::install_deps(dependencies = TRUE) shell: Rscript {0} - name: Check From 830be3acce9c6bec2d7c21588eafad4fe498864d Mon Sep 17 00:00:00 2001 From: k-motwani <40220212+k-motwani@users.noreply.github.com> Date: Fri, 28 Jan 2022 21:27:36 -0500 Subject: [PATCH 4/5] Create pr-commands --- .github/workflows/pr-commands | 75 +++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/workflows/pr-commands diff --git a/.github/workflows/pr-commands b/.github/workflows/pr-commands new file mode 100644 index 0000000..190a6c2 --- /dev/null +++ b/.github/workflows/pr-commands @@ -0,0 +1,75 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/master/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + issue_comment: + types: [created] + +name: Commands + +jobs: + document: + if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }} + name: document + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/pr-fetch@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - uses: r-lib/actions/setup-r@v1 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v1 + with: + extra-packages: roxygen2 + + - name: Document + run: Rscript -e 'roxygen2::roxygenise()' + + - name: commit + run: | + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + git add man/\* NAMESPACE + git commit -m 'Document' + + - uses: r-lib/actions/pr-push@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + style: + if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }} + name: style + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/pr-fetch@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - uses: r-lib/actions/setup-r@v1 + + - name: Install dependencies + run: Rscript -e 'install.packages("styler")' + + - name: Style + run: Rscript -e 'styler::style_pkg()' + + - name: commit + run: | + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + git add \*.R + git commit -m 'Style' + + - uses: r-lib/actions/pr-push@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} From 882a0d0f16d7d16c248140788328cc118efb933d Mon Sep 17 00:00:00 2001 From: k-motwani <40220212+k-motwani@users.noreply.github.com> Date: Fri, 28 Jan 2022 21:28:26 -0500 Subject: [PATCH 5/5] Rename pr-commands to pr-commands.yml --- .github/workflows/{pr-commands => pr-commands.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{pr-commands => pr-commands.yml} (100%) diff --git a/.github/workflows/pr-commands b/.github/workflows/pr-commands.yml similarity index 100% rename from .github/workflows/pr-commands rename to .github/workflows/pr-commands.yml