Skip to content

Add Coursier to Travis cache #357

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

Merged
merged 3 commits into from
Sep 13, 2019
Merged

Conversation

ashawley
Copy link
Member

This should speed up the pull requests again.

@lrytz
Copy link
Member

lrytz commented Sep 13, 2019

👍 - any .lock files or so that need to be deleted? i googled a bit and found this: https://github.com/softwaremill/sttp/blob/master/.travis.yml#L17

@SethTisue
Copy link
Member

for anyone visiting this PR because I just tweeted about it, note that it's intentional that we keep the ~/.ivy2 entry, because the sbt launcher still uses it

@SethTisue SethTisue merged commit 7b6c23e into scala:master Sep 13, 2019
@ashawley
Copy link
Member Author

I've added the .lock file removal. It gave an opportunity to re-run the build with caching. It seemed to knock off 60 seconds from the build times.

@ashawley ashawley deleted the coursier-travis-cache branch September 13, 2019 18:59
@djspiewak
Copy link

I'm relatively certain that coursier doesn't actually lock anything. I don't think removing the lock files as here or in SoftwareMill's build hurts anything, but it also probably doesn't matter.

cache:
directories:
- $HOME/.ivy2/cache
- $HOME/.sbt
- $HOME/.sdkman
- $HOME/.coursier
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- $HOME/.coursier
- $HOME/.cache/coursier

https://get-coursier.io/docs/cache says:

  • on Linux, ~/.cache/coursier/v1. This also applies to Linux-based CI environments, and FreeBSD too.

...
The default location above was set up in coursier 1.0.0-RC12-1 (released on 2017/10/31). The default cache path of former versions was ~/.coursier/cache/v1, both on Linux and OS X.

In order not to re-download all artifacts again, the first version of coursier run on a system, either former or newer, sets the location for newer versions.

In other words, the location of the Coursier cache changes depending on if you've ever ran older coursier or not.

Copy link
Member

Choose a reason for hiding this comment

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

gah

Copy link
Member Author

Choose a reason for hiding this comment

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

depending on if you've ever ran older coursier or not.

How does Coursier determine that?

Travis doesn't cache ~/.coursier or ~/.cache/coursier until the user says so.

Copy link
Member

Choose a reason for hiding this comment

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

I guess coursier will use .coursier if it exists, and .cache/coursier otherwise. In the case of travis, both don't exist we didn't cache so far, so it's using the .cache/coursier. I checked that with my https://github.com/lrytz/travis-test repo.

@SethTisue
Copy link
Member

@alexarchambault do we not need the lock-removal line?

SethTisue added a commit to SethTisue/Project-Euler that referenced this pull request Sep 13, 2019
@ashawley
Copy link
Member Author

I had the same skepticism about the lock file, but I came across a reference to a cache lock file named .structure.lock in Coursier's source code, so one assumes it could exist.

@SethTisue
Copy link
Member

but -name "*.lock" wouldn't catch .structure.lock (because of the initial dot)

@ashawley
Copy link
Member Author

I thought that too, but it seems to work.

@SethTisue
Copy link
Member

right you are

% mkdir foo
% cd foo
~/foo % touch .lock
~/foo % find . -name \*.lock
./.lock

@@ -45,8 +45,10 @@ script:
before_cache:
- find $HOME/.sbt -name "*.lock" | xargs rm
- find $HOME/.ivy2/cache -name "ivydata-*.properties" | xargs rm
- find $HOME/.coursier -name "*.lock" | xargs rm
Copy link
Member

Choose a reason for hiding this comment

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

This should probably search in .cache/coursier too?

@alexarchambault
Copy link

alexarchambault commented Sep 16, 2019

I had the same skepticism about the lock file, but I came across a reference to a cache lock file named .structure.lock in Coursier's source code, so one assumes it could exist.

The existence of this file has no impact in itself. Only another process holding a FileLock on it is taken into account. So it doesn't matter if that file is kept in cache, or simply exists before running resolutions.

You can remove those, but it won't change anything down the line (it's not worth the noise IMO, which is why I don't add that line to any of my projects' .travis.yml).

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.

6 participants