hendrikmuhs / ccache-action

github action to speedup building using ccache
MIT License
122 stars 54 forks source link

Containerized Alpine support #131

Closed mvorisek closed 1 year ago

mvorisek commented 1 year ago

Please add support for Alpine, currently, apt is tried to be used to install ccache but Alpine needs ccache.

CI repro: https://github.com/php/php-src/actions/runs/4083551771/jobs/7039218638#step:6:18

Example GH workflow:

    runs-on: ubuntu-20.04
    container:
      image: alpine:3.15
    steps:
      - name: git checkout
        uses: actions/checkout@v3
      - name: ccache
        uses: hendrikmuhs/ccache-action@v1.2
vadz commented 1 year ago

FWIW I just install ccache myself before using this action as a workaround for now: if ccache is already installed, it's not going to try installing it and so works even in non-Debian environments.

mvorisek commented 1 year ago

Thank you for your comment. The workaround is working, however the issue should be fixed officially.

hendrikmuhs commented 1 year ago

however the issue should be fixed officially.

This is a small opensource side-project, the best way to approach this is a PR.

vadz commented 1 year ago

however the issue should be fixed officially.

This is a small opensource side-project, the best way to approach this is a PR.

I thought about doing it (which is why I actually searched for container-related issues and found this one), but then decided that it probably wasn't a good idea to try installing ccache under all platforms, there are just too many of them, so installing ccache before using the action if you don't use a supported one looks like a reasonable solution.

However the action could at least check if it's not running under a Debian system and give a clear error in this case instead of just failing trying to run apt-get. Would you like to have a PR doing this?

mvorisek commented 1 year ago

Debian/Ubuntu apt and Alpine apk package managers are very common, thus both should be supported out of the box.

vadz commented 1 year ago

It's not up to me to decide this, but supporting apt is natural because this is what is used in GitHub Actions environment. Starting to support anything else opens the door to supporting all package managers (are you sure apk is really more popular than dnf or pacman or ...) and so seems unwise.

hendrikmuhs commented 1 year ago

The check sounds like a good idea. It is preferable to fail fast with a clear error message.

Regarding support for other os's: I agree that 100% coverage isn't possible, but I am also not against it. I happily merge a PR that adds support.

lukasz-mitka commented 1 year ago

I'd suggest skipping package managers altogether and using pre-build binaries from releases https://github.com/ccache/ccache/releases and https://github.com/mozilla/sccache/releases where possible.

This way it would also enable selecting particular version of the package.