actions / cache

Cache dependencies and build outputs in GitHub Actions
MIT License
4.37k stars 1.16k forks source link

feat: save-always flag #1242

Closed to-s closed 5 months ago

to-s commented 10 months ago

This adds the ability to select if the post action step should be run, even if there was another failing step before.

Description

      - name: Load ccache cache
        uses: to-s/cache@main
        with:
          save-always: true
          path: ~/.ccache
          key: ${{ github.job }}-ccache-cache-${{ github.head_ref || github.ref_name }}-${{ github.sha }}
          restore-keys: |
            ${{ github.job }}-ccache-cache-${{ github.head_ref || github.ref_name }}-
            ${{ github.job }}-ccache-cache-

Motivation and Context

If you use ccache to build a bun of unit tests and after that one of these tests fails, the ccache is not stored and everything has to be build again with by the next run.

This can help to save a lot of billing time and increase the sustainability.

How Has This Been Tested?

By using the code block above.

Screenshots (if appropriate):

Types of changes

Checklist:

IanButterworth commented 7 months ago

This would be a very helpful option to have. In the julia ecosystem the build of the dependency tree outside of the repo is valid to cache even if the repo package has failures, and julia is set up to replace bad caches so it would be a safe thing to do.

to-s commented 6 months ago

@janisz, anything missing here to get this PR merged?

IanButterworth commented 6 months ago

It'd be good to know whether or not/when this is likely to be merged, otherwise we are considering moving away from this action and duplicating its functionality.

IanButterworth commented 6 months ago

bump @robherley (based on a new version being released just now)

robherley commented 5 months ago

👋 Hey folks, going to merge this in and it should get picked up in the next release

IanButterworth commented 5 months ago

Great! Thanks!