Skip to content

Commit

Permalink
Merge pull request #760 from armanbilge/feature/setup-sbt
Browse files Browse the repository at this point in the history
Expose `SetupSbt` step
  • Loading branch information
armanbilge authored Oct 15, 2024
2 parents aeae325 + df97ab8 commit 60e81c5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ jobs:
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- name: Install sbt
uses: sbt/setup-sbt@v1

- name: Ignore line ending differences in git
if: contains(runner.os, 'windows')
shell: bash
Expand All @@ -93,6 +90,9 @@ jobs:
with:
fetch-depth: 0

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

- name: Setup Java (temurin@8)
id: setup-java-temurin-8
if: matrix.java == 'temurin@8'
Expand Down Expand Up @@ -251,9 +251,6 @@ jobs:
runs-on: ${{ matrix.os }}
timeout-minutes: 45
steps:
- name: Install sbt
uses: sbt/setup-sbt@v1

- name: Ignore line ending differences in git
if: contains(runner.os, 'windows')
run: git config --global core.autocrlf false
Expand All @@ -263,6 +260,9 @@ jobs:
with:
fetch-depth: 0

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

- name: Setup Java (temurin@8)
id: setup-java-temurin-8
if: matrix.java == 'temurin@8'
Expand Down Expand Up @@ -397,9 +397,6 @@ jobs:
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Install sbt
uses: sbt/setup-sbt@v1

- name: Ignore line ending differences in git
if: contains(runner.os, 'windows')
run: git config --global core.autocrlf false
Expand All @@ -409,6 +406,9 @@ jobs:
with:
fetch-depth: 0

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

- name: Setup Java (temurin@8)
id: setup-java-temurin-8
if: matrix.java == 'temurin@8'
Expand Down Expand Up @@ -539,9 +539,6 @@ jobs:
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Install sbt
uses: sbt/setup-sbt@v1

- name: Ignore line ending differences in git
if: contains(runner.os, 'windows')
run: git config --global core.autocrlf false
Expand All @@ -551,6 +548,9 @@ jobs:
with:
fetch-depth: 0

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

- name: Setup Java (temurin@8)
id: setup-java-temurin-8
if: matrix.java == 'temurin@8'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,12 +781,6 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)}
},
githubWorkflowGeneratedCacheSteps := Seq(),
githubWorkflowJobSetup := {
val installSbt = List(
WorkflowStep.Use(
UseRef.Public("sbt", "setup-sbt", "v1"),
name = Some("Install sbt")
)
)

val autoCrlfOpt = if (githubWorkflowOSes.value.exists(_.contains("windows"))) {
List(
Expand All @@ -798,9 +792,9 @@ ${indent(jobs.map(compileJob(_, sbt)).mkString("\n\n"), 1)}
Nil
}

installSbt :::
autoCrlfOpt :::
autoCrlfOpt :::
List(WorkflowStep.CheckoutFull) :::
WorkflowStep.SetupSbt ::
WorkflowStep.SetupJava(githubWorkflowJavaVersions.value.toList) :::
githubWorkflowGeneratedCacheSteps.value.toList
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ object WorkflowStep {
UseRef.Public("actions", "checkout", "v4"),
name = Some("Checkout current branch (fast)"))

val SetupSbt: WorkflowStep = WorkflowStep.Use(
UseRef.Public("sbt", "setup-sbt", "v1"),
name = Some("Setup sbt")
)

def SetupJava(versions: List[JavaSpec], enableCaching: Boolean = true): List[WorkflowStep] = {
def sbtUpdateStep(cond: String, setupId: String) =
if (enableCaching)
Expand Down

0 comments on commit 60e81c5

Please sign in to comment.