-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (73 loc) · 2.38 KB
/
maven.yml
File metadata and controls
88 lines (73 loc) · 2.38 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
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
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Java CI with Maven
on:
push:
branches:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
run-test:
runs-on: ubuntu-latest
steps:
# Vérification usuelles
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
# On execute les tests sans interruption
- name: Run tests
run: mvn clean test
continue-on-error: true
- run: touch src/test-report
- name: Upload test report
uses: actions/upload-artifact@v4
with:
name: test-report
path: src/
- name: Check if tests passed
if: ${{ failure() }}
run: echo "::error line=1::Test check failed" && exit 1
coverages:
runs-on: ubuntu-latest
needs: run-test #Action nécessaire à exécuter avant
steps:
# Vérification usuelles
- name: Checkout repository
uses: actions/checkout@v4
# Installation de JAVA
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Download a Build Artifact
uses: actions/download-artifact@v4.1.4
with:
name: test-report
path: src/
- name: Run tests with Maven and generate coverage report
run: mvn clean test jacoco:report
- name: Check code coverage
id: check-coverage
run: mvn clean verify jacoco:report || echo "::error line=1::Coverage checks have not been met" && exit 1