Giter Site home page Giter Site logo

Comments (3)

bigdaz avatar bigdaz commented on August 20, 2024

Thanks for reporting. You're correct that the wrapper version keyword doesn't work using setup-gradle with a separate build step. This feature is a leftover from the gradle-build-action which provided a arguments parameter to directly execute Gradle.

Using gradle-version: wrapper with setup-gradle doesn't make sense, since it doesn't download any Gradle version and it doesn't (cannot) update the path so that gradle == ./gradlew.

In order to use a matrix to execute with multiple Gradle versions (including the wrapper), you'll need to do something like:

jobs:
  build:
    strategy:
      matrix:
        gradle-version: ['wrapper', '7.6.4', '8.8']
        gradle-command: ['gradle']
        include:
        - gradle-version: 'wrapper'
          gradle-command: './gradlew'

    steps:
      # ...
      - name: "Setup Gradle ${{ matrix.gradle-version }}"
        uses: gradle/actions/setup-gradle@v3
        with:
          gradle-version: ${{ matrix.gradle-version }}
          build-scan-publish: true
          build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use"
          build-scan-terms-of-use-agree: "yes"
      - name: 'Build'
        run: |
          ${{matrix.gradle-command}} build

This isn't ideal, but it should provide a workaround.
I'll leave this issue open pending a better solution (if possible).

from actions.

Virtlink avatar Virtlink commented on August 20, 2024

Thank you for the workaround, I didn't know about the matrix.include option. I will try this soon.

I don't know how setup-gradle works internally, but apparently it can update the PATH to include the downloaded gradle. So for a wrapper it could instead inject a small script named gradle that just calls ./gradlew in the current directory.

from actions.

bigdaz avatar bigdaz commented on August 20, 2024

for a wrapper it could instead inject a small script named gradle that just calls ./gradlew in the current directory.

Yes I thought of that too. I'll see if that would work.

from actions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.