From b9d57b1de9ebc974aadc0be08704f5cc63be637e Mon Sep 17 00:00:00 2001 From: Pierre Lecerf Date: Thu, 26 Dec 2024 17:17:24 +0100 Subject: [PATCH] fix: github workflow --- .github/workflows/codeql.yml | 23 +++++++++------ .github/workflows/maven-build.yml | 9 +++--- .github/workflows/maven-checkstyle.yml | 36 +++++++++++++++++++++++ .github/workflows/maven-code-coverage.yml | 15 ++++++---- .github/workflows/maven-publish.yml | 17 ++++------- .gitignore | 1 + 6 files changed, 70 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/maven-checkstyle.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index a9cb42d..7dbff82 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -7,29 +7,34 @@ on: # The branches below must be a subset of the branches above branches: [ "master" ] schedule: - - cron: '28 7 * * 5' + - cron: '30 1 * * 0' jobs: analyze: name: Analyze - runs-on: ubuntu-latest permissions: actions: read contents: read security-events: write strategy: - fail-fast: false matrix: - language: [ 'java' ] + os: [ ubuntu-latest ] + java: [ 21 ] + fail-fast: false + runs-on: ${{ matrix.os }} steps: - name: Checkout repository - uses: actions/checkout@v3 - + uses: actions/checkout@v4 + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v3 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -43,7 +48,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # ℹī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -56,6 +61,6 @@ jobs: # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index 1529ad7..b856364 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -11,22 +11,23 @@ jobs: strategy: matrix: os: [ ubuntu-latest, macOS-latest ] - java: [ 11, 15 ] + java: [ 11, 17, 21 ] fail-fast: false runs-on: ${{ matrix.os }} timeout-minutes: 120 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v1 + uses: actions/setup-java@v3 with: java-version: ${{ matrix.java }} + distribution: 'temurin' - name: Build with Maven run: mvn -B package --file pom.xml - name: Upload surefire artifact - uses: actions/upload-artifact@v2-preview + uses: actions/upload-artifact@v4 if: failure() with: name: ${{ matrix.os }}-surefire diff --git a/.github/workflows/maven-checkstyle.yml b/.github/workflows/maven-checkstyle.yml new file mode 100644 index 0000000..a9180c3 --- /dev/null +++ b/.github/workflows/maven-checkstyle.yml @@ -0,0 +1,36 @@ +name: Maven Checkstyle + +on: + push: + branches: [ '*' ] + pull_request: + branches: [ '*' ] + +jobs: + build: + strategy: + matrix: + os: [ ubuntu-latest ] + java: [ 21 ] + fail-fast: false + + runs-on: ${{ matrix.os }} + timeout-minutes: 30 + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v3 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + - uses: reviewdog/action-setup@v1 + with: + reviewdog_version: v0.17.2 + - name: Checkstyle with Maven + run: mvn clean checkstyle:check --fail-never + - name: Run reviewdog + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cat target/checkstyle-result.xml | reviewdog -f=checkstyle -reporter=github-pr-review -runners=golint,govet diff --git a/.github/workflows/maven-code-coverage.yml b/.github/workflows/maven-code-coverage.yml index 9d2abfd..6cdf1f1 100644 --- a/.github/workflows/maven-code-coverage.yml +++ b/.github/workflows/maven-code-coverage.yml @@ -11,20 +11,23 @@ jobs: strategy: matrix: os: [ ubuntu-latest ] - java: [ 15 ] + java: [ 21 ] fail-fast: false runs-on: ${{ matrix.os }} - timeout-minutes: 120 + timeout-minutes: 30 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v1 + uses: actions/setup-java@v3 with: java-version: ${{ matrix.java }} + distribution: 'temurin' - name: Test with Maven - run: mvn clean -B test --file pom.xml - - uses: codecov/codecov-action@v2 + run: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent test jacoco:report + - uses: codecov/codecov-action@v4 with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true verbose: true diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index bf20828..df05b47 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -1,20 +1,18 @@ -name: Maven Publish - +name: Publish package to the Maven Central Repository on: release: types: [created] - jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Maven Central Repository uses: actions/setup-java@v3 with: java-version: '11' - distribution: 'adopt' - server-id: ossrh + distribution: 'temurin' + server-id: central server-username: MAVEN_USERNAME server-password: MAVEN_PASSWORD - id: install-secret-key @@ -23,12 +21,7 @@ jobs: cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import gpg --list-secret-keys --keyid-format LONG - name: Publish package - run: | - mvn \ - --no-transfer-progress \ - --batch-mode \ - -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} \ - clean deploy + run: mvn --batch-mode clean deploy env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} diff --git a/.gitignore b/.gitignore index 264be9f..f78087b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ /target /logs *.iml +*.idea src/test/java/Throwaway*