Skip to content

Commit 9602e83

Browse files
authored
feat: update navigation sdk package versions (#53)
* feat: update navigation sdk package versions * chore: add format tests to ci and format codebase * chore: add .nvmrc file * ci: add separate build pipelines for LMFS and ODRD sample apps * fix: formatting in iOS example project files * fix: correct dependency syntax in podspec
1 parent 1122913 commit 9602e83

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+4319
-3159
lines changed

.github/actions/setup/action.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Setup
16+
description: Setup Node.js and install dependencies
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version-file: .nvmrc
25+
26+
- name: Cache dependencies
27+
id: yarn-cache
28+
uses: actions/cache@v3
29+
with:
30+
path: |
31+
**/node_modules
32+
.yarn/install-state.gz
33+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
34+
restore-keys: |
35+
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
36+
${{ runner.os }}-yarn-
37+
38+
- name: Install dependencies
39+
if: steps.yarn-cache.outputs.cache-hit != 'true'
40+
run: yarn install --immutable
41+
shell: bash

.github/workflows/ci.yml

Lines changed: 344 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,344 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: CI
16+
on:
17+
push:
18+
branches:
19+
- main
20+
pull_request:
21+
branches:
22+
- main
23+
workflow_call:
24+
25+
jobs:
26+
lint:
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 30
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Setup
34+
uses: ./.github/actions/setup
35+
36+
- name: Lint files
37+
run: yarn lint
38+
39+
- name: Typecheck files
40+
run: yarn test:types
41+
42+
check-objc-formatting:
43+
runs-on: ubuntu-latest
44+
timeout-minutes: 30
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v4
48+
49+
- name: Install clang-format
50+
run: sudo apt-get install clang-format
51+
52+
- name: Check Objective-C formatting
53+
run: ./scripts/format-objc.sh --check
54+
55+
check-java-formatting:
56+
runs-on: ubuntu-latest
57+
timeout-minutes: 30
58+
steps:
59+
- name: Checkout
60+
uses: actions/checkout@v4
61+
62+
- name: Install JDK
63+
uses: actions/setup-java@v3
64+
with:
65+
distribution: 'zulu'
66+
java-version: '17'
67+
java-package: 'jdk'
68+
69+
- name: Download google-java-format
70+
run: |
71+
GOOGLE_JAVA_FORMAT_VERSION=1.23.0
72+
GOOGLE_JAVA_FORMAT_URL=https://github.com/google/google-java-format/releases/download/v${GOOGLE_JAVA_FORMAT_VERSION}/google-java-format-${GOOGLE_JAVA_FORMAT_VERSION}-all-deps.jar
73+
mkdir -p $HOME/google-java-format
74+
curl -L -o $HOME/google-java-format/google-java-format.jar $GOOGLE_JAVA_FORMAT_URL
75+
76+
- name: Create google-java-format wrapper script
77+
run: |
78+
cat << 'EOF' > /usr/local/bin/google-java-format
79+
#!/bin/sh
80+
exec java -jar "$HOME/google-java-format/google-java-format.jar" "$@"
81+
EOF
82+
chmod +x /usr/local/bin/google-java-format
83+
84+
- name: Check Java formatting
85+
run: ./scripts/format-java.sh --check
86+
87+
test:
88+
runs-on: ubuntu-latest
89+
timeout-minutes: 30
90+
steps:
91+
- name: Placeholder Test Step
92+
run: echo "No tests to run yet" && true
93+
# TODO: build test orchestration for Android and iOS and run detox tests on both platforms.
94+
# - name: Checkout
95+
# uses: actions/checkout@v4
96+
97+
# - name: Setup
98+
# uses: ./.github/actions/setup
99+
100+
# - name: Run unit tests
101+
# run: yarn test --maxWorkers=2 --coverage
102+
103+
build-library:
104+
runs-on: ubuntu-latest
105+
timeout-minutes: 30
106+
steps:
107+
- name: Checkout
108+
uses: actions/checkout@v4
109+
110+
- name: Setup
111+
uses: ./.github/actions/setup
112+
113+
- name: Build package
114+
run: yarn prepare
115+
116+
build-android-lmfs:
117+
runs-on: ubuntu-latest
118+
timeout-minutes: 30
119+
env:
120+
TURBO_CACHE_DIR: .turbo/android
121+
steps:
122+
- name: Checkout
123+
uses: actions/checkout@v4
124+
125+
- name: Setup
126+
uses: ./.github/actions/setup
127+
128+
- name: Cache turborepo for Android
129+
uses: actions/cache@v3
130+
with:
131+
path: ${{ env.TURBO_CACHE_DIR }}
132+
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
133+
restore-keys: |
134+
${{ runner.os }}-turborepo-android-
135+
136+
- name: Check turborepo cache for Android
137+
run: |
138+
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android:lmfs --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android:lmfs').cache.status")
139+
140+
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
141+
echo "turbo_cache_hit=1" >> $GITHUB_ENV
142+
fi
143+
144+
- name: Install JDK
145+
if: env.turbo_cache_hit != 1
146+
uses: actions/setup-java@v3
147+
with:
148+
distribution: 'zulu'
149+
java-version: '17'
150+
java-package: 'jdk'
151+
152+
- name: Finalize Android SDK
153+
if: env.turbo_cache_hit != 1
154+
run: |
155+
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
156+
157+
- name: Cache Gradle
158+
if: env.turbo_cache_hit != 1
159+
uses: actions/cache@v3
160+
with:
161+
path: |
162+
~/.gradle/wrapper
163+
~/.gradle/caches
164+
key: ${{ runner.os }}-gradle-${{ hashFiles('example/LMFS/android/gradle/wrapper/gradle-wrapper.properties') }}
165+
restore-keys: |
166+
${{ runner.os }}-gradle-
167+
168+
- name: Build example for Android
169+
env:
170+
JAVA_OPTS: '-Xmx4g -XX:MaxMetaspaceSize=1g'
171+
run: |
172+
echo "MAPS_API_KEY=FAKE_API_KEY" > example/LMFS/android/local.properties
173+
yarn turbo run build:android:lmfs --cache-dir="${{ env.TURBO_CACHE_DIR }}"
174+
175+
build-android-odrd:
176+
runs-on: ubuntu-latest
177+
timeout-minutes: 30
178+
env:
179+
TURBO_CACHE_DIR: .turbo/android
180+
steps:
181+
- name: Checkout
182+
uses: actions/checkout@v4
183+
184+
- name: Setup
185+
uses: ./.github/actions/setup
186+
187+
- name: Cache turborepo for Android
188+
uses: actions/cache@v3
189+
with:
190+
path: ${{ env.TURBO_CACHE_DIR }}
191+
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
192+
restore-keys: |
193+
${{ runner.os }}-turborepo-android-
194+
195+
- name: Check turborepo cache for Android
196+
run: |
197+
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android:odrd --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android:odrd').cache.status")
198+
199+
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
200+
echo "turbo_cache_hit=1" >> $GITHUB_ENV
201+
fi
202+
203+
- name: Install JDK
204+
if: env.turbo_cache_hit != 1
205+
uses: actions/setup-java@v3
206+
with:
207+
distribution: 'zulu'
208+
java-version: '17'
209+
java-package: 'jdk'
210+
211+
- name: Finalize Android SDK
212+
if: env.turbo_cache_hit != 1
213+
run: |
214+
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
215+
216+
- name: Cache Gradle
217+
if: env.turbo_cache_hit != 1
218+
uses: actions/cache@v3
219+
with:
220+
path: |
221+
~/.gradle/wrapper
222+
~/.gradle/caches
223+
key: ${{ runner.os }}-gradle-${{ hashFiles('example/ODRD/android/gradle/wrapper/gradle-wrapper.properties') }}
224+
restore-keys: |
225+
${{ runner.os }}-gradle-
226+
227+
- name: Build example for Android
228+
env:
229+
JAVA_OPTS: '-Xmx4g -XX:MaxMetaspaceSize=1g'
230+
run: |
231+
echo "MAPS_API_KEY=FAKE_API_KEY" > example/ODRD/android/local.properties
232+
yarn turbo run build:android:odrd --cache-dir="${{ env.TURBO_CACHE_DIR }}"
233+
234+
build-ios-lmfs:
235+
runs-on: macos-14
236+
timeout-minutes: 45
237+
env:
238+
TURBO_CACHE_DIR: .turbo/ios
239+
steps:
240+
- name: Checkout
241+
uses: actions/checkout@v4
242+
243+
- name: Setup
244+
uses: ./.github/actions/setup
245+
246+
- name: Cache turborepo for iOS
247+
uses: actions/cache@v3
248+
with:
249+
path: ${{ env.TURBO_CACHE_DIR }}
250+
key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }}
251+
restore-keys: |
252+
${{ runner.os }}-turborepo-ios-
253+
254+
- name: Check turborepo cache for iOS
255+
run: |
256+
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios:lmfs --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios:lmfs').cache.status")
257+
258+
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
259+
echo "turbo_cache_hit=1" >> $GITHUB_ENV
260+
else
261+
echo "turbo_cache_hit=0" >> $GITHUB_ENV
262+
fi
263+
264+
- name: Cache cocoapods
265+
if: env.turbo_cache_hit != 1
266+
id: cocoapods-cache
267+
uses: actions/cache@v3
268+
with:
269+
path: |
270+
**/ios/Pods
271+
key: ${{ runner.os }}-cocoapods-${{ hashFiles('**/package.json') }}
272+
restore-keys: |
273+
${{ runner.os }}-cocoapods-
274+
275+
- name: Install cocoapods
276+
if: env.turbo_cache_hit != 1 || steps.cocoapods-cache.outputs.cache-hit != 'true'
277+
run: |
278+
cd example/LMFS/ios
279+
RCT_NEW_ARCH_ENABLED=0 pod install
280+
env:
281+
NO_FLIPPER: 1
282+
283+
- name: Copy Keys.plist file from sample
284+
run: cp example/LMFS/ios/SampleApp/Keys.plist.sample example/LMFS/ios/SampleApp/Keys.plist
285+
286+
- name: Build example for iOS
287+
run: |
288+
yarn turbo run build:ios:lmfs --cache-dir="${{ env.TURBO_CACHE_DIR }}"
289+
290+
build-ios-odrd:
291+
runs-on: macos-14
292+
timeout-minutes: 45
293+
env:
294+
TURBO_CACHE_DIR: .turbo/ios
295+
steps:
296+
- name: Checkout
297+
uses: actions/checkout@v4
298+
299+
- name: Setup
300+
uses: ./.github/actions/setup
301+
302+
- name: Cache turborepo for iOS
303+
uses: actions/cache@v3
304+
with:
305+
path: ${{ env.TURBO_CACHE_DIR }}
306+
key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }}
307+
restore-keys: |
308+
${{ runner.os }}-turborepo-ios-
309+
310+
- name: Check turborepo cache for iOS
311+
run: |
312+
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios:odrd --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios:odrd').cache.status")
313+
314+
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
315+
echo "turbo_cache_hit=1" >> $GITHUB_ENV
316+
else
317+
echo "turbo_cache_hit=0" >> $GITHUB_ENV
318+
fi
319+
320+
- name: Cache cocoapods
321+
if: env.turbo_cache_hit != 1
322+
id: cocoapods-cache
323+
uses: actions/cache@v3
324+
with:
325+
path: |
326+
**/ios/Pods
327+
key: ${{ runner.os }}-cocoapods-${{ hashFiles('**/package.json') }}
328+
restore-keys: |
329+
${{ runner.os }}-cocoapods-
330+
331+
- name: Install cocoapods
332+
if: env.turbo_cache_hit != 1 || steps.cocoapods-cache.outputs.cache-hit != 'true'
333+
run: |
334+
cd example/ODRD/ios
335+
RCT_NEW_ARCH_ENABLED=0 pod install
336+
env:
337+
NO_FLIPPER: 1
338+
339+
- name: Copy Keys.plist file from sample
340+
run: cp example/ODRD/ios/SampleApp/Keys.plist.sample example/ODRD/ios/SampleApp/Keys.plist
341+
342+
- name: Build example for iOS
343+
run: |
344+
yarn turbo run build:ios:odrd --cache-dir="${{ env.TURBO_CACHE_DIR }}"

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v18

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ This project follows
2929
- [git](https://git-scm.com) (used for source version control).
3030
- An IDE such as [Android Studio](https://developer.android.com/studio) or [Visual Studio Code](https://code.visualstudio.com/).
3131
- [addlicense](https://github.com/google/addlicense)
32+
- [google-java-format Version 1.23.0](https://github.com/google/google-java-format) (used to format Java code).
33+
- [clang-format](https://clang.llvm.org/docs/ClangFormat.html) (used to format Objective-C code).
3234

3335
## 2. Forking & cloning the repository
3436

0 commit comments

Comments
 (0)