DeLaGuardo / setup-graalvm

MIT License
62 stars 17 forks source link

Caching doesn't work (for me) #1

Open jeroenvandijk opened 4 years ago

jeroenvandijk commented 4 years ago

Hi Kirill,

Thank you for sharing this Github Action!

It works perfectly except for caching of the GraalVM download. It seems to add 30 unnecessary seconds for each build.

This is my configuration:

      - name: Prepare GraalVM
        uses: DeLaGuardo/setup-graalvm@2.0
        with:
          graalvm-version: "19.3.0.java8"

      - name: Install native-image
        run: |
          echo 
          gu install native-image

The Prepare GraalVM step takes around 30 seconds. Did I miss something in my configuration?

It seems your code tries to detect this situation here https://github.com/DeLaGuardo/setup-graalvm/blob/master/src/installer.ts#L43

DeLaGuardo commented 4 years ago

Thanks for spotting that out. Will try to resolve asap

DeLaGuardo commented 4 years ago

Could you change your workflow file?

      - name: Prepare GraalVM
        uses: DeLaGuardo/setup-graalvm@2.0
        with:
          graalvm-version: "19.3.0.java8"

      - name: Second prepare GraalVM
        uses: DeLaGuardo/setup-graalvm@2.0
        with:
          graalvm-version: "19.3.0.java8"

      - name: Install native-image
        run: |
          echo 
          gu install native-image

tool-cache suppose to keep the cache until you have something to run and got wiped after finish

image

jeroenvandijk commented 4 years ago

I'm still waiting for the new job to complete

Also I didn't mention it, but this is a run on a mac (runs-on: macOS-latest). I'll add a run for Linux to see if it works there

jeroenvandijk commented 4 years ago

Ok the step Second prepare GraalVM in the Mac Osx takes 0 seconds. When I test this on a Linux machine I see the same behaviour.

I've been able to cache other steps (maven dependencies), but for this I had to add:

      - name: Cache deps
        uses: actions/cache@v1
        id: cache-deps
        with: 
          path: ~/.m2/repository
          key: ${{ runner.os }}-maven-${{ hashFiles('project.clj') }} # Other deps files?
          restore-keys: |
                ${{ runner.os }}-maven-

      - name: Fetch deps
        if: steps.cache-deps.outputs.cache-hit != 'true'
        run: |
          lein deps

I couldn't find anything like that in your code (could have looked wrong of course)

DeLaGuardo commented 4 years ago

That is correct. I'm doing almost the same in my company's project. The only difference - you do not need if. I will update this issue with part of my flowfile later.

jeroenvandijk commented 4 years ago

I think you are correct that it doesn't make a big difference, lein deps with a cache is pretty quick. If you do choose to add the if, you see in the github interface that the step is actually skipped (and it saves 1 sec i guess). Not a big deal.

DeLaGuardo commented 4 years ago

So I guess this issue can be closed, isn't it?

jeroenvandijk commented 4 years ago

I was talking about the maven caching, not the GraalVM download. That is still not cached. Do you mean I should add an actions/cache@v1 step for your action to be cached?

DeLaGuardo commented 4 years ago

I tried to add "caching between jobs" via actions/cache@1 without success, unfortunately. I'm not seeing any ways how to make this available atm, sorry. https://github.com/actions/toolkit/issues/58#issuecomment-521672239