Skip to content

Commit

Permalink
Testing for both android and ios, disabled CI
Browse files Browse the repository at this point in the history
  • Loading branch information
stalgiag committed Jan 7, 2025
1 parent bb7cad6 commit 593bbed
Show file tree
Hide file tree
Showing 13 changed files with 226 additions and 181 deletions.
47 changes: 45 additions & 2 deletions .github/workflows/android-build.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,45 @@
# TODO: Re-enable this workflow
# Disabled to save on CI credits
name: Android Build & Render Test

on:
push:

jobs:
build:
# TODO: Re-enable once there are more run minutes available
if: false
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Install Android build tools and platform
run: |
sdkmanager --install "build-tools;33.0.0" "platforms;android-33" "ndk;25.1.8937393"
- name: Install dependencies
run: |
npm install -g yarn
yarn install
- name: Install Maestro
run: |
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "$HOME/.maestro/bin" >> $GITHUB_PATH
- name: Run Android Build and Tests
run: bash tests/test-android.sh
53 changes: 11 additions & 42 deletions .github/workflows/ios-build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: iOS Build and Test
name: iOS Build and Render Test

on:
push:

jobs:
build:
# TODO: Re-enable once there are more run minutes available
if: false
runs-on: macos-latest
steps:
- name: Checkout repository
Expand All @@ -16,51 +18,18 @@ jobs:
node-version: 18
cache: 'yarn'

- name: Install Yarn
run: npm install -g yarn

- name: Install dependencies
run: yarn install
run: |
npm install -g yarn
yarn install
- name: Install Maestro
run: |
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "$HOME/.maestro/bin" >> $GITHUB_PATH
- name: Build iOS app
run: |
yarn expo prebuild --platform ios --clean
cd ios
pod install
cd ..
yarn generate-test-data
cd ios
SDK_VERSION=$(xcodebuild -showsdks | grep 'Simulator - iOS' | grep -o 'iphonesimulator[0-9.]*' | head -1)
OS_VERSION=$(echo $SDK_VERSION | grep -o '[0-9.]*')
xcodebuild -workspace pinpadclientmaplibre.xcworkspace \
-scheme pinpadclientmaplibre \
-configuration Debug \
-sdk $SDK_VERSION \
-destination "platform=iOS Simulator,OS=$OS_VERSION,name=iPhone 15" \
-derivedDataPath build \
build
- name: Run Tests
run: |
# Boot the simulator
SIMULATOR_UDID=$(xcrun simctl create "iPhone 15" "iPhone 15" "iOS$OS_VERSION")
xcrun simctl boot "$SIMULATOR_UDID"
# Install the app
xcrun simctl install "$SIMULATOR_UDID" "ios/build/Build/Products/Debug-iphonesimulator/pinpadclientmaplibre.app"
# Start Expo server and run tests
yarn expo start &
sleep 15
maestro test tests/*.yaml
# Clean up
xcrun simctl shutdown "$SIMULATOR_UDID"
xcrun simctl delete "$SIMULATOR_UDID"
- name: Run iOS Build and Tests
env:
# According to the official GH Runner images repo, this simulator is available on this runner
SIMULATOR_DEVICE: "iPhone 15"
run: bash tests/test-ios.sh
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ yarn-error.*
*.tsbuildinfo

app-example

# Assets
assets/test.drift
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ To run the tests, you can use the following commands:

```
yarn test:maestro:ios
yarn test:maestro:android
```

This will boot the simulator and run the tests. Currently, iPhone XR is used. You can change this in the `package.json` file if you want to use a different simulator.
This will boot the simulator and run the tests. Currently, iPhone XR is used by default. You can change this in the shell script file if you want to use a different simulator.


2 changes: 0 additions & 2 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
app/src/main/assets/test.drift

# OSX
#
.DS_Store
Expand Down
6 changes: 2 additions & 4 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.anonymous.pinpadclientmaplibre">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.VIBRATE"/>
Expand All @@ -13,7 +11,7 @@
<data android:scheme="https"/>
</intent>
</queries>
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:supportsRtl="true" android:usesCleartextTraffic="true">
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:supportsRtl="true">
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
Expand Down
Binary file removed assets/test.drift
Binary file not shown.
2 changes: 0 additions & 2 deletions ios/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
test.drift

# OSX
#
.DS_Store
Expand Down
Loading

0 comments on commit 593bbed

Please sign in to comment.