Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions .github/workflows/code-visualizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Code Visualizer

# The Code Visualizer lives outside the Maven reactor (scripts/code-visualizer) and PR
# CI ignores scripts/**, so nothing else compiles or tests it. Its tests drive the app
# through its MCP tools over a small git repository, under xvfb.
#
# A pull request runs it only when the visualizer's own files change. It is an ordinary
# application over core and the JavaSE port, whose API stays compatible, so a change
# there does not run it; the nightly run catches one that breaks it anyway.

on:
workflow_dispatch:
schedule:
- cron: '11 0 * * *'
pull_request:
branches:
- master
paths:
- '.github/workflows/code-visualizer.yml'
- 'scripts/code-visualizer/**'
- 'scripts/code-visualizer.sh'
- '!scripts/code-visualizer/**/*.md'
- 'maven/code-model/**'
- 'maven/codenameone-maven-plugin/src/main/java/com/codename1/maven/OpenCodeVisualizerMojo.java'

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
# The gate every PR workflow waits on: a PR missing a golden is known to
# fail as a whole, so nothing here runs until Golden capture
# (golden-capture.yml) has committed them.
golden-plan:
uses: ./.github/workflows/golden-plan.yml
permissions:
contents: read

code-visualizer:
needs: golden-plan
if: needs.golden-plan.outputs.run == 'true'
runs-on: ubuntu-24.04
timeout-minutes: 60
container: ghcr.io/codenameone/codenameone/pr-ci-container:latest
defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v6

- name: Cache Maven dependencies
uses: actions/cache@v5
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2

- name: Use Google's copy of Maven Central first
uses: ./.github/actions/maven-central-mirror

- name: Prepare Codename One binaries
# The JavaSE port needs jfxrt.jar from cn1-binaries; without it the
# build fails with a large, misleading set of missing javafx.* errors.
run: |
set -euo pipefail
rm -rf maven/target/cn1-binaries
mkdir -p maven/target
cp -r /opt/cn1-binaries maven/target/cn1-binaries

- name: Install Codename One artifacts (JDK 8)
# JAVA_HOME_8 / JAVA_HOME_17 are container image environment variables,
# so they are expanded by the shell rather than the env context.
run: |
set -euo pipefail
export JAVA_HOME="${JAVA_HOME_8}"
export PATH="${JAVA_HOME}/bin:${PATH}"
cd maven
# Retried: Central has been answering 403 on this runner pool, and Maven treats a
# failed build-extension resolution as permanent -- the job dies in setup having
# proved nothing. Same rationale as setup-workspace.sh's mvn_retry.
bash ../scripts/ci/retry.sh mvn -B install -Plocal-dev-javase -DskipTests \
-Darchetype.test.skip=true -Dmaven.javadoc.skip=true \
-Dcn1.binaries="${GITHUB_WORKSPACE}/maven/target/cn1-binaries"

# JDK 17: the analyzer parses with the in-tree compiler, which needs it at run time.
- name: Run Code Visualizer tests (JDK 17)
run: |
set -euo pipefail
git config --global --add safe.directory '*'
export JAVA_HOME="${JAVA_HOME_17}"
export PATH="${JAVA_HOME}/bin:${PATH}"
cd scripts/code-visualizer
xvfb-run -a mvn -B -pl javase -am -Pexecutable-jar clean test -Dcodename1.platform=javase

- name: Package the executable Code Visualizer (JDK 17)
run: |
set -euo pipefail
export JAVA_HOME="${JAVA_HOME_17}"
export PATH="${JAVA_HOME}/bin:${PATH}"
cd scripts/code-visualizer
xvfb-run -a bash ../../scripts/ci/retry.sh \
mvn -B -pl javase -am -Pexecutable-jar package \
-Dcodename1.platform=javase -Dmaven.test.skip=true
ls javase/target/codenameone-code-visualizer-*.jar

