test: consolidated AI integration coverage #263
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| java-version: [11, 17, 21] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK ${{ matrix.java-version }} | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: ${{ matrix.java-version }} | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Run unit tests | |
| run: mvn -B clean test -DskipTests=false | |
| - name: Build project | |
| run: mvn -B clean install -DskipTests | |
| - name: Check NBM artifact | |
| shell: bash | |
| run: | | |
| shopt -s nullglob | |
| artifacts=(target/*.nbm) | |
| if [ ${#artifacts[@]} -eq 0 ]; then | |
| echo "❌ NBM artifact not found" | |
| exit 1 | |
| fi | |
| printf '✅ NBM artifact(s):\n%s\n' "${artifacts[@]}" | |
| - name: Generate coverage report | |
| if: matrix.java-version == 11 | |
| run: mvn -B jacoco:report | |
| - name: Upload coverage to Codecov | |
| if: matrix.java-version == 11 | |
| uses: codecov/codecov-action@v7 | |
| with: | |
| files: target/jacoco.exec | |
| flags: unittests | |
| name: codecov-umbrella | |
| publish-release: | |
| needs: build-and-test | |
| runs-on: ubuntu-latest | |
| if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 11 | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Get version and release tag | |
| id: version | |
| shell: bash | |
| run: | | |
| VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
| if [[ "$VERSION" == *-SNAPSHOT ]]; then | |
| SHORT_SHA="${GITHUB_SHA:0:7}" | |
| TAG="v${VERSION}.${GITHUB_RUN_NUMBER}.${SHORT_SHA}" | |
| PRERELEASE=true | |
| NAME="Continue Beans ${VERSION} #${GITHUB_RUN_NUMBER}" | |
| else | |
| TAG="v${VERSION}" | |
| PRERELEASE=false | |
| NAME="Continue Beans v${VERSION}" | |
| fi | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "tag=${TAG}" >> "$GITHUB_OUTPUT" | |
| echo "name=${NAME}" >> "$GITHUB_OUTPUT" | |
| echo "prerelease=${PRERELEASE}" >> "$GITHUB_OUTPUT" | |
| echo "Version: ${VERSION}" | |
| echo "Tag: ${TAG}" | |
| - name: Build final artifact | |
| run: mvn -B clean package -DskipTests | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| tag_name: ${{ steps.version.outputs.tag }} | |
| name: ${{ steps.version.outputs.name }} | |
| body: | | |
| ## Continue Beans AI Assistant ${{ steps.version.outputs.version }} | |
| Install the generated `.nbm` with NetBeans Plugin Manager. | |
| files: | | |
| target/*.nbm | |
| target/*.jar | |
| draft: false | |
| prerelease: ${{ steps.version.outputs.prerelease }} | |
| make_latest: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| code-quality: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 11 | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Run static analysis | |
| run: mvn -B clean verify | |
| - name: Generate test report | |
| if: always() | |
| run: | | |
| echo "## Test Results" >> "$GITHUB_STEP_SUMMARY" | |
| echo "Build and verification completed." >> "$GITHUB_STEP_SUMMARY" |