| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| # ============================================================================ |
| # Pull Request CI Workflow |
| # ============================================================================ |
| # |
| # Validates pull requests against main with: |
| # 1. build - Compile + format check (fast feedback) |
| # 2. unit-tests - Pure unit tests (no Docker/Testcontainers) |
| # 3. integration-tests - Testcontainers-based integration tests |
| # 4. solr-compatibility - Multi-version Solr matrix (label-gated) |
| # |
| # The solr-compatibility job only runs when the PR has the |
| # "solr-compatibility" label. Default Solr 9.9 is already covered |
| # by the integration-tests job. |
| # ============================================================================ |
| |
| name: CI |
| |
| on: |
| pull_request: |
| branches: |
| - main |
| |
| concurrency: |
| group: ci-${{ github.event.pull_request.number || github.ref }} |
| cancel-in-progress: true |
| |
| permissions: |
| contents: read |
| |
| jobs: |
| # ======================================================================== |
| # Job 1: Build |
| # ======================================================================== |
| # Compiles production and test sources and checks code formatting. |
| # Uses spotlessCheck (read-only) instead of spotlessApply so CI never |
| # modifies source files. |
| # ======================================================================== |
| build: |
| name: Build |
| runs-on: ubuntu-latest |
| timeout-minutes: 15 |
| |
| steps: |
| - name: Checkout code |
| uses: actions/checkout@v4 |
| |
| - name: Set up Java |
| uses: ./.github/actions/setup-java |
| |
| - name: Compile and check formatting |
| run: ./gradlew classes testClasses spotlessCheck |
| |
| # ======================================================================== |
| # Job 2: Unit Tests |
| # ======================================================================== |
| # Runs pure unit tests that do not require Docker or Testcontainers. |
| # Excludes tests tagged with "integration" or "docker-integration". |
| # ======================================================================== |
| unit-tests: |
| name: Unit Tests |
| runs-on: ubuntu-latest |
| needs: build |
| timeout-minutes: 15 |
| |
| steps: |
| - name: Checkout code |
| uses: actions/checkout@v4 |
| |
| - name: Set up Java |
| uses: ./.github/actions/setup-java |
| |
| - name: Run unit tests |
| run: ./gradlew unitTest |
| |
| - name: Upload test results |
| if: always() |
| uses: actions/upload-artifact@v4 |
| with: |
| name: unit-test-results |
| path: build/test-results/unitTest/ |
| retention-days: 7 |
| |
| - name: Upload coverage report |
| if: always() |
| uses: actions/upload-artifact@v4 |
| with: |
| name: unit-test-coverage |
| path: build/reports/jacoco/ |
| retention-days: 7 |
| |
| # ======================================================================== |
| # Job 3: Integration Tests |
| # ======================================================================== |
| # Runs Testcontainers-based integration tests against the default Solr |
| # version (9.9). These tests start real Solr containers via Docker. |
| # ======================================================================== |
| integration-tests: |
| name: Integration Tests |
| runs-on: ubuntu-latest |
| needs: build |
| timeout-minutes: 30 |
| |
| steps: |
| - name: Checkout code |
| uses: actions/checkout@v4 |
| |
| - name: Set up Java |
| uses: ./.github/actions/setup-java |
| |
| - name: Run integration tests |
| run: ./gradlew integrationTest |
| |
| - name: Upload test results |
| if: always() |
| uses: actions/upload-artifact@v4 |
| with: |
| name: integration-test-results |
| path: build/test-results/integrationTest/ |
| retention-days: 7 |
| |
| - name: Upload coverage report |
| if: always() |
| uses: actions/upload-artifact@v4 |
| with: |
| name: integration-test-coverage |
| path: build/reports/jacoco/ |
| retention-days: 7 |
| |
| # ======================================================================== |
| # Job 4: Solr Version Compatibility |
| # ======================================================================== |
| # Tests against multiple Solr versions to catch compatibility regressions. |
| # Only runs when the PR has the "solr-compatibility" label (opt-in). |
| # Solr 9.9 is omitted since it is already tested in integration-tests. |
| # ======================================================================== |
| solr-compatibility: |
| name: Solr ${{ matrix.solr-version }} Compatibility |
| runs-on: ubuntu-latest |
| needs: integration-tests |
| if: contains(github.event.pull_request.labels.*.name, 'solr-compatibility') |
| timeout-minutes: 30 |
| |
| strategy: |
| fail-fast: false |
| matrix: |
| solr-version: |
| - "8.11-slim" |
| - "9.4-slim" |
| - "9.10-slim" |
| - "10-slim" |
| |
| steps: |
| - name: Checkout code |
| uses: actions/checkout@v4 |
| |
| - name: Set up Java |
| uses: ./.github/actions/setup-java |
| |
| - name: Run integration tests against Solr ${{ matrix.solr-version }} |
| env: |
| SOLR_VERSION: ${{ matrix.solr-version }} |
| run: ./gradlew integrationTest "-Dsolr.test.image=solr:${SOLR_VERSION}" |
| |
| - name: Upload test results |
| if: always() |
| uses: actions/upload-artifact@v4 |
| with: |
| name: solr-${{ matrix.solr-version }}-test-results |
| path: build/test-results/integrationTest/ |
| retention-days: 7 |