Project infrastructure improvements: CI/CD, security, documentation, and code coverage #4
This file contains hidden or 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: CI Build | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| build: | |
| name: Build and Test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| java: ['8', '11', '17', '21'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK ${{ matrix.java }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: ${{ matrix.java }} | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - name: Build with Maven | |
| run: mvn -B clean compile --file pom.xml | |
| - name: Run tests | |
| run: mvn -B test --file pom.xml | |
| - name: Generate test report | |
| if: always() | |
| run: mvn surefire-report:report-only | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-java-${{ matrix.java }} | |
| path: target/surefire-reports/ | |
| retention-days: 7 | |
| - name: Upload coverage report | |
| if: matrix.java == '8' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: target/site/jacoco/ | |
| retention-days: 30 | |
| quality: | |
| name: Code Quality Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '8' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - name: Compile code | |
| run: mvn -B clean compile --file pom.xml | |
| - name: Run Checkstyle | |
| run: mvn checkstyle:checkstyle --file pom.xml | |
| continue-on-error: true | |
| - name: Upload Checkstyle report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: checkstyle-report | |
| path: target/checkstyle-result.xml | |
| retention-days: 7 | |
| - name: Run SpotBugs | |
| run: mvn spotbugs:spotbugs --file pom.xml | |
| continue-on-error: true | |
| - name: Upload SpotBugs report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: spotbugs-report | |
| path: target/spotbugsXml.xml | |
| retention-days: 7 | |
| - name: Run PMD | |
| run: mvn pmd:pmd --file pom.xml | |
| continue-on-error: true | |
| - name: Upload PMD report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pmd-report | |
| path: target/pmd.xml | |
| retention-days: 7 |