GitHub Action to install any version of Java (GraalVM, Java 8, Java 11, Java 14, ...) via Jabba. Works for any JVM language including Java, Scala and Kotlin.
TypeScript
171
34 commits
updated Nov 24, 2023
A GitHub Action to install Java via Jabba and sbt.
sbt command is provided, with the official sbt launch script.sbtx runs the sbt-extras launcher.csbt runs the Coursier-based sbt-extras launcher.In your GitHub Actions workflow, add a uses: declaration before calling the
sbt command.
+++ .github/workflows/ci.yml
name: CI
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
+ - uses: olafurpg/setup-scala@v11
- name: Compile
run: sbt compile
The default Java version is the latest OpenJDK 8 HotSpot version via
AdoptOpenJDK. To customize the Java version add a
with: declaration. For example, to use the latest AdoptOpenJDK 11 version
+++ .github/workflows/ci.yml
name: CI
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: olafurpg/setup-scala@v11
+ with:
+ java-version: adopt@1.11
- name: Compile
run: sbt compile
More Java version examples:
graalvm@: the latest GraalVMopenjdk@1.14: the latest OpenJDK 14 versionzulu@1.11: the latest Zulu OpenJDK 11graalvm@20.2.0=tgz+https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.2.0/graalvm-ce-java11-linux-amd64-20.2.0.tar.gz:
custom Java version from a URLSome suggestions that may be helpful when using GitHub Actions.
fail-fast strategyBy default, GitHub Actions stops running jobs on the first failure. Add the following configuration to ensure that all jobs run on every PR even if one job fails.
+++ .github/workflows/ci.yml
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
steps:
- uses: actions/checkout@v1
- uses: olafurpg/setup-scala@v11
- name: Compile
run: sbt compile
Searching through large logs in the GitHub Actions web UI can be slow sometimes. It can be faster to look at the raw logs instead.

When running jobs on Windows, you may want to default to the bash shell and
configure git to disable Windows line feeds.
+++ .github/workflows/ci.yml
name: CI
on: [push]
jobs:
build:
- runs-on: ubuntu-latest
+ runs-on: windows-latest
steps:
+ - name: Configure git
+ run: "git config --global core.autocrlf false"
+ shell: bash
- uses: actions/checkout@v1
- uses: olafurpg/setup-scala@v11
- name: Compile
+ shell: bash
run: sbt compile
Your repository can have a lot of commits, or branches with bulk resources. The
v2 version of actions/checkout doesn't fetch a whole repo by default that can
speed up builds greatly. But an additional configuration can be required to
fetch tags up to some level of depth for some builds which check binary
compatibility with previous tagged release from the branch.
+++ .github/workflows/ci.yml
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 100
+ - name: Fetch tags
+ run: git fetch --depth=100 origin +refs/tags/*:refs/tags/*
- uses: olafurpg/setup-scala@v11
- name: Compile
run: sbt compile
TypeScript
81.5%
Shell
10.9%
JavaScript
4.5%
Scala
3.1%
GitHub Action to install any version of Java (GraalVM, Java 8, Java 11, Java 14, ...) via Jabba. Works for any JVM language including Java, Scala and Kotlin.
TypeScript
171
34 commits
updated Nov 24, 2023
A GitHub Action to install Java via Jabba and sbt.
sbt command is provided, with the official sbt launch script.sbtx runs the sbt-extras launcher.csbt runs the Coursier-based sbt-extras launcher.In your GitHub Actions workflow, add a uses: declaration before calling the
sbt command.
+++ .github/workflows/ci.yml
name: CI
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
+ - uses: olafurpg/setup-scala@v11
- name: Compile
run: sbt compile
The default Java version is the latest OpenJDK 8 HotSpot version via
AdoptOpenJDK. To customize the Java version add a
with: declaration. For example, to use the latest AdoptOpenJDK 11 version
+++ .github/workflows/ci.yml
name: CI
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: olafurpg/setup-scala@v11
+ with:
+ java-version: adopt@1.11
- name: Compile
run: sbt compile
More Java version examples:
graalvm@: the latest GraalVMopenjdk@1.14: the latest OpenJDK 14 versionzulu@1.11: the latest Zulu OpenJDK 11graalvm@20.2.0=tgz+https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.2.0/graalvm-ce-java11-linux-amd64-20.2.0.tar.gz:
custom Java version from a URLSome suggestions that may be helpful when using GitHub Actions.
fail-fast strategyBy default, GitHub Actions stops running jobs on the first failure. Add the following configuration to ensure that all jobs run on every PR even if one job fails.
+++ .github/workflows/ci.yml
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
steps:
- uses: actions/checkout@v1
- uses: olafurpg/setup-scala@v11
- name: Compile
run: sbt compile
Searching through large logs in the GitHub Actions web UI can be slow sometimes. It can be faster to look at the raw logs instead.

When running jobs on Windows, you may want to default to the bash shell and
configure git to disable Windows line feeds.
+++ .github/workflows/ci.yml
name: CI
on: [push]
jobs:
build:
- runs-on: ubuntu-latest
+ runs-on: windows-latest
steps:
+ - name: Configure git
+ run: "git config --global core.autocrlf false"
+ shell: bash
- uses: actions/checkout@v1
- uses: olafurpg/setup-scala@v11
- name: Compile
+ shell: bash
run: sbt compile
Your repository can have a lot of commits, or branches with bulk resources. The
v2 version of actions/checkout doesn't fetch a whole repo by default that can
speed up builds greatly. But an additional configuration can be required to
fetch tags up to some level of depth for some builds which check binary
compatibility with previous tagged release from the branch.
+++ .github/workflows/ci.yml
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 100
+ - name: Fetch tags
+ run: git fetch --depth=100 origin +refs/tags/*:refs/tags/*
- uses: olafurpg/setup-scala@v11
- name: Compile
run: sbt compile
TypeScript
81.5%
Shell
10.9%
JavaScript
4.5%
Scala
3.1%