Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
jvm: ['8', '11']
jvm: ['11', 'temurin:17']
steps:
- uses: actions/checkout@v2
- run: |
Expand All @@ -22,13 +22,13 @@ jobs:
npm run all
# create an sbt file to enabling sbt caching
- run: echo 'name := "foo"' > build.sbt
- id: cs-setup
- id: scala-cli-setup
uses: ./
with:
jvm: ${{ matrix.jvm }}
apps: sbt sbtn ammonite bloop:1.4.11
# - uses: coursier/cache-action@v5
- run: echo cs-version=${{ steps.cs-setup.outputs.cs-version }}
- run: echo cs-version=${{ steps.scala-cli-setup.outputs.cs-version }}
- run: echo $PATH
# test Java
- run: echo $JAVA_HOME
Expand All @@ -42,3 +42,6 @@ jobs:
if: runner.os != 'Windows'
- run: amm --help
- run: bloop about
- run: echo scala-cli-version=${{ steps.scala-cli-setup.outputs.scala-cli-version }}
- run: scala-cli help
- run: echo 'println("Hello")' | scala-cli -
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Coursier setup GitHub Action
# Scala CLI setup GitHub Action

A GitHub Action to install Coursier and use it to install Java and Scala CLI tools.

It can be useful if you want to install a specific version of JVM or use a build tool like `mill` or `seed`.

Inspired by [olafurpg/setup-scala](https://github.com/olafurpg/setup-scala) and the blog post [Single command Scala setup](https://alexarchambault.github.io/posts/2020-09-21-cs-setup.html) by Alex Archambault (author of Coursier).
A GitHub Action to install Scala CLI.

## Features

Expand All @@ -26,7 +22,7 @@ Inspired by [olafurpg/setup-scala](https://github.com/olafurpg/setup-scala) and
```yml
steps:
- uses: actions/checkout@v2
- uses: coursier/setup-action@v1
- uses: VirtusLab/scala-cli-setup@main
with:
jvm: adopt:11
apps: sbtn bloop ammonite
Expand All @@ -35,6 +31,7 @@ Inspired by [olafurpg/setup-scala](https://github.com/olafurpg/setup-scala) and
## Outputs

- `cs-version`: version of the installed Coursier (should be the latest available)
- `scala-cli-version`: version of the installed Scala CLI (should be the latest available)

## Caching

Expand All @@ -44,5 +41,5 @@ This action should work well with the official Coursier [cache-action](https://g
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v6
- uses: coursier/setup-action@v1
- uses: VirtusLab/scala-cli-setup@main
```
8 changes: 5 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'coursier-setup-action'
description: 'Use Coursier to install JVM and Scala apps'
name: 'scala-cli-setup-action'
description: 'Use Scala CLI to run your Scala code'
author: 'Alexey Alekhin'
branding:
icon: 'anchor'
Expand All @@ -8,14 +8,16 @@ inputs:
jvm:
description: 'JVM to install (leave empty to use default)'
required: false
default: ''
default: 'temurin:17'
apps:
description: 'Applications to install'
required: false
default: 'sbtn'
outputs:
cs-version:
description: 'Version of the installed Coursier'
scala-cli-version:
description: 'Version of the installed Scala CLI'
runs:
using: 'node12'
main: 'dist/index.js'
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "coursier-setup-action",
"name": "scala-cli-setup-action",
"version": "1.0.0",
"private": true,
"description": "Use Coursier to install JVM and Scala apps",
"description": "Use Scala CLI to run your Scala code",
"main": "lib/main.js",
"scripts": {
"build": "tsc",
Expand All @@ -14,7 +14,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/laughedelic/coursier-setup.git"
"url": "git+https://github.com/VirtusLab/scala-cli-setup"
},
"keywords": [
"actions",
Expand Down
3 changes: 3 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as path from 'path'
import * as tc from '@actions/tool-cache'

const csVersion = '2.1.0-M5'
const scalaCLIVersion = '0.1.2'
const coursierVersionSpec = csVersion

async function execOutput(cmd: string, ...args: string[]): Promise<string> {
Expand Down Expand Up @@ -97,11 +98,13 @@ async function run(): Promise<void> {

await core.group('Install Apps', async () => {
const apps: string[] = core.getInput('apps').split(' ')
apps.push(`scala-cli:${scalaCLIVersion}`)
if (apps.length) {
const coursierBinDir = path.join(os.homedir(), 'cs', 'bin')
core.exportVariable('COURSIER_BIN_DIR', coursierBinDir)
core.addPath(coursierBinDir)
await cs('install', '--contrib', ...apps)
core.setOutput('scala-cli-version', scalaCLIVersion)
}
})
} catch (error: any) {
Expand Down