Skip to content

Commit

Permalink
create github workflows to check pkg and build site
Browse files Browse the repository at this point in the history
  • Loading branch information
RC-88 committed Mar 20, 2023
1 parent 0b47dcc commit 1957fe2
Show file tree
Hide file tree
Showing 6 changed files with 266 additions and 3 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/R-CMD-CHECK.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 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: master
pull_request:
branches: master
release:
types: [published]
workflow_dispatch:

name: rcmdcheck

jobs:
rcmdcheck:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: rcmdcheck-${{ github.event_name != 'pull_request' }}
cancel-in-progress: true
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3

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

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- name: Run R-CMD-CHECK
if: github.event_name != 'pull_request'
uses: r-lib/actions/check-r-package@v2
with:
args: 'c("--no-manual", "--as-cran", "--no-tests", "--no-examples")'
env:
_R_CHECK_FORCE_SUGGESTS_: false
_R_CHECK_CRAN_INCOMING_REMOTE_: false
DISPLAY: 99.0
56 changes: 56 additions & 0 deletions .github/workflows/document.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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: master
paths:
- '.github/workflows/document.yaml'
- 'R/**'
pull_request:
branches: master
release:
types: [published]
workflow_dispatch:

name: document

jobs:
document:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: document-${{ github.event_name != 'pull_request' }}
cancel-in-progress: true
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_DOCS }}

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

- name: Install dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::roxygen2
needs: roxygen2

- name: Document
run: roxygen2::roxygenise()
shell: Rscript {0}

- name: Commit and push changes
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 "Update documentation" || echo "No changes to commit"
git pull --ff-only
git push origin master || echo "No changes to commit"
63 changes: 63 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 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: master
paths:
- '.github/workflows/pkgdown.yaml'
- 'vignettes/**'
- 'man/**.Rd'
- 'README.md'
- 'DESCRIPTION'
- 'LICENSE'
- 'NEWS.md'
- '_pkgdown.yml'
pull_request:
branches: master
release:
types: [published]
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

name: pkgdown

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' }}
cancel-in-progress: true
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3

- 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/github-pages-deploy-action@v4.4.1
with:
token: ${{ secrets.GH_DOCS }}
branch: gh-pages
folder: .
clean: false
52 changes: 52 additions & 0 deletions .github/workflows/render-news-rmd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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: master
paths:
- '.github/workflows/render-news-rmd.yaml'
- 'NEWS.Rmd'
pull_request:
branches: master
release:
types: [published]
workflow_dispatch:

name: render-news-rmd

jobs:
render-news-rmd:
runs-on: ubuntu-latest
concurrency:
group: news-${{ github.event_name != 'pull_request' }}
cancel-in-progress: true
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_DOCS }}

- 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::rmarkdown, local::.
needs: render

- name: Render NEWS
run: Rscript -e 'rmarkdown::render("NEWS.Rmd", output_format="md_document")'

- name: Commit rendered NEWS
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
git add NEWS.md
git commit -m "Re-build NEWS.md" || echo "No changes to commit"
git push origin master || echo "No changes to commit"
52 changes: 52 additions & 0 deletions .github/workflows/render-readme-rmd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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: master
paths:
- '.github/workflows/render-readme-rmd.yaml'
- 'README.Rmd'
pull_request:
branches: master
release:
types: [published]
workflow_dispatch:

name: render-readme-rmd

jobs:
render-readme-rmd:
runs-on: ubuntu-latest
concurrency:
group: readme-${{ github.event_name != 'pull_request' }}
cancel-in-progress: true
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_DOCS }}

- 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::rmarkdown, local::.
needs: render

- name: Render README
run: Rscript -e 'rmarkdown::render("README.Rmd", output_format="md_document")'

- name: Commit rendered README
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
git add README.md man/figures/README-*
git commit -m "Re-build README.md" || echo "No changes to commit"
git push origin master || echo "No changes to commit"
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
.git
.project

# github actions
.github

# History files
.Rhistory
.Rapp.history
Expand Down

0 comments on commit 1957fe2

Please sign in to comment.