egor-tensin/setup-cygwin

Feature request: Add cache

Endle opened this issue · 2 comments

Endle commented

If we cache cygwin packages, we can speed up CI process and save bandwidth for kernel.org
I tried https://github.com/Endle/wine-mono/blob/940e19c2abbc576f597e924270812721638b8eb1/.github/workflows/c-cpp.yml#L13 but t didn't work

      - name: Get Date
        id: get-date
        run: |
          echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
          echo "::set-output name=time::$(/bin/date -u "+%H%M%S")"
        shell: bash
      - name: Cache Cygwin
        uses: actions/cache@v2
        env:
          cache-name: cache-cygwin-packages
        with:
          path: /cygdrive/c/tools/cygwin/packages
          key: ${{ runner.os }}-${{ env.cache-name }}-${{ steps.get-date.outputs.date }}-${{ steps.get-date.outputs.time }}
          restore-keys: |
            ${{ runner.os }}-${{ env.cache-name }}-${{ steps.get-date.outputs.date }}-
            ${{ runner.os }}-${{ env.cache-name }}-

@Endle I'm not sure the path: /cygdrive/c/tools/cygwin/packages part can possibly work. I image that the YAML is interpreted by a Windows program, disregarding the shell: setting. Maybe something like path: C:\tools\cygwin\packages could work, but I'm not certain the Chocolatey installer I'm using to install Cygwin would work with that. Give me some time, I'll try to test this.

koppor commented

I think, the Windows path should work. Also there is a save and restore action, which allows for a more fine-grained tuning. Example here: https://github.com/zauguin/install-texlive/blob/721918b8f32b7ea8d9643027fe90987d7cfe07db/action.yml#L38

Moreover, I assume, the Chocolatey installer just needs to be skipped if these directories are present. The environment variables still need to be adjusted.

Note that caching for Chocolatey is not possible (yet): chocolatey/choco#2015