usethis::use_tidy_github_actions()
diff --git a/.Rbuildignore b/.Rbuildignore
index 406b496..59fc2cd 100644
--- a/.Rbuildignore
+++ b/.Rbuildignore
@@ -4,3 +4,5 @@
examples/
+^codecov\.yml$
+^\.github$
diff --git a/.github/.gitignore b/.github/.gitignore
new file mode 100644
index 0000000..2d19fc7
--- /dev/null
+++ b/.github/.gitignore
@@ -0,0 +1 @@
+*.html
diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml
new file mode 100644
index 0000000..6ab6888
--- /dev/null
+++ b/.github/workflows/R-CMD-check.yaml
@@ -0,0 +1,70 @@
+# 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, master]
+ pull_request:
+ 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: 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'}
+ - {os: ubuntu-18.04, r: 'oldrel-2'}
+ - {os: ubuntu-18.04, r: 'oldrel-3'}
+ - {os: ubuntu-18.04, r: 'oldrel-4'}
+
+ env:
+ GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+ R_KEEP_PKG_SOURCE: yes
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - uses: r-lib/actions/setup-pandoc@v1
+
+ - uses: r-lib/actions/setup-r@v1
+ 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@v1
+ with:
+ extra-packages: rcmdcheck
+
+ - uses: r-lib/actions/check-r-package@v1
+
+ - 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
diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml
new file mode 100644
index 0000000..1cdafbf
--- /dev/null
+++ b/.github/workflows/pr-commands.yaml
@@ -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: 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: 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 }}
diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml
new file mode 100644
index 0000000..3c0da1c
--- /dev/null
+++ b/.github/workflows/test-coverage.yaml
@@ -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, master]
+ pull_request:
+ branches: [main, master]
+
+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@v1
+ with:
+ use-public-rspm: true
+
+ - uses: r-lib/actions/setup-r-dependencies@v1
+ with:
+ extra-packages: covr
+
+ - name: Test coverage
+ run: covr::codecov()
+ shell: Rscript {0}
diff --git a/DESCRIPTION b/DESCRIPTION
index 30f5a45..75aada7 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -23,6 +23,7 @@
Imports:
rmarkdown (>= 1.0)
Suggests:
+ covr,
testthat
RoxygenNote: 7.0.2
Roxygen: list(markdown = TRUE)
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 0000000..04c5585
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,14 @@
+comment: false
+
+coverage:
+ status:
+ project:
+ default:
+ target: auto
+ threshold: 1%
+ informational: true
+ patch:
+ default:
+ target: auto
+ threshold: 1%
+ informational: true