Cache: Preserve exact timestamps

Created on 25 May 2020  路  12Comments  路  Source: actions/cache

Some tools (like https://www.scala-sbt.org/) rely on files timestamps with millisecond precision.
Currently cache preserves timestamps only down to second precision.
The fix would be to simply use posix format when tarring files.
https://github.com/actions/cache/pull/233 was my attempt at fixing it but it no longer works with current master

enhancement

All 12 comments

I really need this too! xcodebuild depends on timestamps.
@OlegYch meanwhile, please do not delete your posix branch as my workflow depends on it :)

Actually, after spending two days trying to get incremental builds to work, I just remembered git doesn't support timestamps and I gave up.

I guess I need an action that takes the timestamp of the base ref, applies it to all files, then takes the timestamp of the head ref and applies it to all modified/added files.

I guess I need an action that takes the timestamp of the base ref, applies it to all files, then takes the timestamp of the head ref and applies it to all modified/added files.

I ended up using chetan/git-restore-mtime-action for that.

Example steps:

- name: 'Restore timestamps'
  uses: chetan/[email protected]

- name: 'Cache: Derived data'
  uses: OlegYch/cache@posix
  id: cache-derived-data
  with:
    path: .build/derived-data
    key: ${{ runner.os }}-deriveddata-${{ github.base_ref }}@${{ github.event.pull_request.base.sha }}-${{ github.head_ref }}@${{ github.sha }}
    restore-keys: |
      ${{ runner.os }}-deriveddata-${{ github.base_ref }}@${{ github.event.pull_request.base.sha }}-${{ github.head_ref }}@
      ${{ runner.os }}-deriveddata-${{ github.base_ref }}@${{ github.event.pull_request.base.sha }}-
      ${{ runner.os }}-deriveddata-${{ github.base_ref }}@

@jcayzac posix branch does not work as it's based on broken master, posixv1 works, i'm going to keep it until this is fixed in upstream

@jcayzac yep that one works

I've opened a PR about this. Hopefully, we can include this in the first release of v2.

cheers

Upstream code has been fixed. I just opened a PR to downstream to apply it, and it will be merged soon if things go well. FYI: @OlegYch @jcayzac @JosephDuffy

Reopening, this issue automatically closed itself after the pr in toolkit went in. Need to update the package version here and create a new create.

@aiqiaoy Now we can close this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jcornaz picture jcornaz  路  4Comments

Cerberus picture Cerberus  路  5Comments

mands picture mands  路  5Comments

binkley picture binkley  路  4Comments

thisismydesign picture thisismydesign  路  4Comments