Merge pull request #68 from scala-steward/update/sbt-1.9.8 #207
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
# Continuous Integration (CI) to Build & Test & Coverage & Lint. | |
# ~~ | |
name: CI | |
on: | |
pull_request: | |
branches: [ main, '**' ] | |
push: | |
branches: [ main ] | |
jobs: | |
validate: | |
name: Validate Code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: corretto | |
java-version: '11' | |
cache: 'sbt' | |
- name: Validate Code | |
run: sbt validateCode | |
build: | |
name: Build & Test | |
needs: [ validate ] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
scala: [ '2.12.18', '2.13.12' ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'corretto' | |
java-version: '8' | |
cache: 'sbt' | |
- name: Build & Test | |
run: sbt ++${{ matrix.scala }} testWithCoverage | |
- name: Upload coverage report (Cobertura) | |
uses: actions/[email protected] | |
with: | |
name: cobertura.xml | |
path: ${{github.workspace}}/target/scala-2.13/coverage-report/cobertura.xml | |
- name: Upload coverage report (HTML) | |
uses: actions/[email protected] | |
with: | |
name: scoverage-report-html | |
path: ${{github.workspace}}/target/scala-2.13/scoverage-report/ | |
optional-build: | |
name: Build (Optional) | |
continue-on-error: ${{ matrix.experimental }} | |
needs: [ validate ] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
distribution: [ 'corretto' ] | |
jdk: [ '11' ] | |
scala: [ '2.12.18', '2.13.12' ] | |
experimental: [ false ] | |
include: | |
- jdk: '17' | |
distribution: 'corretto' | |
scala: '2.13.12' | |
experimental: true | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: ${{ matrix.distribution }} | |
java-version: ${{ matrix.jdk }} | |
cache: 'sbt' | |
- name: Perform Build / Test | |
run: sbt ++${{ matrix.scala }} compile test | |
coverage: | |
name: Coverage Report | |
if: ${{ github.event.pull_request }} | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: cobertura.xml | |
- name: Analyzing coverage report | |
uses: 5monkeys/cobertura-action@master | |
with: | |
path: cobertura.xml | |
only_changed_files: true | |
fail_below_threshold: true | |
show_missing: true | |
show_line: true | |
show_branch: true | |
show_class_names: true | |
link_missing_lines: true | |
minimum_coverage: 75 | |
ready-to-merge: | |
name: Ready to Merge | |
if: ${{ github.event.pull_request }} | |
needs: [ optional-build, coverage ] | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo 'Ready to merge.' |