Skip to content

Commit

Permalink
Add workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Cazelles authored and KevCaz committed Nov 16, 2023
1 parent 014e77f commit f426b01
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 25 deletions.
34 changes: 18 additions & 16 deletions .github/workflows/R-CMD-check-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
pull_request:
branches: [main, master]

name: R-CMD-check-all

jobs:
changes:
runs-on: ubuntu-latest
Expand All @@ -15,24 +17,24 @@ jobs:
packages: ${{ steps.filter.outputs.changes }}
steps:
# For pull requests it's not necessary to checkout the code
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
testpkg01: testpkg01
testpkg02: testpkg02
testpkg01: 'testpkg01/**'
testpkg02: 'testpkg02/**'
# JOB to build and test each of modified packages
build:
needs: changes
secrets: inherit
strategy:
matrix:
# Parse JSON array containing names of all filters matching any of changed files
# e.g. ['package1', 'package2'] if both package folders contains changes
package: ${{ fromJSON(needs.changes.outputs.packages) }}
runs-on: ubuntu-20.04
steps:
- uses: ./.github/workflows/R-CMD-check.yaml
with:
pkg-path: ${{ matrix.package }}
# JOB to build and test each of modified packages
build:
needs: changes
# https://github.com/dorny/paths-filter/issues/66
if: ${{ needs.changes.outputs.packages != '[]' && needs.changes.outputs.packages != '' }}
strategy:
matrix:
# see https://github.com/dorny/paths-filter
package: ${{ fromJSON(needs.changes.outputs.packages) }}
uses: ./.github/workflows/R-CMD-check.yaml
secrets: inherit
with:
pkg-path: ${{ matrix.package }}
12 changes: 5 additions & 7 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,24 @@ name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v2
working-directory: ${{ inputs.pkg-path }}

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
working-directory: ${{ inputs.pkg-path }}

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: [cover, goodpractice, rcmdcheck, lintr]
working-directory: ${{ inputs.pkg-path }}
extra-packages: rcmdcheck, any::covr, any::goodpractice, any::lintr
working-directory: ${{ inputs.pkg-path }}

- uses: r-lib/actions/check-r-package@v2
working-directory: ${{ inputs.pkg-path }}
with:
working-directory: ${{ inputs.pkg-path }}

- name: Code coverage
run: covr::package_coverage()
Expand Down
2 changes: 1 addition & 1 deletion testpkg01/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: testpkg01
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9001
Version: 0.0.0.9006
Authors@R:
person("First", "Last", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "YOUR-ORCID-ID"))
Expand Down
1 change: 1 addition & 0 deletions testpkg01/NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Generated by roxygen2: do not edit by hand

export(hello)
5 changes: 5 additions & 0 deletions testpkg01/R/hello.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#' Hello world
#' @export
hello <- function() {
"Hello World 2!"
}
11 changes: 11 additions & 0 deletions testpkg01/man/hello.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion testpkg02/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: testpkg02
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Version: 0.0.0.9004
Authors@R:
person("First", "Last", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "YOUR-ORCID-ID"))
Expand Down

0 comments on commit f426b01

Please sign in to comment.