-
Notifications
You must be signed in to change notification settings - Fork 434
184 lines (167 loc) · 6.67 KB
/
ios-packaging.yml
File metadata and controls
184 lines (167 loc) · 6.67 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: Test iOS packaging
on:
pull_request:
paths:
- '.github/workflows/ios-packaging.yml'
- '.github/workflows/_build-ios-port.yml'
- 'maven/codenameone-maven-plugin/**'
- 'vm/ByteCodeTranslator/**'
- 'Ports/iOSPort/**'
- 'scripts/build-ios-app.sh'
- 'scripts/run-ios-ui-tests.sh'
- 'scripts/run-ios-native-tests.sh'
- 'scripts/ios/**'
- 'scripts/hellocodenameone/**'
- '!docs/**'
push:
branches: [ master ]
paths:
- '.github/workflows/ios-packaging.yml'
- '.github/workflows/_build-ios-port.yml'
- 'maven/codenameone-maven-plugin/**'
- 'vm/ByteCodeTranslator/**'
- 'Ports/iOSPort/**'
- 'scripts/build-ios-app.sh'
- 'scripts/run-ios-ui-tests.sh'
- 'scripts/run-ios-native-tests.sh'
- 'scripts/ios/**'
- 'scripts/hellocodenameone/**'
- '!docs/**'
jobs:
build-port:
uses: ./.github/workflows/_build-ios-port.yml
packaging:
needs: build-port
permissions:
contents: read
runs-on: macos-15
timeout-minutes: 45
# Exercises both CocoaPods and SPM in a single Xcode project. Catches
# regressions in either dependency manager (each pathway runs end to end)
# and additionally validates that they coexist correctly. Also turns on
# Google sign-in so GoogleConnectImpl.m is compiled under Xcode -- catches
# signature drift between hand-written iOS port .m files and the
# ParparVM-generated `set_field_*` headers, which is otherwise invisible
# until a customer enables Google sign-in.
env:
IOS_DEPENDENCY_ARGS: >-
-Dcodename1.arg.ios.dependencyManager=both
-Dcodename1.arg.ios.pods=AFNetworking
-Dcodename1.arg.ios.spm.packages=swift-collections|https://github.com/apple/swift-collections.git|from:1.1.0
-Dcodename1.arg.ios.spm.products.swift-collections=Collections
-Dcodename1.arg.ios.gplus.clientId=000000000000-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.apps.googleusercontent.com
steps:
- uses: actions/checkout@v4
- name: Cache CocoaPods and user gems
uses: actions/cache@v4
with:
path: |
~/.gem
~/Library/Caches/CocoaPods
~/.cocoapods/repos
key: ${{ runner.os }}-pods-v1-${{ hashFiles('scripts/setup-workspace.sh') }}
restore-keys: |
${{ runner.os }}-pods-v1-
- name: Ensure CocoaPods tooling
run: |
mkdir -p ~/.codenameone
cp maven/UpdateCodenameOne.jar ~/.codenameone/
set -euo pipefail
GEM_USER_DIR="$(ruby -e 'print Gem.user_dir')"
export PATH="$GEM_USER_DIR/bin:$PATH"
if ! command -v pod >/dev/null 2>&1; then
gem install cocoapods xcodeproj --no-document --user-install
fi
pod --version
- name: Compute setup-workspace hash
id: setup_hash
run: |
set -euo pipefail
echo "hash=$(shasum -a 256 scripts/setup-workspace.sh | awk '{print $1}')" >> "$GITHUB_OUTPUT"
- name: Compute CN1 source hash
id: src_hash
run: |
set -euo pipefail
SRC_HASH=$(find CodenameOne/src Ports/iOSPort vm/JavaAPI vm/ByteCodeTranslator Themes native-themes \
maven/codenameone-maven-plugin/src/main \
-type f \( -name '*.java' -o -name '*.m' -o -name '*.h' -o -name '*.xml' -o -name '*.properties' -o -name '*.css' \) 2>/dev/null \
| sort | xargs shasum -a 256 | shasum -a 256 | awk '{print $1}')
POM_HASH=$(find . -name 'pom.xml' -not -path './scripts/*' 2>/dev/null \
| sort | xargs shasum -a 256 | shasum -a 256 | awk '{print $1}')
SCRIPT_HASH=$(shasum -a 256 \
scripts/setup-workspace.sh \
scripts/build-ios-port.sh \
scripts/build-native-themes.sh \
.github/workflows/_build-ios-port.yml \
| shasum -a 256 | awk '{print $1}')
echo "hash=${SRC_HASH:0:16}-${POM_HASH:0:16}-${SCRIPT_HASH:0:16}" >> "$GITHUB_OUTPUT"
- name: Set TMPDIR
run: echo "TMPDIR=${{ runner.temp }}" >> $GITHUB_ENV
- name: Cache codenameone-tools
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/codenameone-tools
key: ${{ runner.os }}-cn1-tools-${{ steps.setup_hash.outputs.hash }}
restore-keys: |
${{ runner.os }}-cn1-tools-
- name: Cache Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-
- name: Restore cn1-binaries cache
uses: actions/cache@v4
with:
path: ../cn1-binaries
key: cn1-binaries-${{ runner.os }}-${{ steps.setup_hash.outputs.hash }}
restore-keys: |
cn1-binaries-${{ runner.os }}-
- name: Restore built CN1 + iOS port artifacts
# Use the exact key build-port saved against (published as a job
# output). Recomputing src_hash locally drifts whenever new
# source paths are added to the build-port hash without
# mirroring the change here, causing fail-on-cache-miss to
# blow up the entire packaging suite.
uses: actions/cache/restore@v4
with:
path: |
~/.m2/repository/com/codenameone
Themes
Ports/iOSPort/nativeSources
key: ${{ needs.build-port.outputs.cn1_built_cache_key }}
fail-on-cache-miss: true
- name: Build sample iOS app
id: build_ios_app
run: ./scripts/build-ios-app.sh -q -DskipTests
timeout-minutes: 30
- name: Run iOS UI smoke
env:
ARTIFACTS_DIR: ${{ github.workspace }}/artifacts/ios-packaging
run: |
set -euo pipefail
mkdir -p "${ARTIFACTS_DIR}"
./scripts/run-ios-ui-tests.sh \
"${{ steps.build_ios_app.outputs.workspace }}" \
"" \
"${{ steps.build_ios_app.outputs.scheme }}"
timeout-minutes: 30
- name: Run native iOS notification tests
env:
ARTIFACTS_DIR: ${{ github.workspace }}/artifacts/ios-packaging-native
run: |
set -euo pipefail
mkdir -p "${ARTIFACTS_DIR}"
./scripts/run-ios-native-tests.sh \
"${{ steps.build_ios_app.outputs.workspace }}" \
"${{ steps.build_ios_app.outputs.scheme }}"
timeout-minutes: 20
- name: Upload packaging artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: ios-packaging
path: artifacts
if-no-files-found: warn
retention-days: 14