Skip to content

Bump the version-updates group across 1 directory with 8 updates #69

Bump the version-updates group across 1 directory with 8 updates

Bump the version-updates group across 1 directory with 8 updates #69

Workflow file for this run

name: Build and Test
on:
push:
branches:
- '2023'
- '2025'
pull_request:
branches:
- '2023'
- '2025'
concurrency:
group: build-${{ github.ref }}
# Only cancel in-progress for PRs; branch pushes must not be interrupted mid-publish.
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
MAVEN_OPTS: >-
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
-Daether.syncContext.named.time=600
-Xms512m
-Xmx1536m
REGISTRY: docker-internal.packages.nuxeo.com
REPOSITORY: nuxeo/nuxeo-ai
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
permissions:
contents: read
checks: write
pull-requests: write
jobs:
properties:
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.env.outputs.VERSION }}
IS_BRANCH_PUSH: ${{ steps.env.outputs.IS_BRANCH_PUSH }}
JAVA_VERSION: ${{ steps.env.outputs.JAVA_VERSION }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Resolve version info
id: env
run: |
set -e
# Skip <parent> block to extract the project's own <version> without needing Maven
CURRENT_VERSION=$(sed -n '/<parent>/,/<\/parent>/d; s/.*<version>\(.*\)<\/version>.*/\1/p' pom.xml | head -1 | xargs)
if [[ -z "$CURRENT_VERSION" ]]; then
echo "::error::Failed to resolve version from pom.xml"
exit 1
fi
BASE_VERSION=${CURRENT_VERSION%-SNAPSHOT}
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
VERSION="${BASE_VERSION}-pr.${{ github.event.number }}.${{ github.run_number }}"
IS_BRANCH_PUSH=false
TARGET_BRANCH="${{ github.base_ref }}"
else
# Keep -SNAPSHOT so mvn deploy publishes to snapshots, not releases
VERSION="${CURRENT_VERSION}"
IS_BRANCH_PUSH=true
TARGET_BRANCH="${{ github.ref_name }}"
fi
# 2025 → Java 21, everything else → Java 17
case "$TARGET_BRANCH" in
2025*) JAVA_VERSION=21 ;;
*) JAVA_VERSION=17 ;;
esac
{
echo "VERSION=$VERSION"
echo "IS_BRANCH_PUSH=$IS_BRANCH_PUSH"
echo "JAVA_VERSION=$JAVA_VERSION"
} >> "$GITHUB_OUTPUT"
echo "Version=$VERSION | Java=$JAVA_VERSION | Branch push=$IS_BRANCH_PUSH"
build:
needs: properties
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.properties.outputs.VERSION }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: Setup Maven build
uses: nuxeo/gh-build-tools/.github/actions/setup-maven-build@v0.14.0
with:
java-version: ${{ needs.properties.outputs.JAVA_VERSION }}
java-distribution: 'temurin'
maven-settings: '.github/maven-settings.xml'
env:
MVN_REPO_USERNAME: ${{ secrets.REPOSITORY_MANAGER_USERNAME }}
MVN_REPO_PASSWORD: ${{ secrets.REPOSITORY_MANAGER_PASSWORD }}
- name: Install system dependencies
run: |
sudo apt-get -y update && sudo apt-get install -y --no-install-recommends \
perl \
locales \
pwgen \
imagemagick \
poppler-utils \
libwpd-tools \
exiftool \
ghostscript \
ffmpeg \
x264
- name: Build with Maven
id: build
run: |
set -e
echo "::group::Building $VERSION"
mvn $MAVEN_ARGS versions:set -DnewVersion="$VERSION"
mvn $MAVEN_ARGS install -fae -B -DskipTests
echo "::endgroup::"
env:
MVN_REPO_USERNAME: ${{ secrets.REPOSITORY_MANAGER_USERNAME }}
MVN_REPO_PASSWORD: ${{ secrets.REPOSITORY_MANAGER_PASSWORD }}
MAVEN_ARGS: "-B -V -nsu --no-transfer-progress -DgenerateBackupPoms=false"
- name: Run Tests
id: test
run: |
mvn install --fail-never -nsu -B -Dnuxeo.test.elasticsearch.addressList=http://localhost:9200
env:
MVN_REPO_USERNAME: ${{ secrets.REPOSITORY_MANAGER_USERNAME }}
MVN_REPO_PASSWORD: ${{ secrets.REPOSITORY_MANAGER_PASSWORD }}
- name: Publish test results
if: always() && steps.test.outcome != 'skipped'
uses: EnricoMi/publish-unit-test-result-action@d0a4676d0e0b938bc201470d88276b7c74c712b3 # v2.24.0
with:
files: |
**/target/*-reports/*.xml
**/target/surefire-reports/*.xml
check_name: Test Results
- name: Generate JaCoCo Aggregate Report
if: always() && steps.test.outcome == 'success'
run: |
mvn $MAVEN_ARGS -pl :nuxeo-ai-core-package -am verify -DskipTests
env:
MVN_REPO_USERNAME: ${{ secrets.REPOSITORY_MANAGER_USERNAME }}
MVN_REPO_PASSWORD: ${{ secrets.REPOSITORY_MANAGER_PASSWORD }}
MAVEN_ARGS: "-B -V -nsu --no-transfer-progress"
- name: SonarCloud Analysis
if: always() && steps.test.outcome == 'success'
run: |
SONAR_PARAMS="-Dsonar.verbose=false"
if [ "${{ github.event_name }}" = "pull_request" ]; then
SONAR_PARAMS="$SONAR_PARAMS -Dsonar.pullrequest.key=${{ github.event.number }}"
SONAR_PARAMS="$SONAR_PARAMS -Dsonar.pullrequest.branch=${{ github.head_ref }}"
SONAR_PARAMS="$SONAR_PARAMS -Dsonar.pullrequest.base=${{ github.base_ref }}"
else
SONAR_PARAMS="$SONAR_PARAMS -Dsonar.branch.name=${{ github.ref_name }}"
fi
mvn $MAVEN_ARGS -DskipTests sonar:sonar $SONAR_PARAMS
env:
MVN_REPO_USERNAME: ${{ secrets.REPOSITORY_MANAGER_USERNAME }}
MVN_REPO_PASSWORD: ${{ secrets.REPOSITORY_MANAGER_PASSWORD }}
MAVEN_ARGS: "-B -V -nsu --no-transfer-progress"
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# Upload even on failure to help debug broken builds
- name: Upload build artifacts
if: always() && steps.build.outcome != 'skipped'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: nuxeo-ai-build
path: |
./**/target/**/*package*.zip
./nuxeo-ai-core-package/target/nuxeo-ai-core-${{ env.VERSION }}.zip
retention-days: 7
if-no-files-found: warn
- name: Publish packages to Maven
if: needs.properties.outputs.IS_BRANCH_PUSH == 'true'
run: |
mvn deploy -B -nsu --no-transfer-progress -DskipTests
env:
MVN_REPO_USERNAME: ${{ secrets.REPOSITORY_MANAGER_USERNAME }}
MVN_REPO_PASSWORD: ${{ secrets.REPOSITORY_MANAGER_PASSWORD }}
- name: Publish packages to Preprod Marketplace
if: needs.properties.outputs.IS_BRANCH_PUSH == 'true'
run: |
set -e
failed=false
packages=(
"nuxeo-ai-core-package/target/nuxeo-ai-core-${{ env.VERSION }}.zip"
"addons/nuxeo-ai-aws-package/target/nuxeo-ai-aws-package-${{ env.VERSION }}.zip"
"addons/nuxeo-ai-gcp-package/target/nuxeo-ai-gcp-package-${{ env.VERSION }}.zip"
"addons/nuxeo-ai-image-quality-package/target/nuxeo-ai-image-quality-package-${{ env.VERSION }}.zip"
"addons/nuxeo-ai-content-intelligence-package/target/nuxeo-ai-content-intelligence-package-${{ env.VERSION }}.zip"
)
for pkg in "${packages[@]}"; do
if [[ -f "$pkg" ]]; then
echo "Publishing: $(basename "$pkg")"
STATUS_CODE=$(curl -i --silent --output /dev/null -w "%{http_code}" \
-u "${{ secrets.CONNECT_PREPROD_USERNAME }}:${{ secrets.CONNECT_PREPROD_PASSWORD }}" \
-F "package=@${pkg}" \
"https://nos-preprod-connect.nuxeocloud.com/nuxeo/site/marketplace/upload?batch=true")
if [[ "$STATUS_CODE" != "200" ]]; then
echo "::error::Failed to publish $(basename "$pkg") — HTTP $STATUS_CODE"
failed=true
fi
else
echo "Skipping $(basename "$pkg") — not found"
fi
done
if [[ "$failed" == "true" ]]; then
echo "::error::One or more preprod marketplace uploads failed"
exit 1
fi
- name: Build & Push Docker Preview Image
if: github.event_name == 'pull_request' && contains(join(github.event.pull_request.labels.*.name, ','), 'preview')
uses: ./.github/actions/docker-build-preview
with:
version: ${{ env.VERSION }}
registry: docker-internal.packages.nuxeo.com
repository: nuxeo/nuxeo-ai
docker-username: ${{ secrets.REPOSITORY_MANAGER_USERNAME }}
docker-password: ${{ secrets.REPOSITORY_MANAGER_PASSWORD }}
nuxeo-clid: ${{ secrets.DEVOPS_CLID }}
notify-on-error:
runs-on: ubuntu-latest
needs: [properties, build]
if: >-
failure() &&
(needs.properties.result == 'failure' || needs.build.result == 'failure') &&
(github.event_name == 'push')
steps:
- name: Slack Notification
uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c
with:
channel-id: "C9W4P9RKM"
slack-message: "Nuxeo AI ${{ github.workflow }} workflow failed!\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATION_BOT_TOKEN }}