-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (46 loc) · 1.61 KB
/
tests.yml
File metadata and controls
56 lines (46 loc) · 1.61 KB
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
name: Tests
# Controls when the action will run
on:
push:
branches: ['*']
tags: ['v*']
pull_request:
branches: ['*']
# Define the jobs to run
jobs:
build:
# The operating system to run on
runs-on: ubuntu-latest
# Steps define a sequence of tasks to be performed
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Set up JDK 11 (or any other version you need)
- name: Set up JDK 22
uses: actions/setup-java@v3
with:
distribution: 'temurin' # Can also be 'zulu' or others
java-version: '22'
# Cache Maven dependencies to speed up the build
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
# Build and test the project
- name: Build with Maven
run: mvn clean install --batch-mode
# Optionally, you can run specific tests or custom scripts
- name: Run tests
run: mvn test --batch-mode
# Upload coverage to Codecov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./target/site/jacoco/jacoco.xml # Path to the generated Jacoco report
flags: unittests # Optional, you can tag the type of tests
fail_ci_if_error: true # Fail the job if Codecov fails
token: ${{ secrets.CODECOV_TOKEN }} # Codecov token for private repos, not required for public repos