-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
CI with GitHub Actions #11142
CI with GitHub Actions #11142
Conversation
f6b9dc2
to
a22b0b4
Compare
a58e6a4
to
10f755c
Compare
f64fbe3
to
26ead0d
Compare
cdca0d3
to
565e021
Compare
e852bee
to
0672aea
Compare
"needs" is used to build a dependency graph, not always to wait for lightweight jobs
I am very confident we are finally good to go here. If @ihostage or someone else wants to review, I recommend to do that commit-after-commit, since that should explain what I did (including the commit messages). The tests are all looking good. I also temporary simulated a cron job run by switched the conditions to check for It also turns out that we do not need the There are probably things that could still be improved, however lets move on, we can improve along the way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally.
prefetch-for-caching: | ||
name: Prefetch dependencies and JVMs for caching | ||
uses: playframework/.github/.github/workflows/sbt.yml@v1 | ||
# if: steps.coursier-cache.outputs.cache-hit-coursier != 'true' # Waiting for https://github.com/coursier/cache-action/pull/296 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this condition here will be very important to speed up the build. Right now this prefetch job will always run all sbt commands below, however once that feature is available that job will be run only one time for each unique file hash of the build.sbt
and project/[*.sbt|*.scala]
That means as long as that sbt files do not change, we will always reuse the same cache which is quite nice.
FYI: It seems the workaround removed in this commit 5f38e1d will not be necessary for when using GitHub actions 👍 It seems GHA is smarter than travis was and will always check out the same commit, even when a pull request gets merged e.g. between the first job and the last job (for example after the publish local job finished and before a scripted test jobs starts. In Travis CI this caused problems because we used dynver and now the commit sha changed between the two jobs, the dynver play version changed as well, so the published artifacts could not be used in the scripted tests). |
The first nightly failed: https://github.com/playframework/playframework/actions/runs/2217931578 |
Not quite 😄 |
|
This PR was not correctly squashed and "littered" |
🤔 Hmm, that depends, some people like to squash and rebase, some people like to merge and keep the whole history. It's a matter of taste and what someone prefers. |
Other PRs were always squashed and merged as 1 commit with PR link, weren't are? |
That was a long time ago, since at least 2 or I think even 3 years we do not squash anymore. |
Notes by @mkurz:
Using
coursier/cache-action
without arguments will build a hash from the content of these files and uses that hash as part of the key to store the values (paths/files).That means to "invalidate" the cache the
build.sbt
,project/[*.scala|*.sbt]
, etc. has to change.When extracing the cache, existing files in a path will be kept, except for files which also exist in the stored cache, then it will be overwritten. In the background a
tar
command is used:tar -xf <archive.tar> -P -C <dir>
Right now, the cache content is not updated. That means e.g. once the
.cache/coursier
folder is cached, it will never be updated anymore if there was a cache hit (with the primary key): actions/cache#342Also see here: https://github.com/actions/cache/blob/8f1e2e02865c42348f9baddbbaafb1841dce610a/src/save.ts#L38 - when the primary key is hit, the cache will never be updated.
The cache-hit output will only be set to
true
, if there was an exact match: https://github.com/actions/cache/blob/8f1e2e02865c42348f9baddbbaafb1841dce610a/src/restore.ts#L52 (there could also be a partial match, but then still the output will befalse
)BTW: Here is the underlying
restoreCache
method used: https://github.com/actions/toolkit/blob/91f9153ca87feb260480640429822005380ea9de/packages/cache/src/cache.ts#L65 (thesaveCache
is below it as well)coursier/cache-action
andcoursier/setup-action
play well together to cache a java installation. That's becausecs
uses~/.cache/coursier/
, e.g.~/.cache/coursier/https/github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.14.1%252B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.14.1_1.tar.gz/jdk-11.0.14.1+1
, see https://github.com/playframework/playframework/runs/6110556466?check_suite_focus=true#step:6:49Problem: When using different JVM, only one will cached by default when the first jobs runs, because like written above the cache is not going to be updated.Fixed in theprefetch-for-caching
job.Stupid workaround to clear the cache: actions/cache#2 (comment) (Can be combined with inputs: https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch). Added the workaround for the Play repo here: #11247
A travis config we used to test different sbt and scala versions, including running some of the jobs in a cron job:
https://github.com/playframework/playframework/blob/f18c239c9186b5b65af291817cd75918f5d39ff9/.travis.yml