forked from celadari/json-logic-scala
-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (97 loc) · 3.33 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Copyright 2019 celadari. All rights reserved. MIT license.
name: Unittests
on: [push]
jobs:
retrieve-scala-versions:
runs-on: ubuntu-20.04
steps:
- name: Install ansi2txt tool
run: |
sudo apt-get update
sudo apt-get install colorized-logs
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Retrieve Scala Versions from build.sbt file
id: set-matrix
run: |
scalaVersionPref=$(sbt +scalaBinaryVersion | ansi2txt | grep -Eo '\[info\] [0-9]\.[0-9][0-9]' | sed -r 's/\[info\] ([0-9]\.[0-9][0-9])/\1/')
scala_versions=$(echo "$scalaVersionPref" | tr '\n' ',')
scala_versions="[${scala_versions%?}]"
echo ::set-output name=matrix::"$scala_versions"
outputs:
scala_versions: ${{ steps.set-matrix.outputs.matrix }}
test-coverage:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Cache Java modules
uses: actions/cache@v2
env:
cache-name: cache-java-modules
with:
path: ~/.m2
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./build.sbt') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache Scala modules
uses: actions/cache@v2
env:
cache-name: cache-scala-modules
with:
path: ~/.m2
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./build.sbt') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache Sbt modules
uses: actions/cache@v2
env:
cache-name: cache-sbt-modules
with:
path: ~/.sbt/1.0
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./build.sbt') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Run Sbt Test and Generate Report on Multiple Scala Versions
run: |
sbt +coverage +test
sbt +coverageReport
- uses: actions/upload-artifact@v2
with:
name: coverage-report
path: ./target/scala-[0-9].[0-9][0-9]
upload-coverage:
runs-on: ubuntu-latest
needs: [retrieve-scala-versions, test-coverage]
strategy:
fail-fast: false
matrix:
scala_version: ${{ fromJSON(needs.retrieve-scala-versions.outputs.scala_versions) }}
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: coverage-report
path: ./target/
- uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./target/scala-${{ matrix.scala_version }}/
flags: unittests,${{ matrix.scala_version }}/scoverage-report/scoverage.xml
name: codecov-json-logic-scala
fail_ci_if_error: true
verbose: true