Tache3 - Songju Lee - Joana da Matta #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Maven tests | |
on: | |
pull_request: | |
push: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java-flags: | |
- "" | |
- "-Xms512m -Xmx1024m" | |
- "-XX:+UseG1GC" | |
- "-XX:+UseParallelGC -XX:ParallelGCThreads=2" | |
- "-XX:+UseZGC" | |
- "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=*:5005" | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Run Maven tests with JVM flags | |
run: mvn verify -DargLine="@{argLine} ${{ matrix.jvm_flags }}" | |
- name: Get JaCoCo Coverage | |
id: coverage | |
run: | | |
coverage=$(python3 config/coverage.py target/site/jacoco/jacoco.csv) | |
echo "COVERAGE=$coverage" >> $GITHUB_ENV | |
- name: Fail if coverage has not improved. | |
run: | | |
coverage=$COVERAGE | |
threshold=81.58 | |
if (( $(echo "$coverage - $threshold <= 0.1" | bc -l) )); then | |
echo "Coverage has not improved." | |
exit 1 | |
else | |
echo "New coverage: $coverage%" | |
fi |