- name: Upload Code Visualizer test reports
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: code-visualizer-test-reports
path: scripts/code-visualizer/javase/target/surefire-reports
if-no-files-found: warn
retention-days: 14
11 changes: 6 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ jobs:
-Dcn1.binaries="${CN1_BINARIES}" \
-Pcompile-android \
-DbackendAnalysis \
-pl android,ios,project-model,build-engine,codenameone-maven-plugin,codenameone-gradle-plugin,backend,backend-test,backend-parparvm,javac,android-res-compiler,android-compat,swing-compat,javafx-compat,compose-compat,rive-runtime,fxml-compiler,desktop-compat-runtime,cn1-app-kit/backend,cn1-app-kit/common,python-transpiler -am verify
-pl android,ios,project-model,build-engine,codenameone-maven-plugin,codenameone-gradle-plugin,backend,backend-test,backend-parparvm,javac,code-model,android-res-compiler,android-compat,swing-compat,javafx-compat,compose-compat,rive-runtime,fxml-compiler,desktop-compat-runtime,cn1-app-kit/backend,cn1-app-kit/common,python-transpiler -am verify
# The step above skips tests, so the Android port's pure-Java unit tests
# (maven/android/src/test) run here, against the classes it just built.
- name: Run Android port unit tests
Expand Down Expand Up @@ -516,7 +516,7 @@ jobs:
- name: Generate static analysis HTML summaries
if: ${{ !cancelled() && matrix.java-version == 8 }}
env:
QUALITY_REPORT_TARGET_DIRS: maven/core-unittests/target:maven/android/target:maven/ios/target:vm/ByteCodeTranslator/target:maven/codenameone-maven-plugin/target:maven/build-engine/target:maven/project-model/target:maven/codenameone-gradle-plugin/target:maven/build-hint-catalog/target:maven/build-hint-tools/target:maven/backend/target:maven/backend-test/target:maven/backend-parparvm/target:maven/javac/target:maven/android-res-compiler/target:maven/android-compat/target:maven/swing-compat/target:maven/javafx-compat/target:maven/compose-compat/target:maven/fxml-compiler/target:maven/desktop-compat-runtime/target:maven/python-transpiler/target:maven/python-runtime/target:maven/rive-runtime/target
QUALITY_REPORT_TARGET_DIRS: maven/core-unittests/target:maven/android/target:maven/ios/target:vm/ByteCodeTranslator/target:maven/codenameone-maven-plugin/target:maven/build-engine/target:maven/project-model/target:maven/codenameone-gradle-plugin/target:maven/build-hint-catalog/target:maven/build-hint-tools/target:maven/backend/target:maven/backend-test/target:maven/backend-parparvm/target:maven/javac/target:maven/code-model/target:maven/android-res-compiler/target:maven/android-compat/target:maven/swing-compat/target:maven/javafx-compat/target:maven/compose-compat/target:maven/fxml-compiler/target:maven/desktop-compat-runtime/target:maven/python-transpiler/target:maven/python-runtime/target:maven/rive-runtime/target
QUALITY_REPORT_SERVER_URL: ${{ github.server_url }}
QUALITY_REPORT_REPOSITORY: ${{ github.repository }}
QUALITY_REPORT_REF: ${{ github.event.pull_request.head.sha || github.sha }}
Expand Down Expand Up @@ -548,7 +548,8 @@ jobs:
"gradle-plugin:maven/codenameone-gradle-plugin/target" \
"backend:maven/backend/target" \
"backend-test:maven/backend-test/target" \
"javac:maven/javac/target"; do
"javac:maven/javac/target" \
"code-model:maven/code-model/target"; do
label="${entry%%:*}"
dir="${entry#*:}"
for filename in spotbugsXml.xml spotbugs.xml; do
Expand Down Expand Up @@ -674,11 +675,11 @@ jobs:
- name: Generate quality report summary
if: ${{ !cancelled() && matrix.java-version == 8 }}
env:
QUALITY_REPORT_TARGET_DIRS: maven/core-unittests/target:maven/android/target:maven/ios/target:vm/ByteCodeTranslator/target:maven/codenameone-maven-plugin/target:maven/build-engine/target:maven/project-model/target:maven/codenameone-gradle-plugin/target:maven/build-hint-catalog/target:maven/build-hint-tools/target:maven/backend/target:maven/backend-test/target:maven/backend-parparvm/target:maven/javac/target:maven/android-res-compiler/target:maven/android-compat/target:maven/swing-compat/target:maven/javafx-compat/target:maven/compose-compat/target:maven/fxml-compiler/target:maven/desktop-compat-runtime/target:maven/python-transpiler/target:maven/python-runtime/target:maven/rive-runtime/target
QUALITY_REPORT_TARGET_DIRS: maven/core-unittests/target:maven/android/target:maven/ios/target:vm/ByteCodeTranslator/target:maven/codenameone-maven-plugin/target:maven/build-engine/target:maven/project-model/target:maven/codenameone-gradle-plugin/target:maven/build-hint-catalog/target:maven/build-hint-tools/target:maven/backend/target:maven/backend-test/target:maven/backend-parparvm/target:maven/javac/target:maven/code-model/target:maven/android-res-compiler/target:maven/android-compat/target:maven/swing-compat/target:maven/javafx-compat/target:maven/compose-compat/target:maven/fxml-compiler/target:maven/desktop-compat-runtime/target:maven/python-transpiler/target:maven/python-runtime/target:maven/rive-runtime/target
# Every project listed here must produce a SpotBugs report and that
# report must be empty. A missing report fails the gate too, so a
# SpotBugs run that silently stops running is not mistaken for clean.
QUALITY_REPORT_REQUIRED_SPOTBUGS: core-unittests:android:ios:ByteCodeTranslator:codenameone-maven-plugin:build-engine:project-model:codenameone-gradle-plugin:build-hint-catalog:build-hint-tools:backend:backend-test:javac:android-res-compiler:android-compat:swing-compat:javafx-compat:compose-compat:fxml-compiler:desktop-compat-runtime:python-transpiler:python-runtime:rive-runtime
QUALITY_REPORT_REQUIRED_SPOTBUGS: core-unittests:android:ios:ByteCodeTranslator:codenameone-maven-plugin:build-engine:project-model:codenameone-gradle-plugin:build-hint-catalog:build-hint-tools:backend:backend-test:javac:code-model:android-res-compiler:android-compat:swing-compat:javafx-compat:compose-compat:fxml-compiler:desktop-compat-runtime:python-transpiler:python-runtime:rive-runtime
# PMD and Checkstyle run on the core, the backend runtime and the Python
# transpiler and runtime, and each must produce its report: without one,
# the PMD gate below it has nothing to read and passes.
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ jobs:
codenameone-build-hint-catalog codenameone-build-hint-tools \
codenameone-cil-translator codenameone-unity-compat \
codenameone-rive-runtime codenameone-rive-transcoder \
codenameone-code-model \
cn1app-archetype cn1lib-archetype \
cn1-app-kit-common cn1-app-kit-backend cn1-app-kit-lib; do
url="${R2_BASE_URL}/com/codenameone/${artifact}/${GITHUB_REF_NAME}/${artifact}-${GITHUB_REF_NAME}.pom?cb=${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
Expand Down Expand Up @@ -442,6 +443,38 @@ jobs:
[ "$code" = "200" ] || { echo "MISSING on R2: codenameone-guibuilder (HTTP $code)" >&2; exit 1; }
echo "ok: codenameone-guibuilder ${GITHUB_REF_NAME} on R2"

