graalvm / setup-graalvm

GitHub Action for setting up GraalVM distributions.
https://www.graalvm.org
Universal Permissive License v1.0
196 stars 28 forks source link

skip installation if GraalVM already exists #7

Closed yegor256 closed 2 years ago

yegor256 commented 2 years ago

I'm using your action on my self-hosted server. Every time it downloads and installs GraalVM from scratch. Would be great to make it skip the entire setup if /usr/bin/graalvm is already there. Maybe make a special configuration option for this?

fniephaus commented 2 years ago

Why do you still need this action if you already have GraalVM set up on your own runner? To set up the build environment for musl?

I'm not too familiar with self-hosted runner but I wonder whether caching would solve your issue.

yegor256 commented 2 years ago

@fniephaus on a self-hosted runner, the entire setup script is being executed from scratch every time. This is what I have to do now, in order to solve the problem (otherwise your action fails):

      - run: rm -rf ~/.graalvm
      - uses: graalvm/setup-graalvm@v1
        with:
          version: '22.0.0.2'
          java-version: '11'
          components: 'native-image'
          github-token: ${{ secrets.GITHUB_TOKEN }}

Would be great, if you just add a new parameter: skip-if-installed. Just check the presence of ~/.graalvm and skip.

fniephaus commented 2 years ago

Did you create the ~/.graalvm directory or was it created by a previous run of this action?

yegor256 commented 2 years ago

@fniephaus it is created by the previous run of the action

fniephaus commented 2 years ago

Ok, so essentially the action doesn't need to do anything if the ~/.graalvm directory already exists. That should be easy to support although I'm surprised that self-hosted runners persist state like this. If the directory exists, we should let the action print an info instead of not doing anything silently.

fniephaus commented 2 years ago

one more question: the action also sets up environment variables and dependencies. are those also being persisted somehow or does the action still needs to set those up in subsequent runs?

yegor256 commented 2 years ago

@fniephaus they need to be set up, since it's a new session every time. But creating the same files are not necessary, they are already there.

fniephaus commented 2 years ago

Thanks for confirming. We'll look into this.

yegor256 commented 2 years ago

@fniephaus this is what I'm doing now and it works: https://github.com/yegor256/fibonacci/blob/f42c584f6c655b425b674995e4ea848e35ffcf22/.github/workflows/make.yml#L38-L44 But it's pretty slow, since installation happens on every build.

fniephaus commented 2 years ago

Could you please restart your builds and verify that things work now (without having to remove ~/.graalvm)? ~/.graalvm is no longer used by the way.