Merge pull request #161 from scala-steward/update/sbt-scoverage-2.0.12 #297
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
name: CI | |
on: | |
push: | |
branches: [ '*' ] | |
pull_request: | |
branches: [ '*' ] | |
jobs: | |
build: | |
name: Build and test | |
strategy: | |
matrix: | |
scala: [ 2.11.12, 2.12.19, 2.13.13 ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v4.2.1 | |
with: | |
java-version: '8' | |
distribution: 'temurin' | |
- name: Cache sbt | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.sbt | |
~/.ivy2/cache | |
~/.coursier/cache/v1 | |
~/.cache/coursier/v1 | |
~/AppData/Local/Coursier/Cache/v1 | |
~/Library/Caches/Coursier/v1 | |
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} | |
- name: Verify formatting | |
run: sbt scalafmtCheckAll | |
- name: Run tests | |
if: ${{ !startsWith(matrix.scala, '2.13') }} | |
run: sbt --client '++${{ matrix.scala }} clean; test' | |
- name: Run tests and coverage | |
if: ${{ startsWith(matrix.scala, '2.13') }} | |
run: sbt --client '++${{ matrix.scala }} clean; coverage; test' | |
- name: Coverage | |
if: ${{ startsWith(matrix.scala, '2.13') }} | |
run: sbt --client '++${{ matrix.scala }} coverageReport' | |
- name: Codecov | |
if: ${{ startsWith(matrix.scala, '2.13') }} | |
uses: codecov/codecov-action@v4.3.0 | |
publish: | |
name: Publish artifacts | |
needs: [build] | |
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v4.2.1 | |
with: | |
java-version: '8' | |
distribution: 'temurin' | |
- name: Cache sbt | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.sbt | |
~/.ivy2/cache | |
~/.coursier/cache/v1 | |
~/.cache/coursier/v1 | |
~/AppData/Local/Coursier/Cache/v1 | |
~/Library/Caches/Coursier/v1 | |
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} | |
- name: Publish snapshot | |
if: ${{ !startsWith(github.ref, 'refs/tags/v') }} | |
run: sbt --client +publish | |
env: | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USER }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
- name: Setup GPG | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
echo "$PGP_SECRET" | base64 --decode | gpg --batch --import | |
env: | |
PGP_SECRET: ${{ secrets.PGP_SECRET }} | |
- name: Publish release | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: sbt --client +publishSigned sonatypeBundleRelease | |
env: | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USER }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} |