Update .gitea/workflows/scala-test.yml
Some checks failed
CI Demo / build (push) Successful in 4s
Docker Test / docker-ops (push) Successful in 5s
.NET Test / dotnet-test (push) Successful in 51s
Java Test / java-hello (push) Has been cancelled
Julia Test / julia-test (push) Has been cancelled
Kotlin Test / kotlin-hello (push) Has been cancelled
Node.js Test / nodejs-test (push) Has been cancelled
Notebook Test / nb-test (push) Has been cancelled
PHP Test / php-test (push) Has been cancelled
Python Test / python-hello (push) Has been cancelled
R tests / test (push) Has been cancelled
Go Test / go-test (push) Has been cancelled
Rust test / test (push) Has been cancelled
Scala (sbt) tests / scala-test (push) Has been cancelled
Swift Test / swift-hello (push) Has been cancelled

This commit is contained in:
2025-08-07 22:52:02 +00:00
parent acf844d0e6
commit 4e3165fdaa

View File

@@ -1,5 +1,5 @@
name: Scala Test
on: [push]
name: Scala (sbt) tests
on: [push, pull_request]
jobs:
scala-test:
@@ -7,15 +7,44 @@ jobs:
steps:
- uses: actions/checkout@v4
# Find an sbt project (first build.sbt found). If none, we skip gracefully.
- name: Detect sbt project
id: detect
shell: bash
run: |
set -e
FILE=$(git ls-files '**/build.sbt' | head -n1 || true)
if [ -z "$FILE" ]; then
echo "found=false" >> "$GITHUB_OUTPUT"
exit 0
fi
DIR=$(dirname "$FILE")
echo "found=true" >> "$GITHUB_OUTPUT"
echo "dir=$DIR" >> "$GITHUB_OUTPUT"
- name: Set up Java (for sbt)
if: steps.detect.outputs.found == 'true'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '11' # or 17/21 to match your project
cache: 'sbt' # auto-cache Coursier/Ivy for sbt
java-version: '11' # or 17/21 to match your project
cache: sbt
# Limit cache scan to the detected project to avoid the "no file matched" error
cache-dependency-path: |
${{ steps.detect.outputs.dir }}/build.sbt
${{ steps.detect.outputs.dir }}/project/build.properties
${{ steps.detect.outputs.dir }}/project/**/*.scala
${{ steps.detect.outputs.dir }}/project/**/*.sbt
- name: Set up sbt
uses: sbt/setup-sbt@v1 # installs sbt
if: steps.detect.outputs.found == 'true'
uses: sbt/setup-sbt@v1
- name: Run tests
run: sbt -batch -v test
if: steps.detect.outputs.found == 'true'
working-directory: ${{ steps.detect.outputs.dir }}
run: sbt -batch -v test
- name: Skip (no sbt project found)
if: steps.detect.outputs.found != 'true'
run: echo "No sbt project found; skipping Scala tests."