Skip to content

Commit b5a012c

Browse files
committed
Merge remote-tracking branch 'origin/master' into moving-initializr-to-new-js-port
# Conflicts: # Ports/JavaScriptPort/src/main/webapp/port.js # scripts/hellocodenameone/common/src/main/java/com/codenameone/examples/hellocodenameone/tests/Cn1ssDeviceRunner.java
2 parents bafab53 + 1750d63 commit b5a012c

30 files changed

Lines changed: 1557 additions & 95 deletions

File tree

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: _Build iOS port (reusable)
2+
3+
# Reusable workflow that runs scripts/setup-workspace.sh + scripts/build-ios-port.sh
4+
# once per workflow run, populating shared caches that downstream test jobs (in
5+
# scripts-ios.yml, scripts-ios-native.yml, ios-packaging.yml) restore via the
6+
# same cache keys.
7+
#
8+
# A separate "cn1-built" cache is keyed on the CN1 source hash with no restore-
9+
# keys (exact match only). On hit, the entire setup-workspace + build-ios-port
10+
# sequence is skipped — the iOS port artifact in ~/.m2/repository/com/codenameone
11+
# is already correct for the current source state.
12+
#
13+
# This cache is shared across all three iOS workflows on the same branch, so
14+
# whichever workflow runs first populates it and the others skip the rebuild.
15+
16+
on:
17+
workflow_call:
18+
19+
jobs:
20+
build:
21+
runs-on: macos-15
22+
timeout-minutes: 60
23+
concurrency:
24+
group: mac-ios-port-${{ github.workflow }}-${{ github.ref_name }}
25+
cancel-in-progress: true
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Cache CocoaPods and user gems
30+
uses: actions/cache@v4
31+
with:
32+
path: |
33+
~/.gem
34+
~/Library/Caches/CocoaPods
35+
~/.cocoapods/repos
36+
key: ${{ runner.os }}-pods-v1-${{ hashFiles('scripts/setup-workspace.sh') }}
37+
restore-keys: |
38+
${{ runner.os }}-pods-v1-
39+
40+
- name: Ensure CocoaPods tooling
41+
run: |
42+
mkdir -p ~/.codenameone
43+
cp maven/UpdateCodenameOne.jar ~/.codenameone/
44+
set -euo pipefail
45+
if ! command -v ruby >/dev/null; then
46+
echo "ruby not found"; exit 1
47+
fi
48+
GEM_USER_DIR="$(ruby -e 'print Gem.user_dir')"
49+
export PATH="$GEM_USER_DIR/bin:$PATH"
50+
if ! command -v pod >/dev/null 2>&1; then
51+
gem install cocoapods xcodeproj --no-document --user-install
52+
fi
53+
pod --version
54+
55+
- name: Compute setup-workspace hash
56+
id: setup_hash
57+
run: |
58+
set -euo pipefail
59+
echo "hash=$(shasum -a 256 scripts/setup-workspace.sh | awk '{print $1}')" >> "$GITHUB_OUTPUT"
60+
61+
- name: Compute CN1 source hash
62+
id: src_hash
63+
run: |
64+
set -euo pipefail
65+
SRC_HASH=$(find CodenameOne/src Ports/iOSPort vm/JavaAPI vm/ByteCodeTranslator Themes \
66+
-type f \( -name '*.java' -o -name '*.m' -o -name '*.h' -o -name '*.xml' -o -name '*.properties' -o -name '*.css' \) 2>/dev/null \
67+
| sort | xargs shasum -a 256 | shasum -a 256 | awk '{print $1}')
68+
POM_HASH=$(find . -name 'pom.xml' -not -path './scripts/*' 2>/dev/null \
69+
| sort | xargs shasum -a 256 | shasum -a 256 | awk '{print $1}')
70+
SCRIPT_HASH=$(shasum -a 256 \
71+
scripts/setup-workspace.sh \
72+
scripts/build-ios-port.sh \
73+
scripts/build-native-themes.sh \
74+
.github/workflows/_build-ios-port.yml \
75+
| shasum -a 256 | awk '{print $1}')
76+
echo "hash=${SRC_HASH:0:16}-${POM_HASH:0:16}-${SCRIPT_HASH:0:16}" >> "$GITHUB_OUTPUT"
77+
78+
- name: Set TMPDIR
79+
run: echo "TMPDIR=${{ runner.temp }}" >> $GITHUB_ENV
80+
81+
- name: Cache codenameone-tools
82+
uses: actions/cache@v4
83+
with:
84+
path: ${{ runner.temp }}/codenameone-tools
85+
key: ${{ runner.os }}-cn1-tools-${{ steps.setup_hash.outputs.hash }}
86+
restore-keys: |
87+
${{ runner.os }}-cn1-tools-
88+
89+
- name: Cache Maven repository
90+
uses: actions/cache@v4
91+
with:
92+
path: ~/.m2/repository
93+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
94+
restore-keys: |
95+
${{ runner.os }}-m2-
96+
97+
- name: Restore cn1-binaries cache
98+
uses: actions/cache@v4
99+
with:
100+
path: ../cn1-binaries
101+
key: cn1-binaries-${{ runner.os }}-${{ steps.setup_hash.outputs.hash }}
102+
restore-keys: |
103+
cn1-binaries-${{ runner.os }}-
104+
105+
# Built CN1 + iOS port artifacts. Restored after the m2 cache so it
106+
# overwrites any stale com/codenameone subtree pulled in by the broader
107+
# m2 cache (whose key is keyed on POMs, not source).
108+
- name: Cache built CN1 + iOS port artifacts
109+
id: cn1_built
110+
uses: actions/cache@v4
111+
with:
112+
path: |
113+
~/.m2/repository/com/codenameone
114+
Themes
115+
Ports/iOSPort/nativeSources
116+
key: cn1-built-${{ runner.os }}-${{ steps.src_hash.outputs.hash }}
117+
118+
- name: Setup workspace
119+
if: steps.cn1_built.outputs.cache-hit != 'true'
120+
run: ./scripts/setup-workspace.sh -q -DskipTests
121+
timeout-minutes: 40
122+
123+
- name: Build iOS port
124+
if: steps.cn1_built.outputs.cache-hit != 'true'
125+
run: ./scripts/build-ios-port.sh -q -DskipTests
126+
timeout-minutes: 40
127+
128+
- name: Report cache outcome
129+
run: |
130+
if [ "${{ steps.cn1_built.outputs.cache-hit }}" = "true" ]; then
131+
echo "cn1-built cache HIT for key cn1-built-${{ runner.os }}-${{ steps.src_hash.outputs.hash }} — setup-workspace and build-ios-port were skipped."
132+
else
133+
echo "cn1-built cache MISS for key cn1-built-${{ runner.os }}-${{ steps.src_hash.outputs.hash }} — built fresh."
134+
fi