# --- Code Visualizer ----------------------------------------------------
# cn1:visualize resolves the visualizer and the analyzer (codenameone-code-model,
# published by the core reactor) at the plugin's own version, like cn1:guibuilder.
- name: Build and stage the Code Visualizer
id: deploy_codevisualizer
continue-on-error: true
if: >-
always() && (steps.deploy.outcome == 'success' ||
steps.r2_core.outcome == 'success')
run: |
export GPG_TTY=$(tty)
cd scripts/code-visualizer
xvfb-run -a mvn -Pexecutable-jar -Pcodevisualizer-central deploy \
-DskipPublishing=true \
-Dcodename1.platform=javase \
-Dgpg.passphrase=$MAVEN_GPG_PASSPHRASE \
-Dcn1.version=$GITHUB_REF_NAME -Dcn1.plugin.version=$GITHUB_REF_NAME \
-Dmaven.test.skip=true
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Publish Code Visualizer to R2
id: r2_codevisualizer
continue-on-error: true
if: always() && steps.deploy_codevisualizer.conclusion != 'skipped'
run: |
bash maven/scripts/r2/publish-staging-to-r2.sh scripts/code-visualizer/target/central-staging
url="${R2_BASE_URL}/com/codenameone/codenameone-code-visualizer/${GITHUB_REF_NAME}/codenameone-code-visualizer-${GITHUB_REF_NAME}.pom?cb=${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
code=$(curl -s -o /dev/null -w "%{http_code}" "$url")
[ "$code" = "200" ] || { echo "MISSING on R2: codenameone-code-visualizer (HTTP $code)" >&2; exit 1; }
echo "ok: codenameone-code-visualizer ${GITHUB_REF_NAME} on R2"

