actions / setup-java

Set up your GitHub Actions workflow with a specific version of Java
MIT License
1.47k stars 708 forks source link

`setup-java@v4` setup for sbt failing on macOS with `line 1: sbt: command not found` #627

Closed Christewart closed 1 month ago

Christewart commented 2 months ago

This seemingly broke overnight, i'm attempting to setup the build with this

      - name: Setup Scala
        uses: actions/setup-java@v4
        with:
          distribution: 'adopt'
          java-version: '21'
          cache: 'sbt'

and the build is failing with

sbt coverage cryptoTestJVM/test coreTestJVM/test secp256k1jni/test zmq/test appCommonsTest/test asyncUtilsTestJVM/test chainTest/test dlcNodeTest/test appServerTest/test
/Users/runner/work/_temp/5e05e0e3-d7eb-40c9-aacb-dbf00977b77b.sh: line 1: sbt: command not found
Error: Process completed with exit code 127.

You can see the PR here: https://github.com/bitcoin-s/bitcoin-s/pull/5546

Direct link to a failed build: https://github.com/bitcoin-s/bitcoin-s/actions/runs/8838483817/job/24269887223?pr=5546

EDIT: Note, this only fails on mac builds, linux builds are fine with this setup.

HarithaVattikuti commented 2 months ago

Hello @Christewart Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.

AuroraLaghi commented 2 months ago

I also encountered the same problem, only for macOS.

prabhu commented 2 months ago

brew install sbt workaround works. Looks like even php has disappeared from macOS runners.

mdedetrich commented 1 month ago

Also experiencing the same issue

mahabaleshwars commented 1 month ago

SBT is not included in the macOS 13 and macOS 14 Github Hosted Runner. Please refer to this source for confirmation. If you need to use SBT in your workflow, you can add a step to install it manually. Here's an example with Homebrew:

- name: Setup SBT
  run: |
    echo ""Installing SBT...""
    brew install sbt

This will install SBT on the runner for the duration of the workflow.

mkurz commented 1 month ago

Ran into the same problem, switched to macos-12 for now:

mkurz commented 1 month ago

The GitHub Actions macOS 13 and 14 runner images do not come with preinstalled sbt anymore and the GitHub team will not add them back anymore, see these closed issues:

More details can be found here as well:

IMHO this issue can be closed, because it's not the fault of the setup-java actions. From now on you have to install sbt yourself with brew install sbt

mahabaleshwars commented 1 month ago

Hello @Christewart, as previously noted, setup-java is functioning properly. The issue has surfaced due to modifications with the macos-13 and 14 runners. We recommend applying the solution we provided to resolve your issue. We're moving forward with closing this issue, but please feel free to contact us if you face any other challenges.

eed3si9n commented 1 week ago

I've created sbt/setup-sbt to workaround this - https://eed3si9n.com/setup-sbt/. sbt runner script seems to be missing from ubuntu-24.04 image as well, so eventually it might go away from all images.