From 2186be9870d06ba5144caa12fd21798ac7a27066 Mon Sep 17 00:00:00 2001 From: Christoph Pirkl Date: Sun, 28 Jan 2024 10:14:22 +0100 Subject: [PATCH] Update dependencies (#71) * Delete eclipse config files * Update dependencies * Fix sonar build * Disable Java 17 & 21 for now * Add sonar binding * Fix sonar build * Rename build step --------- Co-authored-by: kaklakariada --- .github/workflows/build-next-java.yml | 37 --------------- .github/workflows/build.yml | 41 +++++++++++------ .github/workflows/codeql-analysis.yml | 14 +++--- .gitignore | 2 + .settings/org.eclipse.core.resources.prefs | 6 --- .settings/org.eclipse.m2e.core.prefs | 4 -- .vscode/settings.json | 17 +++++++ README.md | 4 +- pom.xml | 53 +++++++++++++--------- 9 files changed, 84 insertions(+), 94 deletions(-) delete mode 100644 .github/workflows/build-next-java.yml delete mode 100644 .settings/org.eclipse.core.resources.prefs delete mode 100644 .settings/org.eclipse.m2e.core.prefs create mode 100644 .vscode/settings.json diff --git a/.github/workflows/build-next-java.yml b/.github/workflows/build-next-java.yml deleted file mode 100644 index d98b704..0000000 --- a/.github/workflows/build-next-java.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Build with next Java version - -# Build fails currently. See https://github.com/itsallcode/junit5-system-extensions/issues/68 -#on: -# push: -# branches: [ main ] -# pull_request: -# branches: [ main ] - -jobs: - build-next-java: - - runs-on: ubuntu-latest - concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 1 - - uses: actions/setup-java@v3 - with: - distribution: 'adopt' - java-version: 17 - cache: maven - - name: Build with Maven - run: mvn --errors --batch-mode clean install - env: - MAVEN_OPTS: "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn" - - name: Publish Test Report - uses: scacap/action-surefire-report@v1 - if: ${{ always() && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }} - with: - report_paths: '**/target/surefire-reports/TEST-*.xml' - github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a72a62c..269b2dd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,43 +7,54 @@ on: branches: [ main ] jobs: - build: - + matrix-build: runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + java: [11] # 17 & 21 removed because of https://github.com/itsallcode/junit5-system-extensions/issues/68 concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }}-java-${{ matrix.java }} cancel-in-progress: true + env: + DEFAULT_JAVA: 11 steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: - distribution: 'adopt' - java-version: 11 + distribution: 'temurin' + java-version: | + 11 + 17 + 21 cache: maven - name: Cache SonarQube packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - - name: Build with Maven - run: mvn --errors --batch-mode clean install - env: - MAVEN_OPTS: "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn" + - name: Build with Java ${{ matrix.java }} + run: mvn --errors --batch-mode clean install -Djava.version=${{ matrix.java }} - name: Sonar analysis - if: ${{ env.SONAR_TOKEN != null }} - run: mvn --errors --batch-mode -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=itsallcode -Dsonar.login=$SONAR_TOKEN org.jacoco:jacoco-maven-plugin:prepare-agent sonar:sonar + if: ${{ env.DEFAULT_JAVA == matrix.java && env.SONAR_TOKEN != null }} + run: mvn --errors --batch-mode -Dsonar.token=$SONAR_TOKEN org.jacoco:jacoco-maven-plugin:prepare-agent sonar:sonar env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - MAVEN_OPTS: "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn" - name: Publish Test Report uses: scacap/action-surefire-report@v1 if: ${{ always() && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }} with: report_paths: '**/target/surefire-reports/TEST-*.xml' github_token: ${{ secrets.GITHUB_TOKEN }} + + build: + needs: matrix-build + runs-on: ubuntu-latest + steps: + - run: echo "Build successful" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a24a4f0..96d8ac2 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -5,8 +5,6 @@ on: branches: [ main ] pull_request: branches: [ main ] - schedule: - - cron: '0 4 * * 3' jobs: analyze: @@ -20,21 +18,21 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: - distribution: 'adopt' + distribution: 'temurin' java-version: 11 cache: maven - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: java - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.gitignore b/.gitignore index c523c20..69f2c1a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,6 @@ **/*.out /target /bin +/.settings/org.eclipse.core.resources.prefs /.settings/org.eclipse.jdt.apt.core.prefs +/.settings/org.eclipse.m2e.core.prefs \ No newline at end of file diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 29abf99..0000000 --- a/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding/=UTF-8 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f..0000000 --- a/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..aefe10c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,17 @@ +{ + "editor.formatOnSave": true, + "editor.formatOnSaveMode": "modifications", + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit", + "source.generate.finalModifiers": "explicit", + "source.fixAll": "explicit" + }, + "java.saveActions.organizeImports": true, + "java.sources.organizeImports.starThreshold": 3, + "java.sources.organizeImports.staticStarThreshold": 3, + "java.configuration.updateBuildConfiguration": "automatic", + "sonarlint.connectedMode.project": { + "connectionId": "itsallcode", + "projectKey": "org.itsallcode:junit5-system-extensions" + } +} \ No newline at end of file diff --git a/README.md b/README.md index f4dfc2e..8b7feeb 100644 --- a/README.md +++ b/README.md @@ -124,9 +124,7 @@ The list below show all build time dependencies in alphabetical order. Note that ```bash mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar \ - -Dsonar.host.url=https://sonarcloud.io \ - -Dsonar.organization=itsallcode \ - -Dsonar.login=[token] + -Dsonar.token=[token] ``` See analysis results at https://sonarcloud.io/dashboard?id=org.itsallcode%3Ajunit5-system-extensions diff --git a/pom.xml b/pom.xml index 3c4a719..3113c1c 100644 --- a/pom.xml +++ b/pom.xml @@ -36,14 +36,12 @@ 11 - 5.9.0 - 1.9.0 + 5.10.1 UTF-8 true + https://sonarcloud.io + itsallcode - - 3.6.3 - ossrh @@ -66,25 +64,38 @@ ${junit.version} test - - org.junit.platform - junit-platform-launcher - ${junit.platform.version} - test - org.mockito mockito-core - 4.7.0 + 5.10.0 test + + org.apache.maven.plugins + maven-toolchains-plugin + 3.1.0 + + + + toolchain + + + + + + + ${java.version} + + + + org.apache.maven.plugins maven-compiler-plugin - 3.10.1 + 3.12.1 ${java.version} ${java.version} @@ -93,7 +104,7 @@ org.apache.maven.plugins maven-source-plugin - 3.2.1 + 3.3.0 attach-sources @@ -106,7 +117,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.4.1 + 3.6.3 attach-javadocs @@ -130,7 +141,7 @@ org.jacoco jacoco-maven-plugin - 0.8.8 + 0.8.11 @@ -148,12 +159,12 @@ maven-surefire-plugin - 3.0.0-M7 + 3.2.5 org.apache.maven.plugins maven-gpg-plugin - 3.0.1 + 3.1.0 sign-artifacts @@ -170,7 +181,7 @@ org.apache.maven.plugins maven-deploy-plugin - 3.0.0 + 3.1.1 org.sonatype.plugins @@ -186,7 +197,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.1.0 + 3.4.1 enforce-maven @@ -206,7 +217,7 @@ io.github.zlika reproducible-build-maven-plugin - 0.15 + 0.16 strip-jar