# --- Flutter runtime and Dart runtime -----------------------------------
# codenameone-dart-runtime and codenameone-flutter-runtime compile at
# release 17, so the maven/ reactor only includes them on JDK 17 (the
Expand Down Expand Up @@ -513,13 +546,15 @@ jobs:
steps.deploy_certificatewizard.outcome == 'success' &&
steps.deploy_settings.outcome == 'success' &&
steps.deploy_guibuilder.outcome == 'success' &&
steps.deploy_codevisualizer.outcome == 'success' &&
steps.deploy_flutter.outcome == 'success' &&
steps.r2_core.outcome == 'success' &&
steps.r2_core_confirm.outcome == 'success' &&
steps.r2_gamebuilder.outcome == 'success' &&
steps.r2_certificatewizard.outcome == 'success' &&
steps.r2_settings.outcome == 'success' &&
steps.r2_guibuilder.outcome == 'success' &&
steps.r2_codevisualizer.outcome == 'success' &&
steps.r2_flutter.outcome == 'success'
run: bash maven/scripts/r2/mark-release-complete.sh "${GITHUB_REF_NAME}"

Expand Down Expand Up @@ -573,13 +608,15 @@ jobs:
bad "${{ steps.deploy_certificatewizard.outcome }}" && fail "Signing Wizard build"
bad "${{ steps.deploy_settings.outcome }}" && fail "Settings build"
bad "${{ steps.deploy_guibuilder.outcome }}" && fail "GUI Builder build"
bad "${{ steps.deploy_codevisualizer.outcome }}" && fail "Code Visualizer build"
bad "${{ steps.deploy_flutter.outcome }}" && fail "Flutter runtimes build"
bad "${{ steps.r2_core.outcome }}" && fail "core reactor -> R2"
bad "${{ steps.r2_core_confirm.outcome }}" && fail "core artifacts missing on R2"
bad "${{ steps.r2_gamebuilder.outcome }}" && fail "Game Builder -> R2"
bad "${{ steps.r2_certificatewizard.outcome }}" && fail "Signing Wizard -> R2"
bad "${{ steps.r2_settings.outcome }}" && fail "Settings -> R2"
bad "${{ steps.r2_guibuilder.outcome }}" && fail "GUI Builder -> R2"
bad "${{ steps.r2_codevisualizer.outcome }}" && fail "Code Visualizer -> R2"
bad "${{ steps.r2_flutter.outcome }}" && fail "Flutter runtimes -> R2"
bad "${{ steps.r2_mark_complete.outcome }}" && fail "marking the R2 release complete"
bad "${{ steps.r2_metadata.outcome }}" && fail "R2 metadata regeneration"
Expand Down
6 changes: 3 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ PR CI (`.github/workflows/pr.yml`, Java 8 leg) runs SpotBugs over
build plugins share), `project-model` (the project-layout API),
`android-res-compiler` and `android-compat` (the Android compatibility
runtime), `codenameone-gradle-plugin`, `javac` (the in-tree Java compiler,
`vm/JavaCompiler`) and `python-transpiler`, plus `python-runtime` in a step of
`vm/JavaCompiler`), `code-model` (the code visualizer's analyzer) and `python-transpiler`, plus `python-runtime` in a step of
its own on JDK 17 (it compiles at release 17), then enforces the result in
`.github/scripts/generate-quality-report.py`. `cil-translator` and
`unity-compat` (the Unity compatibility translator and runtime) are held to the
Expand All @@ -133,7 +133,7 @@ it runs only when the Unity tree itself changes, so a change to the core's
`vm/ByteCodeTranslator/`, `maven/codenameone-maven-plugin/`,
`maven/build-engine/`, `maven/project-model/`,
`maven/android-res-compiler/`, `maven/android-compat/`,
`maven/codenameone-gradle-plugin/`, `maven/javac/`,
`maven/codenameone-gradle-plugin/`, `maven/javac/`, `maven/code-model/`,
`maven/python-transpiler/`, `maven/python-runtime/`,
`maven/cil-translator/`, `maven/unity-compat/`), scoped to the
class or method it applies to and with a comment explaining why. Keep the
Expand All @@ -148,7 +148,7 @@ To reproduce the SpotBugs gate locally:
```bash
source tools/env.sh # JDK 8
cd maven && mvn -B -DskipTests=true -Pcompile-android \
-pl android,ios,project-model,android-res-compiler,android-compat,build-engine,codenameone-maven-plugin,codenameone-gradle-plugin,javac -am verify
-pl android,ios,project-model,android-res-compiler,android-compat,build-engine,codenameone-maven-plugin,codenameone-gradle-plugin,javac,code-model -am verify
mvn -B -DunitTests -DskipTests=true -pl core-unittests verify
mvn -B -DskipTests=true -f ../vm/ByteCodeTranslator/pom.xml verify
```
Expand Down
Loading
Loading