diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0501a07..43b902d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,22 +3,62 @@ name: Build on: pull_request: +permissions: + contents: read + actions: write # required for actions/upload-artifact + +concurrency: + group: build-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: - build: - name: Build + + # ── 1. Format check (fast, ~30s, no Docker needed) ────────────────────────── + style: + name: Code Style runs-on: ubuntu-latest + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + + - name: Set up Java + uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 + with: + java-version: 21 + distribution: 'zulu' + + - name: Cache Gradle + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Cache Gradle wrapper + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 + with: + path: ~/.gradle/wrapper + key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }} + restore-keys: ${{ runner.os }}-gradlew- + - name: Spotless check + run: ./gradlew spotlessCheck -S + + # ── 2. Compile (fast, ~1–2 min, no tests, no Docker) ──────────────────────── + compile: + name: Compile + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 with: java-version: 21 distribution: 'zulu' - name: Cache Gradle - uses: actions/cache@v4 + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 with: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }} @@ -26,24 +66,85 @@ jobs: ${{ runner.os }}-gradle- - name: Cache Gradle wrapper - uses: actions/cache@v4 + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 with: path: ~/.gradle/wrapper key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }} restore-keys: ${{ runner.os }}-gradlew- - - name: Code Style Check - run: | - ./gradlew spotlessCheck -S + - name: Compile (no tests) + run: ./gradlew assemble -S - - name: Build - run: | - ./gradlew build -S + # ── 3. Unit tests (requires Docker for testcontainers/Redis) ──────────────── + test: + name: Test + runs-on: ubuntu-latest + needs: compile + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + + - name: Set up Java + uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 + with: + java-version: 21 + distribution: 'zulu' + + - name: Cache Gradle + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Cache Gradle wrapper + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 + with: + path: ~/.gradle/wrapper + key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }} + restore-keys: ${{ runner.os }}-gradlew- + + - name: Run tests + run: ./gradlew :core:test :demos:langchain4j-vcr:test :demos:spring-ai-vcr:test -S - name: Upload test reports if: failure() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: test-reports path: | - build/reports/tests/aggregate/ + core/build/reports/tests/test/ + demos/langchain4j-vcr/build/reports/tests/test/ + demos/spring-ai-vcr/build/reports/tests/test/ + + # ── 4. Static analysis (runs in parallel with tests after compile) ─────────── + spotbugs: + name: SpotBugs + runs-on: ubuntu-latest + needs: compile + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + + - name: Set up Java + uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 + with: + java-version: 21 + distribution: 'zulu' + + - name: Cache Gradle + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Cache Gradle wrapper + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 + with: + path: ~/.gradle/wrapper + key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }} + restore-keys: ${{ runner.os }}-gradlew- + + - name: SpotBugs + run: ./gradlew :core:spotbugsMain -S diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index cbb7f69..c2e3ea8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -23,23 +23,23 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 with: fetch-depth: 0 - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 with: java-version: 21 distribution: 'zulu' - name: Set up Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: 20 - name: Cache Gradle dependencies - uses: actions/cache@v4 + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 with: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} @@ -47,7 +47,7 @@ jobs: ${{ runner.os }}-gradle- - name: Cache Gradle wrapper - uses: actions/cache@v4 + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 with: path: ~/.gradle/wrapper key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }} @@ -72,13 +72,13 @@ jobs: run: touch docs/build/site/.nojekyll - name: Setup Pages - uses: actions/configure-pages@v4 + uses: actions/configure-pages@1f0c5cde4bc74cd7e1254d0cb4de8d49e9068c7d # v4 - name: Upload artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3 with: path: 'docs/build/site' - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4 diff --git a/.github/workflows/early-access.yml b/.github/workflows/early-access.yml index 1aa191b..7ace733 100644 --- a/.github/workflows/early-access.yml +++ b/.github/workflows/early-access.yml @@ -4,29 +4,32 @@ on: push: branches: [ main ] +permissions: + contents: write + actions: write # required for actions/upload-artifact + +concurrency: + group: early-access-${{ github.ref }} + cancel-in-progress: true + jobs: earlyaccess: name: 'Early Access' runs-on: ubuntu-latest steps: - - name: Cancel previous run - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ secrets.GIT_ACCESS_TOKEN }} - - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 with: fetch-depth: 0 - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 with: java-version: 21 distribution: 'zulu' - name: Cache Gradle - uses: actions/cache@v4 + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 with: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }} @@ -34,7 +37,7 @@ jobs: ${{ runner.os }}-gradle- - name: Cache Gradle wrapper - uses: actions/cache@v4 + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 with: path: ~/.gradle/wrapper key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }} @@ -46,7 +49,7 @@ jobs: - name: Upload test reports if: failure() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: test-report path: | @@ -79,7 +82,7 @@ jobs: - name: Release Snapshot if: ${{ steps.vars.outputs.SHOULD_RELEASE_SNAPSHOT == 'true' }} - uses: jreleaser/release-action@v2 + uses: jreleaser/release-action@90ac653bb9c79d11179e65d81499f3f34527dcd5 # 2.5.0 with: arguments: release version: 'latest' @@ -97,7 +100,7 @@ jobs: - name: JReleaser output if: always() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: artifact path: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a953b47..ee6c1a3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,29 +8,32 @@ on: required: true type: string +permissions: + contents: write + actions: write # required for actions/upload-artifact + +concurrency: + group: release-${{ github.ref }} + cancel-in-progress: false + jobs: release: name: Release runs-on: ubuntu-latest steps: - - name: Cancel previous run - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ secrets.GIT_ACCESS_TOKEN }} - - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 with: fetch-depth: 0 - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 with: java-version: 21 distribution: 'zulu' - name: Cache Gradle - uses: actions/cache@v4 + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 with: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }} @@ -38,7 +41,7 @@ jobs: ${{ runner.os }}-gradle- - name: Cache Gradle wrapper - uses: actions/cache@v4 + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 with: path: ~/.gradle/wrapper key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }} @@ -66,21 +69,21 @@ jobs: - name: Upload test reports if: failure() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: test-reports path: | build/reports/tests/aggregate/ - name: Assemble - uses: jreleaser/release-action@v2 + uses: jreleaser/release-action@90ac653bb9c79d11179e65d81499f3f34527dcd5 # 2.5.0 with: arguments: assemble env: JRELEASER_PROJECT_VERSION: ${{ inputs.version }} - name: Release - uses: jreleaser/release-action@v2 + uses: jreleaser/release-action@90ac653bb9c79d11179e65d81499f3f34527dcd5 # 2.5.0 with: arguments: full-release env: @@ -97,7 +100,7 @@ jobs: - name: JReleaser output if: always() - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: artifact path: | @@ -105,7 +108,7 @@ jobs: out/jreleaser/output.properties - name: Trigger documentation build - uses: peter-evans/repository-dispatch@v2 + uses: peter-evans/repository-dispatch@bf47d102fdb849e755b0b0023ea3e81a44b6f570 # v2 with: token: ${{ secrets.GIT_ACCESS_TOKEN }} event-type: docs-build