• Stars
    star
    167
  • Rank 226,265 (Top 5 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 5 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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.

Setup Scala GitHub Action

A GitHub Action to install Java via Jabba and sbt.

  • Configurable Java version: supports OpenJDK, GraalVM, Zulu and any other Java version that's installable via Jabba.
  • Cross-platform: works on Linux, macOS, Windows.
  • The sbt command is provided, with the official sbt launch script.
  • The following alternate sbt launch scripts are also provided:

Usage:

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: [email protected]
      - name: Compile
        run: sbt compile

More Java version examples:

  • graalvm@: the latest GraalVM
  • [email protected]: the latest OpenJDK 14 version
  • [email protected]: the latest Zulu OpenJDK 11
  • [email protected]=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 URL

Tips and tricks

Some suggestions that may be helpful when using GitHub Actions.

Disable fail-fast strategy

By 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

Browsing raw logs

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.

Configuring Windows jobs

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

Faster checkout of big repos

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

More Repositories

1

scala-db-codegen

Scala code/boilerplate generator from a db schema
Scala
50
star
2

sbt-big

Proposal for faster sbt launch times and more stable plugin ecosystem
Scala
23
star
3

scalameta-sbt-codegen

Example of doing code generation with scala.meta in sbt
Scala
12
star
4

intellij-ammonite

Obsolete, Ammonite is now supported in IntelliJ πŸŽ‰ -->
Scala
11
star
5

tiny-router

Library to map ADTs to urls and urls back to ADTs
Scala
10
star
6

setup-gpg

GitHub Action to install the same version of gpg as on Travis CI
TypeScript
9
star
7

scalafix-codegen

Example repository how to use scalafix to code generation
Scala
8
star
8

scala-repos

Bunch of Scala code for testing scalafmt
Scala
7
star
9

sbt-docusaurus

This project has moved to mdoc --->
Scala
5
star
10

slick-codegen-scalajs

Slick codegen with Scala.js
JavaScript
4
star
11

coursier-small

This project is no longer needed since the new Coursier library API has gotten a lot nicer --->
Scala
3
star
12

thesis

Report/slides for my Master's thesis project at EPFL
CSS
3
star
13

semanticdb-example

Example repository to experiment with SemanticDB
Scala
3
star
14

scala-experiments

Large-scale semantic and syntactic analysis of Scala OSS codebases
Scala
2
star
15

bloop-old-fork

A hot bloop for your productivity
Scala
1
star
16

mhtml-todo

JavaScript
1
star
17

FinalCaseClass

Scalax rule to prohibit non-final case classes
Scala
1
star
18

sbt-scalafix-example

Scala
1
star
19

codegen-example

Scala
1
star
20

filedag

Scala
1
star
21

pyas

Python
1
star
22

my-js-project

TypeScript
1
star
23

sbt-global

My personal global sbt build.
Scala
1
star
24

sbt-messagehost

sbt plugin to build only the "messages" section of the Scalameta Semantic API.
Scala
1
star
25

scalafix-upgrade

Scala
1
star