|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + workflow_dispatch: {} |
| 11 | + |
| 12 | +jobs: |
| 13 | + core: |
| 14 | + name: Reflect scala_versions |
| 15 | + runs-on: ubuntu-20.04 |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + java: [ '1.14' ] |
| 19 | + scala: [ |
| 20 | + { version: '2.12.18', bincompat: '2.12' } |
| 21 | + ] |
| 22 | + outputs: |
| 23 | + scala_versions: ${{ steps.set-scala-versions.outputs.scala_versions }} |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + fetch-depth: 0 |
| 28 | + - uses: olafurpg/setup-scala@v14 |
| 29 | + with: |
| 30 | + java-version: zulu@${{ matrix.java }} |
| 31 | + - name: Set scala version for matrix |
| 32 | + id: set-scala-versions # The greps on the following line are to ensure as much as possible that we've caught the right line |
| 33 | + run: echo "scala_versions=$(sbt 'print githubMatrixSettings' | grep '^\[{' | grep 'bincompat' | tail -n 1)" >> $GITHUB_OUTPUT |
| 34 | + scala: |
| 35 | + runs-on: ubuntu-20.04 |
| 36 | + needs: [core] |
| 37 | + strategy: |
| 38 | + matrix: |
| 39 | + java: [ '1.14', '1.17' ] |
| 40 | + scala: ${{ fromJson(needs.core.outputs.scala_versions) }} |
| 41 | + framework: [ |
| 42 | + { framework: 'pekko-http', project: 'sample-pekkoHttp' }, |
| 43 | + ] |
| 44 | + steps: |
| 45 | + - run: echo 'combo_enabled=true' >> $GITHUB_ENV |
| 46 | + - run: echo 'combo_enabled=false' >> $GITHUB_ENV |
| 47 | + if: ${{ matrix.java == '1.17' && matrix.scala.bincompat == '2.12' }} |
| 48 | + - run: echo 'combo_enabled=false' >> $GITHUB_ENV |
| 49 | + if: matrix.scala.bincompat == '2.13' && matrix.framework.framework == 'dropwizard' |
| 50 | + - uses: actions/checkout@v4 |
| 51 | + with: |
| 52 | + fetch-depth: 0 |
| 53 | + - uses: olafurpg/setup-scala@v14 |
| 54 | + with: |
| 55 | + java-version: zulu@${{ matrix.java }} |
| 56 | + - name: print Java version |
| 57 | + run: java -version |
| 58 | + - uses: actions/cache@v3 |
| 59 | + with: |
| 60 | + path: ~/.cache/coursier |
| 61 | + key: ${{ runner.os }}-scala-${{ matrix.scala.version }}-${{ hashFiles('**/*.sbt') }} |
| 62 | + restore-keys: | |
| 63 | + ${{ runner.os }}-scala-${{ matrix.scala.version }}- |
| 64 | + - name: Run tests |
| 65 | + if: ${{ env.combo_enabled == 'true' }} |
| 66 | + run: sbt ++${{ matrix.scala.version }} clean samples/clean coverage "runExample scala ${{ matrix.framework.framework }}" ${{ matrix.framework.project }}/test coverageAggregate |
| 67 | + - uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # 3.1.4 |
| 68 | + if: ${{ env.combo_enabled == 'true' }} |
| 69 | + with: |
| 70 | + file: ./target/scala-${{ matrix.scala.bincompat }}/scoverage-report/scoverage.xml |
| 71 | + fail_ci_if_error: true |
| 72 | + token: ${{ secrets.CODECOV_TOKEN }} |
0 commit comments