Skip to content

Conversation

@corviday
Copy link
Contributor

@corviday corviday commented Jun 22, 2021

This PR adds automatic testing with github actions to this repository.

There are two goals for the CI:

  1. Provide a preview of whether proposed code changes will pass CRAN's tests. The R CMD check --as-cran command builds the code, checks it for various issues CRAN cares about (including documentation - we have to build documentation first), and runs all the tests in the tests directory. This command is run inside three containers that match the ones used by CRAN to test uploads: a linux container running the latest formally released version of R, a linux container running the bleeding-edge version of R, and a windows container running the latest formally released version of R. It should be pretty much what CRAN does - if these tests pass, CRAN should accept the package.
  2. Run tests that can't be run on CRAN due to CRAN's five minute test limit. The extra tests are kept in the tests/extra-tests folder in the repository and on CRAN, but during CI, they are copied to the main tests folder and run by R CMD check --as-cran with the rest of the tests.

It might be nice to include some tests on a Mac container, but as far as I can tell, Macs can't install the prerequisite udunits2 library.

@corviday corviday force-pushed the actions branch 9 times, most recently from e741c0d to d9d3378 Compare June 24, 2021 17:15
@corviday corviday requested a review from nikola-rados June 29, 2021 00:13
Copy link

@nikola-rados nikola-rados left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good @corviday, nice work! I have some questions and some formatting suggestions but overall this does the trick!

Comment on lines +1 to +12
# this action runs the same checks on the repository that CRAN does:
# 1. windows container with latest R release
# 2. linux container with latest R release
# 3. linux container with next R release
# to offer a preview of whether changes to the package will be
# accepted by CRAN. Testing on Mac is not done because there is not
# udunits2 library for Mac, as far as I can tell.
# It also runs the tests that are too slow for CRAN. These extra tests
# are in the tests/extra-tests directory.
# it is derived from the check-standard action from the r-lib repository,
# which can be seen here:
# https://github.com/r-lib/actions/blob/master/examples/check-standard.yaml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment here!

check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly are we naming here? The different jobs within the steps?

fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of latest could we specify the version here? I just don't want this to break in the future due to a version change.

Comment on lines +35 to +41
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@master
with:
r-version: ${{ matrix.config.r }}

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For styling purposes could we remove the extra newlines in here?

Comment on lines +69 to +70
sudo -s eval "$sysreqs"
- name: Install dependencies

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throw a newline between these separate name sections.

_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
- name: Upload check results

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

Comment on lines +85 to +89
if: failure()
uses: actions/upload-artifact@master
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if there is a failure during this testing why do we need to upload the results? Wouldn't the failure info be in the actions logs? If we are not actively using these logs we could leave out this section.

@@ -0,0 +1,99 @@
## [1.0.8] - 2021-04-26

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, a changelog is always helpful!

Comment on lines +8 to +11
person("Cairo Sanders", role = "ctb", email = "cairosanders@uvic.ca"),
person("Arelia Schoeneberg", role = "aut", email = "wernera@uvic.ca"),
person("Stephen Sobie", role = "aut", email = "ssobie@uvic.ca"),
person("Lee Zeman", role = c("aut","cre"), email = "lzeman@uvic.ca"))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like some of the formatting here is a bit off, will this have any kind of impact on the build?

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}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, but why don't we just run this in run?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants