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
| 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.
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? |

Notes by @mkurz:
Using
coursier/cache-actionwithout 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
tarcommand is used:tar -xf <archive.tar> -P -C <dir>Right now, the cache content is not updated. That means e.g. once the
.cache/coursierfolder 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
restoreCachemethod used: https://github.com/actions/toolkit/blob/91f9153ca87feb260480640429822005380ea9de/packages/cache/src/cache.ts#L65 (thesaveCacheis below it as well)coursier/cache-actionandcoursier/setup-actionplay well together to cache a java installation. That's becausecsuses~/.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-cachingjob.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