GithubHelp home page GithubHelp logo

isabella232 / setup-scala Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stackadapt/setup-scala

0.0 0.0 0.0 491 KB

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.

License: MIT License

TypeScript 80.20% JavaScript 4.82% Shell 11.68% Scala 3.30%

setup-scala's Introduction

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.
  • The sbt command is installed using the paulp/sbt-extras launcher.
  • For faster startup, the csbt command is installed using the Coursier-based coursier/sbt-extras launcher. This launcher does not work with all builds, only use csbt if you know what you are doing.
  • Cross-platform: works on Linux, macOS, Windows.

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@v10
      - 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@v10
+       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@v10
      - 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@v10
      - 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@v10
      - name: Compile
        run: sbt compile

setup-scala's People

Contributors

alexarchambault avatar apple-corps avatar bkabrda avatar chenrui333 avatar dependabot[bot] avatar marcono1234 avatar olafurpg avatar plokhotnyuk avatar sideeffffect avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.