From 2df5be08367bfff7077ccfeaa73480c11db0086e Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Sat, 15 Jun 2024 20:53:55 -0400 Subject: [PATCH] [GHA] Update github actions --- .github/workflows/ci.yaml | 6 ++++-- .github/workflows/codeql.yml | 6 ++++++ .github/workflows/coveralls.yaml | 7 ++++--- .github/workflows/site.yaml | 15 ++++++--------- .github/workflows/sonar.yaml | 5 +++-- .github/workflows/sonatype.yaml | 3 ++- 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b7d341a8..80bd06ad 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,9 +7,10 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: + cache: [maven] + distribution: [temurin] + java: [11, 17, 21, 22, 23-ea] os: [ubuntu-latest, macos-latest, windows-latest] - java: [11, 17, 21, 22-ea] - distribution: ['temurin'] fail-fast: false max-parallel: 4 name: Test JDK ${{ matrix.java }}, ${{ matrix.os }} @@ -21,5 +22,6 @@ jobs: with: java-version: ${{ matrix.java }} distribution: ${{ matrix.distribution }} + cache: ${{ matrix.cache }} - name: Test with Maven run: ./mvnw test -B -V --no-transfer-progress -D"license.skip=true" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index b30894b2..7810cbd2 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -50,6 +50,12 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Setup Java + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'temurin' + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v3 diff --git a/.github/workflows/coveralls.yaml b/.github/workflows/coveralls.yaml index cc025a32..270a6c85 100644 --- a/.github/workflows/coveralls.yaml +++ b/.github/workflows/coveralls.yaml @@ -11,16 +11,17 @@ jobs: - name: Set up JDK uses: actions/setup-java@v4 with: + cache: maven + distribution: temurin java-version: 21 - distribution: zulu - name: Report Coverage to Coveralls for Pull Requests if: github.event_name == 'pull_request' - run: ./mvnw -B -V test jacoco:report coveralls:report -q -Dlicense.skip=true -DrepoToken=$GITHUB_TOKEN -DserviceName=github -DpullRequest=$PR_NUMBER + run: ./mvnw -B -V test jacoco:report coveralls:report -q -Dlicense.skip=true -DrepoToken=$GITHUB_TOKEN -DserviceName=github -DpullRequest=$PR_NUMBER --no-transfer-progress env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_NUMBER: ${{ github.event.number }} - name: Report Coverage to Coveralls for General Push if: github.event_name == 'push' - run: ./mvnw -B -V test jacoco:report coveralls:report -q -Dlicense.skip=true -DrepoToken=$GITHUB_TOKEN -DserviceName=github + run: ./mvnw -B -V test jacoco:report coveralls:report -q -Dlicense.skip=true -DrepoToken=$GITHUB_TOKEN -DserviceName=github --no-transfer-progress env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/site.yaml b/.github/workflows/site.yaml index 746afc0e..5d699801 100644 --- a/.github/workflows/site.yaml +++ b/.github/workflows/site.yaml @@ -14,21 +14,18 @@ jobs: - name: Set up JDK uses: actions/setup-java@v4 with: + cache: maven + distribution: temurin java-version: 21 - distribution: zulu - - uses: webfactory/ssh-agent@master - with: - ssh-private-key: ${{ secrets.DEPLOY_KEY }} - name: Build site - run: ./mvnw site site:stage -DskipTests -B -V --no-transfer-progress -Dlicense.skip=true + run: ./mvnw site site:stage -DskipTests -Dlicense.skip=true -B -V --no-transfer-progress --settings ./.mvn/settings.xml env: CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NVD_API_KEY: ${{ secrets.NVD_API_KEY }} - name: Deploy Site to gh-pages - uses: JamesIves/github-pages-deploy-action@v4.6.1 + uses: JamesIves/github-pages-deploy-action@v4 with: - ssh-key: true branch: gh-pages folder: target/staging - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ssh-key: ${{ secrets.DEPLOY_KEY }} diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml index 2ca01dc4..d1bc6367 100644 --- a/.github/workflows/sonar.yaml +++ b/.github/workflows/sonar.yaml @@ -17,10 +17,11 @@ jobs: - name: Set up JDK uses: actions/setup-java@v4 with: + cache: maven + distribution: temurin java-version: 21 - distribution: zulu - name: Analyze with SonarCloud - run: ./mvnw verify jacoco:report sonar:sonar -B -Dsonar.projectKey=mybatis_ibatis-2 -Dsonar.organization=mybatis -Dsonar.host.url=https://sonarcloud.io -Dsonar.token=$SONAR_TOKEN -Dlicense.skip=true --no-transfer-progress + run: ./mvnw verify jacoco:report sonar:sonar -B -V -Dsonar.projectKey=mybatis_ibatis-2 -Dsonar.organization=mybatis -Dsonar.host.url=https://sonarcloud.io -Dsonar.token=$SONAR_TOKEN -Dlicense.skip=true --no-transfer-progress env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/sonatype.yaml b/.github/workflows/sonatype.yaml index 72086bc1..494bb2f4 100644 --- a/.github/workflows/sonatype.yaml +++ b/.github/workflows/sonatype.yaml @@ -14,8 +14,9 @@ jobs: - name: Set up JDK uses: actions/setup-java@v4 with: + cache: maven + distribution: temurin java-version: 21 - distribution: zulu - name: Deploy to Sonatype run: ./mvnw deploy -DskipTests -B -V --no-transfer-progress --settings ./.mvn/settings.xml -Dlicense.skip=true env: