eadl:bloc3:dev_av:tests

Ceci est une ancienne révision du document !


CI-CD

Intégration de Junit Jupiter

Déjà présent dans pom.xml

        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-test-junit5</artifactId>
            <scope>test</scope>
        </dependency>

Exécution des tests en local :

mvn -B -U -ntp test

CI GitHub actions

A mettre dans .github/workflows/ci-tests.yml : Vérifiez :

  • La version de java (17 ?)
  • Le nom de la branche principale (master/main ?)

name: CI • Tests (Maven)

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

concurrency:
  group: ci-tests-${{ github.ref }}
  cancel-in-progress: true

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        java: [ '17' ] 
    env:
      MAVEN_OPTS: -XX:+UseParallelGC -Xmx1g -Djava.awt.headless=true
      MAVEN_ARGS: ""

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up Temurin JDK
        uses: actions/setup-java@v4
        with:
          distribution: temurin
          java-version: ${{ matrix.java }}
          cache: maven

      - name: Build & test
        run: mvn -B -U -ntp $MAVEN_ARGS verify

      - name: Upload test and coverage reports
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: test-reports-java-${{ matrix.java }}
          path: |
            **/target/surefire-reports/**
            **/target/failsafe-reports/**
            **/target/site/jacoco/**
          retention-days: 7

Le workflow :

  • Se déclenche sur push et pull_request vers master.
  • Installe JDK 17, restaure le cache Maven, compile et lance les tests (verify).
  • Archive les rapports (téléchargeables depuis l’onglet “Actions” de Github).
  • eadl/bloc3/dev_av/tests.1758061120.txt.gz
  • Dernière modification : il y a 23 heures
  • de jcheron