From 6b8235ad058d65cbe1ac145f2a607f9c6fcf3aab Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Mon, 21 Apr 2025 20:25:01 -0400 Subject: [PATCH 1/4] [gha] Drop java 23, use java 24-ea --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0fb5da5..5cc529b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,7 +9,7 @@ jobs: matrix: cache: [maven] distribution: [temurin] - java: [17, 21, 23, 24-ea, 25-ea] + java: [17, 21, 24, 25-ea] os: [ubuntu-latest, macos-latest, windows-latest] fail-fast: false max-parallel: 4 From 8da34b8cad9d3e60cc66c13d4049ee1c6085063a Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Mon, 21 Apr 2025 20:25:24 -0400 Subject: [PATCH 2/4] [gha] Rework codeql, add maven cache and more checks --- .github/workflows/codeql.yml | 93 ++++++++++-------------------------- 1 file changed, 26 insertions(+), 67 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 34bdf70..e5c3aff 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,90 +1,49 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# name: "CodeQL" on: push: - branches: [ "master" ] + branches: [ master ] pull_request: - branches: [ "master" ] + branches: [ master ] schedule: - cron: '28 4 * * 1' jobs: analyze: name: Analyze - # Runner size impacts CodeQL analysis time. To learn more, please see: - # - https://gh.io/recommended-hardware-resources-for-running-codeql - # - https://gh.io/supported-runners-and-hardware-resources - # - https://gh.io/using-larger-runners - # Consider using larger runners for possible analysis time improvements. runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} permissions: - # required for all workflows - security-events: write - - # only required for workflows in private repositories actions: read contents: read + security-events: write strategy: fail-fast: false matrix: language: [ ] - # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] - # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both - # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - - 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 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - 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 - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: "/language:${{matrix.language}}" + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + cache: maven + distribution: 'temurin' + java-version: 21 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + queries: +security-and-quality + + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{ matrix.language }}" From 5b3a4f01a8f00929f20c2b7494f20860a49a5fc0 Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Mon, 21 Apr 2025 20:25:40 -0400 Subject: [PATCH 3/4] [gha] Add explicit permissions --- .github/workflows/ci.yaml | 2 ++ .github/workflows/site.yaml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5cc529b..6df21c0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,6 +2,8 @@ name: Java CI on: [workflow_dispatch, push, pull_request] +permissions: read-all + jobs: test: runs-on: ${{ matrix.os }} diff --git a/.github/workflows/site.yaml b/.github/workflows/site.yaml index 5d69980..d6c7e24 100644 --- a/.github/workflows/site.yaml +++ b/.github/workflows/site.yaml @@ -5,6 +5,9 @@ on: branches: - site +permissions: + contents: write + jobs: build: if: github.repository_owner == 'mybatis' && ! contains(toJSON(github.event.head_commit.message), '[maven-release-plugin]') From be1bdcc3dabe97bf32d8525e49f797daeb2bcbea Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Mon, 21 Apr 2025 20:26:11 -0400 Subject: [PATCH 4/4] [gha] Update site process --- .github/workflows/site.yaml | 2 -- .mvn/settings.xml | 1 - 2 files changed, 3 deletions(-) diff --git a/.github/workflows/site.yaml b/.github/workflows/site.yaml index d6c7e24..de1babe 100644 --- a/.github/workflows/site.yaml +++ b/.github/workflows/site.yaml @@ -23,7 +23,6 @@ jobs: - name: Build site 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 @@ -31,4 +30,3 @@ jobs: with: branch: gh-pages folder: target/staging - ssh-key: ${{ secrets.DEPLOY_KEY }} diff --git a/.mvn/settings.xml b/.mvn/settings.xml index 4b496e0..42b377a 100644 --- a/.mvn/settings.xml +++ b/.mvn/settings.xml @@ -39,7 +39,6 @@ github - ${env.CI_DEPLOY_USERNAME} ${env.GITHUB_TOKEN}