Skip to content

Fix continuous integration #272

Closed
Closed

Description

@lorenzwalthert

Not all tic steps work anymore, because some tests that use a temp dir don't work after rcmdcheck ran successfully.
https://travis-ci.org/r-lib/styler/jobs/296269960#L1780
@krlmlr any ideas why?
Also, coverage reports are not longer generated as the CI does not work and the repo is moved.
@krlmlr How to fix that now styler is under r-lib (once we solved the first issue)?

Activity

  1. added this to the milestone on Nov 2, 2017
  2. krlmlr commented on Nov 3, 2017

    @krlmlr
    Member

    We also need to fix the NOTE: https://travis-ci.org/r-lib/styler/jobs/296269960#L1673

    Coverage is computed in the after_success() step, failures are not reported. The tests seem to run fine, but not from covr. This is also the reason why coverage reports aren't uploaded. Can you try covr::package_coverage() locally? You can also run the tic steps locally with e.g. tic::after_success().

  3. lorenzwalthert commented on Nov 3, 2017

    @lorenzwalthert
    CollaboratorAuthor

    Right, the note...
    But tic::after_success() does not run successfully from what I see.
    https://travis-ci.org/r-lib/styler/jobs/296269960#L1748
    I think the styling via the command line does fail in tic::after_success(), but the very same code does not fail with tic::script().
    I get the same error with covr locally.

    Error: Failure in `/private/var/folders/8l/fhmv3yj12kncddcjqwc19tkr0000gr/T/Rtmpdid7Je/R_LIBS30d7576c3d2/styler/styler-tests/testthat.Rout.fail`
    > library(testthat)
    > library(styler)
    > 
    > test_check("styler")
    Loading required namespace: DiagrammeR
    1. Error: repreated parsing solves wrong parent assignment (@test-parsing.R#21) -------------------------
    cannot open the connection
    1: enc::read_lines_enc(construct_out(path_perm)) at testthat/test-parsing.R:21
    2: readLines(con, warn = FALSE, n = n, ok = ok, skipNul = skipNul, encoding = "UTF-8")
    
    testthat results =========================================================================================
    OK: 110 SKIPPED: 0 FAILED: 1
    1. Error: repreated parsing solves wrong parent assignment (@test-parsing.R#21) 
    
    Error: testthat unit tests failed
    Execution halted
    

    This is the offending code, namely enc::read_lines_enc(construct_out(path_perm))

      dir <- tempfile("styler")
      dir.create(dir)
      path_temp <- file.path(dir, "repeated_parsing-in.R")
      path_perm <- testthat_file("parsing", "repeated_parsing-in.R")
      file.copy(path_perm, dir)
    
      sys_call <- paste0(
        "R -q -e \"styler::style_file(\\\"", path_temp, "\\\")\""
      )
      calls_sys(sys_call, intern = FALSE, ignore.stdout = TRUE, ignore.stderr = TRUE)
    
    
      # ---------------------------------- offending code start
      ref <- enc::read_lines_enc(construct_out(path_perm))
      # ---------------------------------- offending code end
    
    
      result <- enc::read_lines_enc(path_temp)
      expect_equal(ref, result)
      unlink(dir)
  4. krlmlr commented on Nov 3, 2017

    @krlmlr
    Member

    What happens if you extract a variable from construct_out(path_perm) ?

  5. lorenzwalthert commented on Nov 3, 2017

    @lorenzwalthert
    CollaboratorAuthor

    like

    path_out <- construct_out(path_perm)
    ref <- enc::read_lines_enc(path_out)

    ?

  6. krlmlr commented on Nov 3, 2017

    @krlmlr
    Member

    Yes.

  7. lorenzwalthert commented on Nov 3, 2017

    @lorenzwalthert
    CollaboratorAuthor

    It gives the same error.

  8. krlmlr commented on Nov 3, 2017

    @krlmlr
    Member

    Can we just skip the test if covr is running? No idea why it would succeed when running manually but not in covr.

  9. lorenzwalthert commented on Nov 5, 2017

    @lorenzwalthert
    CollaboratorAuthor

    I managed to create a minimal reproducible example here. The following lines are crucial:

    test_that("styler like works", {
      dir <- tempfile("styler")
      dir.create(dir)
      path_temp <- file.path(dir, "repeated_parsing-in.R")
      path_perm <- rprojroot::find_testthat_root_file("parsing", "repeated_parsing-in.R")
      file.copy(path_perm, dir)
      
      # identical paths, but only path_out works
      path_out <- styler:::construct_out(path_perm)
      path_out2 <- rprojroot::find_testthat_root_file("parsing", "repeated_parsing-out.R")
      identical(path_out, path_out2)
      #> TRUE
      ref <- enc::read_lines_enc(path_out2) # does not work with path_out
      result <- enc::read_lines_enc(path_temp)
      unlink(dir)
    })

    Creation of the path with styler:::construct_out() is identical with rprojroot::find_testthat_root_file() but covr does not give the same results. Maybe worthwhile an issue in r-lib/covr?

  10. lorenzwalthert commented on Nov 7, 2017

    @lorenzwalthert
    CollaboratorAuthor

    Ok, covr fixed for now. Reason why it did not work still unclear to me. @jonmcalder any interest in fixing the note introduced with #233? Afterwards, we should change tic so that a note leads to a failing built.

  11. lorenzwalthert commented on Nov 7, 2017

    @lorenzwalthert
    CollaboratorAuthor

    Reference: r-lib/covr#290

  12. 5 remaining items

  13. added 3 commits that reference this issue on Nov 8, 2017
    8933039
    a42206d
    b92d9f7
  14. lorenzwalthert commented on Nov 8, 2017

    @lorenzwalthert
    CollaboratorAuthor

    @krlmlr we don't get appveyor builds anymore. Any idea why?

  15. krlmlr commented on Nov 8, 2017

    @krlmlr
    Member

    @hadley: I guess we need to manually move styler to the r-lib org on AppVeyor. Happy to, but not sure if I have the relevant permissions.

  16. hadley commented on Nov 8, 2017

    @hadley
    Member

    Appveyor works really poorly with organisations

  17. krlmlr commented on Nov 8, 2017

    @krlmlr
    Member

    Yes, it didn't pick up the rename of rstats-db to r-dbi either. Added a new login "r-lib" for the organization, invited the r-lib team as AppVeyor administrators, and added the styler project as https://ci.appveyor.com/project/r-lib/styler. We should see there if pushes trigger builds.

  18. lorenzwalthert commented on Nov 10, 2017

    @lorenzwalthert
    CollaboratorAuthor

    Ok, thanks @krlmlr. But I don't get why the build shows passing if it actually fails (like this one). What's missing?

  19. krlmlr commented on Nov 12, 2017

    @krlmlr
    Member

    Looking into it, currently blocked by appveyor/ci#1929.

  20. lorenzwalthert commented on Nov 16, 2017

    @lorenzwalthert
    CollaboratorAuthor

    Now also the travis build fails, although code was not changed, i.e. I just pushed "bump2" to trigger another CI run.

  21. lorenzwalthert commented on Nov 16, 2017

    @lorenzwalthert
    CollaboratorAuthor

    Ok, now it seems to work again with travis, no idea why...

  22. added 2 commits that reference this issue on Nov 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions