A GitHub action to avoid being caught by GitHub zip issues on CI

Hey guys! I’m just hearing about the zipball issue on GitHub preventing elm make to run. Turns out if your packages are cached, you don’t need to download them :wink: So ironically, GitHub actions caching are a solution to GitHub problems if you are using GitHub.

Some time ago, I published an action to help you do exactly that so I thought I’d relay it again today: GitHub - mpizenberg/elm-tooling-action: GitHub action to install Elm tools and cache ELM_HOME

The action is pretty nice, since it just requires you to add an elm-tooling.json file like this:

{
  "tools": {
    "elm": "0.19.1",
    "elm-format": "0.8.5"
  }
}

and to add the following few lines to your .github/workflows/ci.yml file and you are set! (Don’t forget to activate action both on PR and main branch).

      - name: Install elm, elm-format and cache the ELM_HOME directory
        uses: mpizenberg/elm-tooling-action@v1.2
        with:
          cache-key: elm-home-${{ hashFiles('elm-tooling.json', 'elm.json') }}

Couple remarks

There is a warning saying that you shouldn’t use it if you have a typical web project with a package.json file and follow instead the traditional elm-tooling-cli setup.

Well it was me being over cautious, and it seems that both are fine together (let me know if you have issues). So you can add the GH action just for the sake of easy caching of the elm home.

It doesn’t seem to be up to date

It is enought up to date if you are only interested in caching, elm, and elm-format. If you also want to install the latest elm-test-rs with it, I haven’t updated it yet by lack of time. PRs are welcome, please make it so I can review very easily because I don’t have much time these days.

I hope your projects are back to normal compiling! Otherwise have a look at Martin’s script to build your own cache! Build ~/.elm cache manually without checking SHA1 hashes · GitHub

:heart: And continue building with elm :heart:

8 Likes

Small note: Caching dependencies to speed up workflows - GitHub Docs

GitHub will remove any cache entries that have not been accessed in over 7 days.

So if you have a not very active repo, you might not be saved by cache.

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.