spock icon indicating copy to clipboard operation
spock copied to clipboard

Make the preprocessing tasks for workflow files cacheable

Open Vampire opened this issue 8 months ago • 8 comments

Vampire avatar Apr 25 '25 23:04 Vampire

This stack of pull requests is managed by Graphite. Learn more about stacking.

Vampire avatar Apr 25 '25 23:04 Vampire

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 81.90%. Comparing base (5d220ca) to head (cf896a5). :warning: Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2157      +/-   ##
============================================
- Coverage     81.91%   81.90%   -0.01%     
- Complexity     4732     4735       +3     
============================================
  Files           463      463              
  Lines         14767    14767              
  Branches       1869     1869              
============================================
- Hits          12096    12095       -1     
- Misses         1980     1981       +1     
  Partials        691      691              

see 2 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Apr 25 '25 23:04 codecov[bot]

You still have overlapping outputs for all workflow tasks:

  • https://ge.spockframework.org/s/n5ofs5ftv6czg/timeline?details=3yt6nuz2vwgza
  • https://ge.spockframework.org/s/n5ofs5ftv6czg/timeline?details=6lhcybvrqmfrk
  • https://ge.spockframework.org/s/n5ofs5ftv6czg/timeline?details=6ykqsd4xqsblq
  • https://ge.spockframework.org/s/n5ofs5ftv6czg/timeline?details=uvtxjtpy2mnnc

But the question remains where you copied the warning with docs-pr.yaml from.

From the preprocessDocsPrWorkflow, as all had the same issue, I just picked one task at random.

leonard84 avatar Apr 29 '25 22:04 leonard84

Huh, somehow this does not make any sense.

I made a non-sense change before pushing, so that if the file is coming from cache, the codecov file is not updated, I'll make a new push with that fixed like I had it before that last change.

Besides that the cache key is also bad as I forgot to define path sensitivity.

But either way, there are no overlapping outputs anymore. Especially the file it complains about is dedicated to that one task and there should not be any overlap. Locally the result is taken from cache just fine: https://ge.spockframework.org/s/4phvtkur47e74/timeline?details=3yt6nuz2vwgza&expanded=WyIxIl0

I even added

allprojects { tasks.all {} }
tasks.register('foo') {
  doLast {
    allprojects*.tasks*.all { task ->
      outputs.files.files.findAll { it.absolutePath.contains('.github') }.each {
        println("FOO: ${task.name} | ${it.absolutePath}")
      }
    }
  }
}

and all I got was the expected

FOO: preprocessBranchesAndPrsWorkflow | D:\Sourcecode\other\spock\.github\workflows\branches-and-prs.yaml
FOO: preprocessCodeqlAnalysisWorkflow | D:\Sourcecode\other\spock\.github\workflows\codeql-analysis.yaml
FOO: preprocessCommonWorkflow | D:\Sourcecode\other\spock\.github\workflows\common.yaml
FOO: preprocessDocsPrWorkflow | D:\Sourcecode\other\spock\.github\workflows\docs-pr.yaml
FOO: preprocessReleaseWorkflow | D:\Sourcecode\other\spock\.github\workflows\release.yaml

:-/

Vampire avatar Apr 30 '25 14:04 Vampire

Same on GHA: https://ge.spockframework.org/s/vnf6tebn2ygd4/console-log?page=1#L100 while the complaint stays the same: https://ge.spockframework.org/s/vnf6tebn2ygd4/timeline?details=3yt6nuz2vwgza

Vampire avatar Apr 30 '25 14:04 Vampire

Also using the ghActionsBuild task locally works just fine here: https://ge.spockframework.org/s/y6x7rzl55yags/timeline?details=3yt6nuz2vwgza, now even the cache key is the same as on GHA.

Vampire avatar Apr 30 '25 14:04 Vampire

Argh, it is because it is a clean checkout where the file already exists and Gradle does not know that itself was the one creating it. 🙈

Vampire avatar Apr 30 '25 16:04 Vampire

Ok, with that knowledge now finally the tasks are also cacheable on GHA

Vampire avatar May 02 '25 08:05 Vampire