.github/workflows/ios-packaging.yml

Lines changed: 47 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
pull_request:
55
paths:
66
- '.github/workflows/ios-packaging.yml'
7+
- '.github/workflows/_build-ios-port.yml'
78
- 'maven/codenameone-maven-plugin/**'
89
- 'vm/ByteCodeTranslator/**'
910
- 'Ports/iOSPort/**'
@@ -17,6 +18,7 @@ on:
1718
branches: [ master ]
1819
paths:
1920
- '.github/workflows/ios-packaging.yml'
21+
- '.github/workflows/_build-ios-port.yml'
2022
- 'maven/codenameone-maven-plugin/**'
2123
- 'vm/ByteCodeTranslator/**'
2224
- 'Ports/iOSPort/**'
@@ -28,30 +30,24 @@ on:
2830
- '!docs/**'
2931

3032
jobs:
31-
packaging-matrix:
33+
build-port:
34+
uses: ./.github/workflows/_build-ios-port.yml
35+
36+
packaging:
37+
needs: build-port
3238
permissions:
3339
contents: read
3440
runs-on: macos-15
35-
timeout-minutes: 75
36-
strategy:
37-
fail-fast: false
38-
matrix:
39-
packaging:
40-
- name: pods-only
41-
args: >-
42-
-Dcodename1.arg.ios.dependencyManager=cocoapods
43-
-Dcodename1.arg.ios.pods=AFNetworking
44-
- name: spm-only
45-
args: >-
46-
-Dcodename1.arg.ios.dependencyManager=spm
47-
-Dcodename1.arg.ios.spm.packages=swift-collections|https://github.com/apple/swift-collections.git|from:1.1.0
48-
-Dcodename1.arg.ios.spm.products.swift-collections=Collections
49-
- name: both
50-
args: >-
51-
-Dcodename1.arg.ios.dependencyManager=both
52-
-Dcodename1.arg.ios.pods=AFNetworking
53-
-Dcodename1.arg.ios.spm.packages=swift-collections|https://github.com/apple/swift-collections.git|from:1.1.0
54-
-Dcodename1.arg.ios.spm.products.swift-collections=Collections
41+
timeout-minutes: 45
42+
# Exercises both CocoaPods and SPM in a single Xcode project. Catches
43+
# regressions in either dependency manager (each pathway runs end to end)
44+
# and additionally validates that they coexist correctly.
45+
env:
46+
IOS_DEPENDENCY_ARGS: >-
47+
-Dcodename1.arg.ios.dependencyManager=both
48+
-Dcodename1.arg.ios.pods=AFNetworking
49+
-Dcodename1.arg.ios.spm.packages=swift-collections|https://github.com/apple/swift-collections.git|from:1.1.0
50+
-Dcodename1.arg.ios.spm.products.swift-collections=Collections
5551
5652
steps:
5753
- uses: actions/checkout@v4
@@ -83,9 +79,24 @@ jobs:
8379
id: setup_hash
8480
run: |
8581
set -euo pipefail
86-
SETUP_HASH=$(shasum -a 256 scripts/setup-workspace.sh | awk '{print $1}')
87-
IOS_PORT_HASH=$(find Ports/iOSPort/src -type f -name '*.java' | sort | xargs shasum -a 256 | shasum -a 256 | awk '{print $1}')
88-
echo "hash=${SETUP_HASH}-${IOS_PORT_HASH}" >> "$GITHUB_OUTPUT"
82+
echo "hash=$(shasum -a 256 scripts/setup-workspace.sh | awk '{print $1}')" >> "$GITHUB_OUTPUT"
83+
84+
- name: Compute CN1 source hash
85+
id: src_hash
86+
run: |
87+
set -euo pipefail
88+
SRC_HASH=$(find CodenameOne/src Ports/iOSPort vm/JavaAPI vm/ByteCodeTranslator Themes \
89+
-type f \( -name '*.java' -o -name '*.m' -o -name '*.h' -o -name '*.xml' -o -name '*.properties' -o -name '*.css' \) 2>/dev/null \
90+
| sort | xargs shasum -a 256 | shasum -a 256 | awk '{print $1}')
91+
POM_HASH=$(find . -name 'pom.xml' -not -path './scripts/*' 2>/dev/null \
92+
| sort | xargs shasum -a 256 | shasum -a 256 | awk '{print $1}')
93+
SCRIPT_HASH=$(shasum -a 256 \
94+
scripts/setup-workspace.sh \
95+
scripts/build-ios-port.sh \
96+
scripts/build-native-themes.sh \
97+
.github/workflows/_build-ios-port.yml \
98+
| shasum -a 256 | awk '{print $1}')
99+
echo "hash=${SRC_HASH:0:16}-${POM_HASH:0:16}-${SCRIPT_HASH:0:16}" >> "$GITHUB_OUTPUT"
89100
90101
- name: Set TMPDIR
91102
run: echo "TMPDIR=${{ runner.temp }}" >> $GITHUB_ENV
@@ -114,24 +125,24 @@ jobs:
114125
restore-keys: |
115126
cn1-binaries-${{ runner.os }}-
116127
117-
- name: Setup workspace
118-
run: ./scripts/setup-workspace.sh -q -DskipTests
119-
timeout-minutes: 40
120-
121-
- name: Build iOS port
122-
run: ./scripts/build-ios-port.sh -q -DskipTests
123-
timeout-minutes: 40
128+
- name: Restore built CN1 + iOS port artifacts
129+
uses: actions/cache/restore@v4
130+
with:
131+
path: |
132+
~/.m2/repository/com/codenameone
133+
Themes
134+
Ports/iOSPort/nativeSources
135+
key: cn1-built-${{ runner.os }}-${{ steps.src_hash.outputs.hash }}
136+
fail-on-cache-miss: true
124137

