Skip to content

Scala builds stopped working recently (sbt not found) #88

@winitzki

Description

@winitzki

I have a Scala build configured exactly following the scala example in this repository. It used to work until a few weeks ago
when it started to fail at the stage of running sbt. (The error is "sbt not found".)

Did something change in github actions?

I don't see where sbt is being installed. But this used to work before.

The Dhall code is the same as in the scala example in the repository. (examples/scala.dhall). The relevant parts are:

... GithubActions.Workflow::{
    , name = "Greeting"
    , on = GithubActions.On::{
      , push = Some GithubActions.Push::{=}
      , pull_request = Some GithubActions.PullRequest::{=}
      }
    , jobs = toMap
        { checks = GithubActions.Job::{
          , name = Some "Checks"
          , runs-on = GithubActions.types.RunsOn.ubuntu-latest
          , steps =
                setup
              # [ GithubActions.steps.actions/setup-java { java-version = "11" }
                , GithubActions.steps.run
                    { run = "sbt scalafmtCheckAll scalafmtSbtCheck" }
                ]

This code does not seem to install sbt; neither the code in setup does that, nor any of the steps declared here. The step run = "sbt scalafmtCheckAll ..." fails due to "no sbt found". Example build: https://github.com/winitzki/sofp-solutions/actions/runs/13088710571

I used the latest github-actions-dhall and also I tried using the older cached version that I have on my computer; neither works.

I also looked at some documentation about how to run scala builds in github actions:

https://www.scala-sbt.org/1.x/docs/GitHub-Actions-with-sbt.html

It mentioned the following step:

     - name: Setup sbt launcher
        uses: sbt/setup-sbt@v1

I don't see this step in the yaml file generated from dhall; and also I don't see how I could add this extra step using the existing functionality of github-actions-dhall. Please help! I'm quite familiar with Dhall and I would be able to contribute changes to this repo; but I need help understanding the root cause of what's going on and how to fix this problem.

I also tried adding the above yaml with "sbt/setup-sbt@v1" by hand to the workflow yaml file. This worked and my build succeeded, but only when I added that yaml block both to the "checks" and to the "build and test" steps in the workflow. Adding it only to the "checks" made the "checks" pass but then "build and test" failed again due to "no sbt found". (I expected that the sbt installation would be cached and needed only once; apparently that's not the case.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions