Repository navigation
115 lines (102 loc) · 4.4 KB
/
Copy pathcode-visualizer.yml
File metadata and controls
115 lines (102 loc) · 4.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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