Repository navigation
128 lines (116 loc) · 5.28 KB
/
Copy pathembedded-linux.yml
File metadata and controls
128 lines (116 loc) · 5.28 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
116
117
118
119
120
121
122
123
124
125
126
127
128
# Builds and runs the embedded Linux port (CN1_LINUX_EMBEDDED: DRM/KMS, fbdev or
# memory display, evdev input, no GTK) the way scripts/embedded/README.md tells a
# user to: translate scripts/embedded/demo with translate.sh, build it for arm64
# with build-dist.sh in Containerfile.dev, and run it on the memory display.
#
# check-demo-run.py then fails the job when frame 60 is missing, wrong or blank,
# or when the speed and memory the developer guide reports have slipped. The
# generated stub file is checked against the natives too, since a native added to
# LinuxNative without a stub breaks only the embedded link.
#
# The GPU renderer (CN1_EMBEDDED_GPU, GLES2 through GBM/EGL) runs on Mesa's
# llvmpipe, since the runner has no GPU: gpu-check draws every kind of operation
# both ways and fails on a differing pixel, and the demo is built a second time
# with the GPU renderer, whose frame 60 must match the software run's exactly.
# llvmpipe says nothing about a board's GPU speed; it holds correctness.
name: Embedded Linux
on:
workflow_dispatch:
push:
branches: [master]
paths:
- 'Ports/LinuxPort/**'
- 'CodenameOne/src/**'
- 'vm/ByteCodeTranslator/src/**'
- 'vm/JavaAPI/src/**'
- 'maven/linux/**'
- 'scripts/embedded/**'
- '.github/workflows/embedded-linux.yml'
pull_request:
paths:
- 'Ports/LinuxPort/**'
- 'CodenameOne/src/**'
- 'vm/ByteCodeTranslator/src/**'
- 'vm/JavaAPI/src/**'
- 'maven/linux/**'
- 'scripts/embedded/**'
- '.github/workflows/embedded-linux.yml'
concurrency:
group: embedded-linux-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
demo:
runs-on: ubuntu-24.04-arm
timeout-minutes: 75
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: The embedded stubs match the natives
run: python3 scripts/embedded/gen-embedded-stubs.py --check
- name: Set up JDK 8
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '8'
cache: 'maven'
# Retried: Maven Central answers 429 from the runner CDN edge (see
# linux-build-run.yml). This step only builds.
- name: Build core, the Linux port, JavaAPI and the translator
env:
RETRY_ATTEMPTS: '5'
RETRY_DELAY_SECONDS: '60'
run: |
cd maven
bash ../scripts/ci/retry.sh mvn -B -pl core,linux -am install \
-DskipTests -Dmaven.javadoc.skip=true -Plocal-dev-javase \
-Dspotbugs.skip=true -Dpmd.skip=true -Dcheckstyle.skip=true \
-Dmaven.repo.local="$GITHUB_WORKSPACE/.m2-repo"
cd ..
bash scripts/ci/retry.sh mvn -B -f vm/pom.xml -pl JavaAPI,ByteCodeTranslator -am package \
-DskipTests -Dmaven.repo.local="$GITHUB_WORKSPACE/.m2-repo"
- name: Translate and build the demo for arm64
run: |
B="$RUNNER_TEMP/demo"
mkdir -p "$B/classes"
javac -source 1.8 -target 1.8 -cp maven/core/target/classes:maven/linux/target/classes \
-d "$B/classes" scripts/embedded/demo/src/EmbeddedDemo.java
scripts/embedded/translate.sh "$B/classes" EmbeddedDemo "$B/out"
scripts/embedded/build-dist.sh "$B/out" arm64
- name: Run the demo on the memory display
run: |
B="$RUNNER_TEMP/demo"
mkdir -p "$B/result"
docker run --rm -v "$B/out/build-arm64:/cn1:ro" -v "$B/result:/result" cn1-embedded-dev:arm64 \
bash -c 'cd /tmp && CN1_DISPLAY=memory CN1_SIZE=800x480 CN1_BENCH_SECONDS=10 \
CN1_SNAPSHOT=/result/frame60.png timeout 120 /cn1/EmbeddedDemo > /result/demo.log 2>&1'
python3 scripts/embedded/check-demo-run.py "$B/result/demo.log" "$B/result/frame60.png" \
"$GITHUB_STEP_SUMMARY"
- name: The GPU renderer draws what the software one draws
run: scripts/embedded/gpu-check/check-gpu.sh arm64 "$RUNNER_TEMP/demo/result/gpu-check"
# Same translation, rebuilt with the GPU renderer into the same build
# directory; the software run above has already been judged.
- name: Run the demo with the GPU renderer
env:
CN1_CMAKE_ARGS: -DCN1_EMBEDDED_GPU=ON
run: |
B="$RUNNER_TEMP/demo"
scripts/embedded/build-dist.sh "$B/out" arm64
mkdir -p "$B/result/gpu"
docker run --rm -e LIBGL_ALWAYS_SOFTWARE=1 -v "$B/out/build-arm64:/cn1:ro" \
-v "$B/result/gpu:/result" cn1-embedded-dev:arm64 \
bash -c 'cd /tmp && CN1_DISPLAY=memory CN1_SIZE=800x480 CN1_BENCH_SECONDS=10 \
CN1_SNAPSHOT=/result/frame60.png timeout 120 /cn1/EmbeddedDemo > /result/demo.log 2>&1'
grep -q "renderer gpu" "$B/result/gpu/demo.log" \
|| { echo "the GPU build did not render with the GPU"; tail -20 "$B/result/gpu/demo.log"; exit 1; }
python3 scripts/embedded/check-demo-run.py --max-rss-mb 160 \
--reference "$B/result/frame60.png" "$B/result/gpu/demo.log" "$B/result/gpu/frame60.png" \
"$GITHUB_STEP_SUMMARY"
- name: Upload the run
if: always()
uses: actions/upload-artifact@v4
with:
name: embedded-demo
path: ${{ runner.temp }}/demo/result
if-no-files-found: ignore