Skip to content

Commit

Permalink
adds github actions (#197)
Browse files Browse the repository at this point in the history
* adds github actions

* minor

* also lint

* skip for now
  • Loading branch information
IndrajeetPatil authored Nov 9, 2021
1 parent aea83b9 commit 5a3293b
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/check-pak.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# 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
#
# NOTE: This workflow is overkill for most R packages and
# check-standard.yaml is likely a better choice.
# usethis::use_github_action("check-standard") will install it.
# on:
# push:
# branches: [main, develop]
# pull_request:
# branches: [main, develop]
#
# 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: macOS-latest, r: 'release'}
#
# - {os: windows-latest, r: 'release'}
# # Use 3.6 to trigger usage of RTools35
# - {os: windows-latest, r: '3.6'}
#
# # Use older ubuntu to maximise backward compatibility
# - {os: ubuntu-18.04, r: 'devel', http-user-agent: 'release'}
# - {os: ubuntu-18.04, r: 'release'}
# - {os: ubuntu-18.04, r: 'oldrel-1'}
#
# env:
# GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
# R_KEEP_PKG_SOURCE: yes
#
# steps:
# - uses: actions/checkout@v2
#
# - uses: r-lib/actions/setup-pandoc@master
#
# - uses: r-lib/actions/setup-r@master
# with:
# r-version: ${{ matrix.config.r }}
# http-user-agent: ${{ matrix.config.http-user-agent }}
# use-public-rspm: true
#
# - uses: r-lib/actions/setup-r-dependencies@master
# with:
# extra-packages: rcmdcheck
#
# - uses: r-lib/actions/check-r-package@master
#
# - name: Show testthat output
# if: always()
# run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
# shell: bash
#
# - name: Upload check results
# if: failure()
# uses: actions/upload-artifact@main
# with:
# name: ${{ runner.os }}-r${{ matrix.config.r }}-results
# path: check
29 changes: 29 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: lint

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

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

- uses: r-lib/actions/setup-r-dependencies@master
with:
extra-packages: lintr

- name: Lint
run: lintr::lint_package()
shell: Rscript {0}
51 changes: 51 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
on:
push:
branches:
- main
- master

name: pkgdown

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

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

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

- 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
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 dependencies
run: |
install.packages("remotes")
# To get links for homepage
remotes::install_cran("devtools")
remotes::install_deps(dependencies = TRUE)
remotes::install_dev("pkgdown")
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Deploy package
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE, clean = TRUE)'
30 changes: 30 additions & 0 deletions .github/workflows/test-coverage-pak.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 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:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]

name: test-coverage

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2

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

- uses: r-lib/actions/setup-r-dependencies@master
with:
extra-packages: covr

- name: Test coverage
run: covr::codecov()
shell: Rscript {0}

0 comments on commit 5a3293b

Please sign in to comment.