125138
- name: Build sample iOS app
126139
id: build_ios_app
127-
env:
128-
IOS_DEPENDENCY_ARGS: ${{ matrix.packaging.args }}
129140
run: ./scripts/build-ios-app.sh -q -DskipTests
130141
timeout-minutes: 30
131142

132143
- name: Run iOS UI smoke
133144
env:
134-
ARTIFACTS_DIR: ${{ github.workspace }}/artifacts/${{ matrix.packaging.name }}
145+
ARTIFACTS_DIR: ${{ github.workspace }}/artifacts/ios-packaging
135146
run: |
136147
set -euo pipefail
137148
mkdir -p "${ARTIFACTS_DIR}"
@@ -142,9 +153,8 @@ jobs:
142153
timeout-minutes: 30
143154

144155
- name: Run native iOS notification tests
145-
if: matrix.packaging.name == 'both'
146156
env:
147-
ARTIFACTS_DIR: ${{ github.workspace }}/artifacts/${{ matrix.packaging.name }}-native
157+
ARTIFACTS_DIR: ${{ github.workspace }}/artifacts/ios-packaging-native
148158
run: |
149159
set -euo pipefail
150160
mkdir -p "${ARTIFACTS_DIR}"
@@ -157,7 +167,7 @@ jobs:
157167
if: always()
158168
uses: actions/upload-artifact@v4
159169
with:
160-
name: ios-packaging-${{ matrix.packaging.name }}
170+
name: ios-packaging
161171
path: artifacts
162172
if-no-files-found: warn
163173
retention-days: 14

