setup sbt in CI #2
This file contains hidden or 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
| name: CI | |
| on: | |
| push: | |
| branches: [ series/0.3, series/0.5 ] | |
| pull_request: | |
| branches: [ series/0.3, series/0.5 ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| java: [8, 11, 17, 21] | |
| scala: [2.12.20, 2.13.16] | |
| name: Test Scala ${{ matrix.scala }} on Java ${{ matrix.java }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Scala and SBT | |
| uses: olafurpg/setup-scala@v14 | |
| with: | |
| java-version: ${{ matrix.java }} | |
| - name: Cache SBT and dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.ivy2/cache | |
| ~/.sbt | |
| ~/.cache/coursier | |
| key: ${{ runner.os }}-sbt-${{ matrix.scala }}-${{ hashFiles('**/build.sbt', 'project/**/*.scala', 'project/build.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-sbt-${{ matrix.scala }}- | |
| ${{ runner.os }}-sbt- | |
| - name: Verify setup | |
| run: | | |
| java -version | |
| sbt --version | |
| echo "JAVA_HOME: $JAVA_HOME" | |
| - name: Compile | |
| run: | | |
| sbt -Dfile.encoding=UTF8 -J-Xmx2G ++${{ matrix.scala }} compile | |
| - name: Run tests | |
| run: | | |
| sbt -Dfile.encoding=UTF8 -J-Xmx2G ++${{ matrix.scala }} test | |
| - name: Check formatting (Scala 2.13 only) | |
| if: matrix.scala == '2.13.16' && matrix.java == '11' | |
| run: | | |
| # Only run formatting check on one matrix combination to avoid redundancy | |
| echo "Formatting check would go here if scalafmt is configured" | |
| # Additional job for Kafka tests (Scala 2.12 only) | |
| kafka-tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| java: [8, 11, 17, 21] | |
| name: Kafka Tests on Java ${{ matrix.java }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Scala and SBT | |
| uses: olafurpg/setup-scala@v14 | |
| with: | |
| java-version: ${{ matrix.java }} | |
| - name: Cache SBT and dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.ivy2/cache | |
| ~/.sbt | |
| ~/.cache/coursier | |
| key: ${{ runner.os }}-sbt-kafka-${{ hashFiles('**/build.sbt', 'project/**/*.scala', 'project/build.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-sbt-kafka- | |
| ${{ runner.os }}-sbt- | |
| - name: Verify setup | |
| run: | | |
| java -version | |
| sbt --version | |
| echo "JAVA_HOME: $JAVA_HOME" | |
| - name: Run Kafka tests | |
| run: | | |
| sbt -Dfile.encoding=UTF8 -J-Xmx2G "project kafkaTests" test |