Reputation: 365
In my github actions jobs I would like to have n jobs.
gradle assembleDebug
gradle connectedCheck
. The difference between each job is the image used on the android emulator (each with a different android api)The idea is that the project is built in job1 while job2 to job n would reuse what was already built in job1 and only build the tests (that are made by a task run by connectedCheck). This is in order to avoid having everything built from scratch in job2 to job n.
I already:
app/build
app/.cxx
files into a github cache in job1I tried to touch
the files in app/build
& app/.cxx
before running gradle again (so that I'm sure the files are all older than the source files).
But this still doesn't permit to gain in build time. In other words, the system still rebuilds everything, gradle runs the tasks that were done in job1 again.
Any idea on how to achieve this?
Upvotes: 2
Views: 224
Reputation: 365
I found that:
touch
was useless$PROJECT_DIR/.gradle
directory.In addition to that, by running:
gradle
with -i
optionninja
with -d explain -v
optionsI found that:
build/
dirs in other places than just in app/build/
. Typically in some of the libraries I use. For example in additional_lib/my_lib/build/
~/.android/debug.keystore
ANDROID_SDK_ROOT/ndk/<version>
and ANDROID_SDK_ROOT/cmake/<version>
must have the same timestamp across the jobs.So in the job you have to:
be sure that the source files have the same timestamp across the jobs
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: restore timestamps
uses: chetan/git-restore-mtime-action@v1
be sure that files in these dirs have the same timestamp across the jobs.
cache these folders:
Note: I also added ~/.gradle in the cache, but this is probably not mandatory
Upvotes: 0