-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 159bc2b
Showing
3 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 eugene yokota | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
Setup sbt | ||
========= | ||
|
||
This action enables `sbt` runner from GitHub Actions. | ||
|
||
Usage | ||
----- | ||
|
||
Here's an example usage of setup-sbt action. | ||
|
||
```yaml | ||
env: | ||
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
cache: sbt | ||
- uses: sbt/setup-sbt@v1 | ||
- name: Build and test | ||
shell: bash | ||
run: sbt -v +test | ||
``` | ||
`uses: sbt/setup-sbt@v1` makes `sbt` available on Linux, macOS, and Windows. | ||
|
||
### Setting the runner version | ||
|
||
The `sbt` runner (Bash script that launches sbt) is typically compatible with all modern sbt releases, | ||
you might want to pin the runner to a specific version. | ||
|
||
```yaml | ||
env: | ||
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
cache: sbt | ||
- uses: sbt/setup-sbt@v1 | ||
with: | ||
sbt-runner-version: 1.9.9 | ||
- name: Build and test | ||
shell: bash | ||
run: sbt -v +test | ||
``` | ||
|
||
Why is this GitHub Action needed? | ||
--------------------------------- | ||
|
||
The runner images on GitHub Action has long included `sbt` runner script. The [initial commit on actions/runner-images](https://github.com/actions/runner-images/pull/96) contains `images/linux/scripts/installers/sbt.sh`. However, the situation has changed in May 2024 when GitHub released the runner image for `macos-13` and `macos-14`, users noticed that they were missing the `sbt` runner script. | ||
|
||
[actions/runner-images#9369](https://github.com/actions/runner-images/issues/9369) and [actions/runner-images#9837](https://github.com/actions/runner-images/issues/9837) confirmed that this was intentional: | ||
|
||
> Thank you for such detail request. But currently we have no plans to add `sbt` on `macOS-13`/`macOS-14`. | ||
|
||
Since GitHub Actions are extensible, we thought this providing a setup action would be convenient way to enable `sbt` again on all runner images. | ||
|
||
License | ||
------- | ||
|
||
The scripts and documentation in this project are released under the [MIT License](LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: "Setup sbt" | ||
description: "Sets up sbt runner script" | ||
inputs: | ||
sbt-runner-version: | ||
description: "The runner version (The actual version is controlled via project/build.properties)" | ||
required: true | ||
default: 1.10.0 | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Cache sbt distribution | ||
id: cache-dir | ||
uses: actions/cache@v4 | ||
with: | ||
path: setupsbt | ||
key: ${{ runner.os }}-sbt-${{ inputs.sbt-runner-version }} | ||
|
||
- name: "Install sbt" | ||
shell: bash | ||
if: steps.cache-dir.outputs.cache-hit != 'true' | ||
run: | | ||
mkdir -p setupsbt | ||
curl -sL https://github.com/sbt/sbt/releases/download/v$SBT_RUNNER_VERSION/sbt-$SBT_RUNNER_VERSION.zip > setupsbt/sbt-$SBT_RUNNER_VERSION.zip | ||
pushd setupsbt | ||
unzip -o "sbt-$SBT_RUNNER_VERSION.zip" | ||
popd | ||
env: | ||
SBT_RUNNER_VERSION: ${{ inputs.sbt-runner-version }} | ||
|
||
- name: "Setup PATH" | ||
shell: bash | ||
run: | | ||
pushd setupsbt | ||
ls sbt/bin/sbt | ||
echo "$PWD/sbt/bin" >> "$GITHUB_PATH" | ||
popd |