Caching build output in github actions workflows

Hi,

I have several related fortran projects that all have a dependency on a core fortran library.

I am using github actions to automate my build/test cycle, but every time the action is triggered I have to recompile the core library even when changes haven’t been made to it. Has anyone figured out a way to cache built output files so that I can save some time on recompilation?

Thanks!

Caching on GitHub Actions is very doable. I have setup multiple workflows in my day job that cache massive codebases. I think that maybe even some of the fortran-lang repos might be using caching, but I would have to check. The key is form a hash that in/validated correctly when code or dependencies change. Of course the real solution here is a package manager and an online registry to make everyone’s’ lives easier.

Hi @runborg , As @gnikit mentioned, you can use a combination of the setup-fpm (Setup fpm · Actions · GitHub Marketplace · GitHub ) action and GitHub artifacts.

to store a github artifact in a workflow:

      - name: Upload data files
        uses: actions/upload-artifact@v4
        with:
          name: _data
          path: _data/

to retrieve it (from same or another workflow):

      - name: download _data
        run: gh run download -n _data
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

we are also almost ready with the registry and I think we will be able to release it soon.

Thanks and Regards,
Henil