Skip to content

Commit 7c44d8b

Browse files
committed
W-17683749: wip coverage step
1 parent 49b5bc7 commit 7c44d8b

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/coverage.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Code Coverage
2+
3+
on:
4+
push:
5+
branches:
6+
- your-branch-name # Replace with your test branch
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
coverage:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v3
18+
19+
- name: Set up JDK 11
20+
uses: actions/setup-java@v3
21+
with:
22+
distribution: 'temurin'
23+
java-version: '11'
24+
25+
- name: Install SBT
26+
run: |
27+
echo "Installing SBT..."
28+
curl -L https://scala.jfrog.io/artifactory/debian/sbt-1.9.8.deb -o sbt.deb
29+
sudo dpkg -i sbt.deb
30+
sudo apt-get update
31+
sudo apt-get install -f
32+
sbt sbtVersion
33+
34+
- name: Cache SBT dependencies
35+
uses: actions/cache@v3
36+
with:
37+
path: |
38+
~/.ivy2/cache
39+
~/.sbt
40+
~/.cache/coursier
41+
key: sbt-${{ runner.os }}-${{ hashFiles('**/build.sbt') }}
42+
restore-keys: |
43+
sbt-${{ runner.os }}-
44+
45+
- name: Run Tests with Coverage
46+
run: sbt clean coverage test coverageAggregate
47+
48+
- name: Upload Coverage Report
49+
uses: actions/upload-artifact@v3
50+
with:
51+
name: coverage-report
52+
path: target/scala-*/scoverage-report/
53+
54+
- name: Run SonarQube Scan
55+
env:
56+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
57+
SONAR_HOST_URL: "https://sonarcloud.io"
58+
run: |
59+
sbt -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_TOKEN sonarScan

0 commit comments

Comments
 (0)