Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting started vignette #60

Merged
merged 16 commits into from
Oct 18, 2021
Merged

Conversation

assignUser
Copy link
Collaborator

Closes #42

Let me know what you think :)

had to uninstall precommit to be able to commit the readme changes because the hook uses bash (but it looks like there are already multiple issues related to it so i wont open one 👍 ).

@lorenzwalthert
Copy link
Owner

Cool. Thanks, I’ll look at it later this week tie earliest unfortunately.

You can git commit —no-verify or SKIP=hook-id git commit to skip hooks as per the documentation. We‘ll switch to R based hook soon so tue path issues won’t persist forever.

@assignUser assignUser mentioned this pull request Sep 14, 2021
12 tasks
touchstone::refs_install() # installs branches to benchmark
touchstone::pin_assets("data/all.Rdata", "inst/scripts") # pin files and directories

load(path_pinned_asset("all.Rdata")) # perform other setup you need for the benchmarks
Copy link
Owner

Choose a reason for hiding this comment

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

Ideally, this would actually be load(path_pinned_asset("all.Rdata")), don't you think? Do we place all assets in the temp directory root?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am not quite sure I understand, that's what it says?

We have separate dirs in the temp dir for head and base ref now that we allow pinning from both to avoid name collisions.

Copy link
Owner

Choose a reason for hiding this comment

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

We have separate dirs in the temp dir for head and base ref now that we allow pinning from both to avoid name collisions.

Yes, but if I pin data/all.Rdata, it would be most natural to access it with path_pinned_asset("data/all.Rdata") instead of path_pinned_asset("all.Rdata"). Do you agree or not?

Copy link
Owner

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll plan some time for this and the other issue this coming week :)

Copy link
Owner

Choose a reason for hiding this comment

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

Great. Thanks to your help, we have #64 and are ready for a CRAN submission after this PR and #63.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We only want this to work for subdirectories of the current working directory/git repo right? So a path like ./../../../some/dir should be invalid assuming . is the root of the git repo, right?

Copy link
Owner

Choose a reason for hiding this comment

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

I agree it should be invalid. And all paths should be relative to the repo root. For other patients logic, do we also take the repo root as a starting point or are some things relative to touchstone/? This should be consistent across the API.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@lorenzwalthert This should now work as we expect, I added some handling of the repo root as we only did this implicitly up to now, please check if the way I implemented this is ok for you. I still need to update the documentation at some points etc. put functionally it should be ok ) also added/modified the tests.

touchstone::pin_assets("data/all.Rdata", "inst/scripts") # pin files and directories

load(path_pinned_asset("all.Rdata")) # perform other setup you need for the benchmarks
source(path_pinned_asset("scripts/prepare.R"))
Copy link
Owner

Choose a reason for hiding this comment

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

potentially confusing for the user because this script is not pinned...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I choose these examples to illustrate that you can pin both files and directories and how only the last dir is copied when you use nested dirs.

Copy link
Owner

Choose a reason for hiding this comment

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

only the last dir is copied

Ok, this is probably related to what I wrote above. I think the whole directory tree should be copied, not just the last directory.

Copy link
Owner

Choose a reason for hiding this comment

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

Can we change that?

@lorenzwalthert
Copy link
Owner

lorenzwalthert commented Oct 17, 2021

@assignUser thanks, I can have a look at resolving the merge conflicts now...

@lorenzwalthert
Copy link
Owner

I think there are a few related things that we should improve:

  • touchstone.assets_dir* should be set in .onLoad() to make things more flexible (also testing)
  • {withr} statements should not be nested if possible for easier error identification.
  • I believe the assets are not correctly copied into the right directory, it's a bit tricky.
  • more tests for copying
  • running locally and on CI/CD creates new snaps for macOS and Windows, I don't know why...

I will look into this next week hopefully.

@lorenzwalthert
Copy link
Owner

Thanks for the work you did so far @assignUser 👍

@assignUser
Copy link
Collaborator Author

* running locally and on CI/CD creates new snaps for macOS and Windows, I don't know why...

This was an issue with the new git_rootoption not being set in the test, I fixed that and also un-nested the withr calls. Actually this seems to be caused by the temp paths being different on the mac/windows runners for some reason:

 - "C:/Users/runneradmin/AppData/Local/Temp/RtmpYb4HIg/working_dir/RtmpW0XVk4/with-git"
+ "C:/Users/RUNNER~1/AppData/Local/Temp/RtmpYb4HIg/working_dir/RtmpW0XVk4/with-git"

- "/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpKkiy5N/working_dir/RtmpacJFHY/with-git"
+ "/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/RtmpKkiy5N/working_dir/RtmpacJFHY/with-git"

I am looking into it

@lorenzwalthert
Copy link
Owner

ok, thanks. I'll look into the other things then...

@lorenzwalthert
Copy link
Owner

lorenzwalthert commented Oct 18, 2021

I had the tempfile problem before somewhere else. I just deactivated the test for Windows: 11cfc5e. We could also opt against using a snap and do a regex match of the path instead where we try to match the part after /private/var (for macOS).

@assignUser
Copy link
Collaborator Author

Yeah the reason seems to be (on windows, idk why it does this on mac? Ihave no mac myslef to test that behaviour nor any experience with macos)
r-lib/actions#217
actions/runner-images#712

@assignUser
Copy link
Collaborator Author

re:mac it appears that /var/folder is a sym link to /private/var/folders so the issue was most likely caused by my use of fs::path_real which replaces sym links. I now modified the tests to also use path_real to remove the windows shortname/mac sym link. And that seems to have worked :)

@assignUser
Copy link
Collaborator Author

  • touchstone.assets_dir* should be set in .onLoad() to make things more flexible (also testing)
  • {withr} statements should not be nested if possible for easier error identification.
  • I believe the assets are not correctly copied into the right directory, it's a bit tricky.
    more tests for copying <- can't confirm, locally it works as intended and tests seem to also be fine?
  • running locally and on CI/CD creates new snaps for macOS and Windows, I don't know why...

@lorenzwalthert
Copy link
Owner

Great @assignUser 👍, thanks a lot. I'll discuss my concerns in s separate issue I think, since this is on the brink of going off topic 😄

@lorenzwalthert lorenzwalthert merged commit cc98ff7 into lorenzwalthert:main Oct 18, 2021
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.

Create "Getting started" vignette
2 participants