setup-java icon indicating copy to clipboard operation
setup-java copied to clipboard

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

Open Christewart opened this issue 1 year ago • 3 comments

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.

Christewart avatar Apr 25 '24 19:04 Christewart

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

HarithaVattikuti avatar Apr 26 '24 02:04 HarithaVattikuti

I also encountered the same problem, only for macOS.

AuroraLaghi avatar Apr 26 '24 16:04 AuroraLaghi

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

prabhu avatar Apr 27 '24 11:04 prabhu

Also experiencing the same issue

mdedetrich avatar May 09 '24 17:05 mdedetrich

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.

mahabaleshwars avatar May 10 '24 13:05 mahabaleshwars

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

  • https://github.com/sbt/sbt-pull-request-validator/pull/42

mkurz avatar May 13 '24 10:05 mkurz

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:

  • https://github.com/actions/runner-images/issues/9369
  • https://github.com/actions/runner-images/issues/9837
  • Specially this answer

More details can be found here as well:

  • https://github.com/sbt/sbt-pull-request-validator/pull/42

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

mkurz avatar May 13 '24 11:05 mkurz

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.

mahabaleshwars avatar May 14 '24 13:05 mahabaleshwars

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.

eed3si9n avatar Jun 22 '24 23:06 eed3si9n