Back to Plantuml

Continuous Integration Workflow (`ci.yml`)

docs/ci.md

2017.119.5 KB
Original Source

Continuous Integration Workflow (ci.yml)

This document explains the main CI workflow defined in ci.yml, which drives the build, testing, and release automation for the PlantUML project.


🎯 Purpose

The ci.yml workflow ensures that every contribution (push, pull request, or manual trigger) is:

  1. Built and validated with Gradle.
  2. Fully tested (unit and integration tests).
  3. Automatically packaged and released on GitHub when a new version or snapshot is tagged.

⚙️ Triggers

The workflow is executed on:

  • Push events (branches and tags).
  • Pull requests (to validate external contributions).
  • Manual triggers via workflow_dispatch.

📋 Workflow Steps

1. Setup

  • Install required JDK version.
  • Restore Gradle cache for faster builds.

2. Build

bash
./gradlew build

Compiles the project and prepares artifacts.

3. Test

bash
./gradlew test

Runs unit and integration tests. The workflow fails if tests do not pass.

4. Release Logic

Two scripts handle publishing:

  • release.sh: builds and publishes a full release with all JARs, sources, javadocs, PDF, and license variants (ASL, BSD, EPL, LGPL, MIT, GPLv2). It also attaches optional GPG signatures if available. Finally, it creates a GitHub Release using gh release create.
  • release-snapshot.sh: manages pre-release snapshots. It re-tags snapshot, publishes snapshot JARs (with timestamp and notes), and creates a prerelease on GitHub.

Jobs

JobPurposeKey steps / OutputsNeedsCondition
jdk8Java 8/Ant buildCheckout → setup-java (Temurin 8) → ensure Ant → ASCII test → upload artifacts: plantuml.jar
workflow_configCentral config gate: computes flags & version from event contextSets outputs: do_release, do_snapshot_release, pom_version, do_javadoc, do_test_linux, do_test_windows
test_linuxLinux matrix build & tests (Temurin 17)Checkout → setup-java → compiletest → upload artifacts/reportsworkflow_configif: do_test_linux == 'true'
build_artifactsBuild & (optionally) sign artifactsBuild main JAR, -sources, -javadoc, PDF; license variants; optional GPG signing; outputs release_versionworkflow_config
deploy_javadoc_jacocoPublish Javadoc & Jacoco reports to GitHub PagesBuild Javadoc → run tests → build Jacoco HTML → move to build/docs → deploy with peaceiris/actions-gh-pagesbuild_artifacts, test_linux, jdk8if: do_javadoc == 'true'
uploadCreate GitHub Release or SnapshotOn release: run release.sh (attach assets & signatures). On snapshot: run release-snapshot.sh (retag snapshot, timestamp, prerelease)workflow_config, build_artifacts, test_linux, jdk8if: do_release == 'true' OR do_snapshot_release == 'true'
push_to_docker_registryBuild & push multi-arch Docker image to GHCRsetup-qemu → setup-buildx → docker/metadata → docker/login → docker/build-push (linux/amd64, arm64)workflow_config, upload, test_linuxif: do_release == 'true'
create_native_image_releaseBuild native image (reusable workflow)uses: ./.github/workflows/native-image-release.ymlworkflow_config, uploadif: do_release == 'true'
trigger_plantuml_eclipse_releaseTrigger downstream PlantUML Eclipse releaseuses: ./.github/workflows/trigger-plantuml-eclipse-release.yml (passes version/ref/sha)workflow_config, upload, build_artifactsif: do_release == 'true' OR do_snapshot_release == 'true'

📊 Workflow Summary (Table)

PhaseStep / JobMain ActionsConditionsOutputs
Triggerpush, pull_request, workflow_dispatchStarts the CI workflowExecution context
PreparationSetup JDK & GradleInstall Java, restore Gradle cacheAlwaysFaster builds
Build./gradlew buildCompiles all sourcesCompiled JARs
Test./gradlew testRuns unit & integration testsMust passTest reports
Release (tag)release.shPackages full artifacts (main JAR, -sources, -javadoc, PDF, license variants, signatures) and creates GitHub releaseTriggered on version tagsGitHub Release with assets
Snapshotrelease-snapshot.shForces snapshot tag, publishes SNAPSHOT artifacts with timestamp & notes, creates prereleaseTriggered manually / snapshotsGitHub prerelease with assets
PostNotificationsAdds ::notice messages with release URLOn release/snapshotRelease log & traceability

🔄 Visual Diagram