-
-
Notifications
You must be signed in to change notification settings - Fork 1
124 lines (106 loc) · 2.94 KB
/
continouos-integration.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# 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.13.14' ]
steps:
- uses: actions/checkout@v3
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '11'
cache: 'sbt'
- name: Build & Test
run: sbt ++${{ matrix.scala }} testWithCoverage
- name: Upload coverage report (Cobertura)
uses: actions/upload-artifact@v3.1.0
with:
name: cobertura.xml
path: ${{github.workspace}}/target/scala-2.13/coverage-report/cobertura.xml
- name: Upload coverage report (HTML)
uses: actions/upload-artifact@v3.1.0
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.13.14' ]
experimental: [ false ]
include:
- jdk: '17'
distribution: 'corretto'
scala: '2.13.14'
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.'