.github/workflows/parparvm-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: ParparVM Java Tests
33
on:
44
pull_request:
55
paths:
6+
- '.github/workflows/parparvm-tests.yml'
67
- 'vm/**'
78
- 'Ports/JavaScriptPort/**'
89
- '!vm/**/README.md'
@@ -11,6 +12,7 @@ on:
1112
push:
1213
branches: [ master, main ]
1314
paths:
15+
- '.github/workflows/parparvm-tests.yml'
1416
- 'vm/**'
1517
- 'Ports/JavaScriptPort/**'
1618
- '!vm/**/README.md'

.github/workflows/scripts-ios-native.yml

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
pull_request:
55
paths:
66
- '.github/workflows/scripts-ios-native.yml'
7+
- '.github/workflows/_build-ios-port.yml'
78
- 'scripts/setup-workspace.sh'
89
- 'scripts/build-ios-port.sh'
910
- 'scripts/build-ios-app.sh'
@@ -30,6 +31,7 @@ on:
3031
branches: [ master ]
3132
paths:
3233
- '.github/workflows/scripts-ios-native.yml'
34+
- '.github/workflows/_build-ios-port.yml'
3335
- 'scripts/setup-workspace.sh'
3436
- 'scripts/build-ios-port.sh'
3537
- 'scripts/build-ios-app.sh'
@@ -54,11 +56,15 @@ on:
5456
- '!maven/core-unittests/**'
5557

5658
jobs:
59+
build-port:
60+
uses: ./.github/workflows/_build-ios-port.yml
61+
5762
native-ios:
63+
needs: build-port
5864
permissions:
5965
contents: read
6066
runs-on: macos-15
61-
timeout-minutes: 65
67+
timeout-minutes: 45
6268
concurrency:
6369
group: mac-ci-${{ github.workflow }}-${{ github.ref_name }}
6470
cancel-in-progress: true
@@ -98,6 +104,23 @@ jobs:
98104
set -euo pipefail
99105
echo "hash=$(shasum -a 256 scripts/setup-workspace.sh | awk '{print $1}')" >> "$GITHUB_OUTPUT"
100106
107+
- name: Compute CN1 source hash
108+
id: src_hash
109+
run: |
110+
set -euo pipefail
111+
SRC_HASH=$(find CodenameOne/src Ports/iOSPort vm/JavaAPI vm/ByteCodeTranslator Themes \
112+
-type f \( -name '*.java' -o -name '*.m' -o -name '*.h' -o -name '*.xml' -o -name '*.properties' -o -name '*.css' \) 2>/dev/null \
113+
| sort | xargs shasum -a 256 | shasum -a 256 | awk '{print $1}')
114+
POM_HASH=$(find . -name 'pom.xml' -not -path './scripts/*' 2>/dev/null \
115+
| sort | xargs shasum -a 256 | shasum -a 256 | awk '{print $1}')
116+
SCRIPT_HASH=$(shasum -a 256 \
117+
scripts/setup-workspace.sh \
118+
scripts/build-ios-port.sh \
119+
scripts/build-native-themes.sh \
120+
.github/workflows/_build-ios-port.yml \
121+
| shasum -a 256 | awk '{print $1}')
122+
echo "hash=${SRC_HASH:0:16}-${POM_HASH:0:16}-${SCRIPT_HASH:0:16}" >> "$GITHUB_OUTPUT"
123+
101124
- name: Set TMPDIR
102125
run: echo "TMPDIR=${{ runner.temp }}" >> $GITHUB_ENV
103126

@@ -125,13 +148,15 @@ jobs:
125148
restore-keys: |
126149
cn1-binaries-${{ runner.os }}-
127150
128-
- name: Setup workspace
129-
run: ./scripts/setup-workspace.sh -q -DskipTests
130-
timeout-minutes: 40
131-
132-
- name: Build iOS port
133-
run: ./scripts/build-ios-port.sh -q -DskipTests
134-
timeout-minutes: 40
151+
- name: Restore built CN1 + iOS port artifacts
152+
uses: actions/cache/restore@v4
153+
with:
154+
path: |
155+
~/.m2/repository/com/codenameone
156+
Themes
157+
Ports/iOSPort/nativeSources
158+
key: cn1-built-${{ runner.os }}-${{ steps.src_hash.outputs.hash }}
159+
fail-on-cache-miss: true
135160

136161
- name: Build sample iOS app
137162
id: build_ios_app

0 commit comments

Comments
 (0)