add LCR ios build #5672
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/natario1/CameraView/blob/master/.github/workflows/build.yml | |
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions | |
# https://dev.to/edvinasbartkus/running-react-native-detox-tests-for-ios-and-android-on-github-actions-2ekn | |
# https://github.com/wix/Detox/issues/2617 | |
name: Build | |
on: [push, pull_request] | |
jobs: | |
IOS_SIMULATOR_TESTS: | |
# https://github.community/t/how-to-stop-github-actions-workflow-to-trigger-when-the-pull-request-is-from-dependabot-preview/116486 | |
# if: github.actor != 'dependabot[bot]' | |
if: false | |
name: iOS Simulator Tests | |
runs-on: macOS-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
- name: Configure Sentry | |
run: | | |
sed 's/%token%/${{ secrets.SENTRY_API_TOKEN }}/' ios/sentry.properties.dist > ios/sentry.properties | |
# https://github.com/actions/cache/blob/main/examples.md#node---yarn | |
- name: Get Yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Cache Yarn | |
uses: actions/cache@v2 | |
id: cache-yarn | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn install | |
- name: Install applesimutils | |
run: | | |
brew tap wix/brew | |
brew install applesimutils | |
- name: Configure Firebase | |
run: | | |
brew install xmlstarlet | |
cp GoogleService-Info.plist.dist ios/GoogleService-Info.plist | |
xmlstarlet ed --inplace --ps --update '//key[text()="CLIENT_ID"]/following-sibling::string[1]' -v '${{ secrets.FIREBASE_CLIENT_ID }}' ios/GoogleService-Info.plist | |
xmlstarlet ed --inplace --ps --update '//key[text()="REVERSED_CLIENT_ID"]/following-sibling::string[1]' -v '${{ secrets.FIREBASE_REVERSED_CLIENT_ID }}' ios/GoogleService-Info.plist | |
xmlstarlet ed --inplace --ps --update '//key[text()="API_KEY"]/following-sibling::string[1]' -v '${{ secrets.FIREBASE_API_KEY }}' ios/GoogleService-Info.plist | |
xmlstarlet ed --inplace --ps --update '//key[text()="GCM_SENDER_ID"]/following-sibling::string[1]' -v '${{ secrets.FIREBASE_GCM_SENDER_ID }}' ios/GoogleService-Info.plist | |
xmlstarlet ed --inplace --ps --update '//key[text()="PROJECT_ID"]/following-sibling::string[1]' -v '${{ secrets.FIREBASE_PROJECT_ID }}' ios/GoogleService-Info.plist | |
xmlstarlet ed --inplace --ps --update '//key[text()="STORAGE_BUCKET"]/following-sibling::string[1]' -v '${{ secrets.FIREBASE_STORAGE_BUCKET }}' ios/GoogleService-Info.plist | |
xmlstarlet ed --inplace --ps --update '//key[text()="GOOGLE_APP_ID"]/following-sibling::string[1]' -v '${{ secrets.FIREBASE_GOOGLE_APP_ID }}' ios/GoogleService-Info.plist | |
xmlstarlet ed --inplace --ps --update '//key[text()="DATABASE_URL"]/following-sibling::string[1]' -v '${{ secrets.FIREBASE_DATABASE_URL }}' ios/GoogleService-Info.plist | |
- name: Install CocoaPods plugins | |
run: gem install cocoapods-user-defined-build-types | |
- name: Cache Pods | |
uses: actions/cache@v2 | |
id: cache-pods | |
with: | |
path: ios/Pods | |
key: pods-${{ hashFiles('**/Podfile.lock') }} | |
- run: cd ios/ && pod install --repo-update && cd .. | |
- run: | | |
cp .env.dist .env | |
sed -i '' -e 's/GOOGLE_MAPS_BROWSER_KEY=/GOOGLE_MAPS_BROWSER_KEY=${{ secrets.GOOGLE_MAPS_BROWSER_KEY }}/' .env | |
sed -i '' -e 's/GOOGLE_MAPS_ANDROID_KEY=/GOOGLE_MAPS_ANDROID_KEY=${{ secrets.GOOGLE_MAPS_ANDROID_KEY }}/' .env | |
# https://vojtastavik.com/2018/09/02/what-is-inside-derived-data-xcode/ | |
# https://discuss.circleci.com/t/sharing-xcode-derived-data-folder-across-jobs-workflows/31363/5 | |
# https://medium.com/@bitrise/60-faster-builds-force-xcode-to-use-caching-on-bitrise-af8979ca39a6 | |
- name: Cache XCode derived data | |
uses: actions/cache@v2 | |
id: cache-xcode-derived-data | |
with: | |
path: ios/build | |
key: xcode-derived-data-${{ hashFiles('**/Podfile.lock') }} | |
- name: Build app for Detox | |
run: node node_modules/.bin/detox build -c ios.sim.release | |
- name: Run Detox tests | |
run: node node_modules/.bin/detox test -c ios.sim.release --loglevel="trace" --device-name="iPhone 11" --debug-synchronization 500 | |
# Run 'applesimutils --list' to list your supported devices. | |
# It is advised only to specify a device type, e.g., "iPhone Xʀ" and avoid explicit search by OS version. | |
- name: List supported devices | |
run: applesimutils --list | |
# See screenshot specifications | |
# https://help.apple.com/app-store-connect/#/devd274dd925 | |
- name: Take screenshots | |
if: github.ref == 'refs/heads/master' | |
run: | | |
node node_modules/.bin/detox test -c ios.sim.release -o e2e/screenshots.config.json --take-screenshots manual --cleanup --device-name="iPhone 11" --artifacts-location ./artifacts/6.5-inch | |
node node_modules/.bin/detox test -c ios.sim.release -o e2e/screenshots.config.json --take-screenshots manual --cleanup --device-name="iPhone 8 Plus" --artifacts-location ./artifacts/5.5-inch | |
node node_modules/.bin/detox test -c ios.sim.release -o e2e/screenshots.config.json --take-screenshots manual --cleanup --device-name="iPad Pro (12.9-inch) (4th generation)" --artifacts-location ./artifacts/12.9-inch | |
- name: Upload screenshots artifacts | |
if: github.ref == 'refs/heads/master' | |
uses: actions/upload-artifact@v1 | |
with: | |
name: detox-screenshots-ios | |
path: artifacts | |
ANDROID_EMULATOR_TESTS: | |
if: false | |
name: Android Emulator Tests | |
runs-on: macOS-latest | |
strategy: | |
matrix: | |
EMULATOR_API: [28] | |
EMULATOR_ARCH: [x86_64] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
- run: yarn install | |
- run: cp google-services.json.dist android/app/google-services.json | |
- name: Enable clear text traffic in release builds | |
run: | | |
brew install xmlstarlet | |
xmlstarlet ed --inplace --ps --insert "/manifest/application" --type attr -n "android:usesCleartextTraffic" -v "true" android/app/src/main/AndroidManifest.xml | |
- run: cp .env.dist .env | |
- run: node node_modules/.bin/detox build -c android.emu.release | |
env: | |
googleMapsApiKey: ${{ secrets.googleMapsApiKey }} | |
- name: Execute emulator tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.EMULATOR_API }} | |
target: google_apis | |
arch: ${{ matrix.EMULATOR_ARCH }} | |
profile: Nexus 6 | |
# https://github.com/wix/Detox/blob/master/docs/Introduction.AndroidEmulatorsBestPractices.md#booting-an-emulator-via-command-line | |
emulator-options: -verbose -no-window -no-snapshot -noaudio -no-boot-anim -gpu swiftshader_indirect -camera-back emulated -camera-front emulated | |
disable-animations: true | |
script: | | |
bash -c "echo 'hw.lcd.height=2560' >> /Users/runner/.android/avd/test.avd/config.ini" | |
bash -c "echo 'hw.lcd.width=1440' >> /Users/runner/.android/avd/test.avd/config.ini" | |
node node_modules/.bin/detox test -c android.att.release --device-name="emulator-5554" --take-screenshots all --loglevel trace | |
node node_modules/.bin/detox test -c android.att.release --device-name="emulator-5554" --take-screenshots manual -o e2e/screenshots.config.json --loglevel trace | |
- name: Upload screenshots artifacts | |
if: github.ref == 'refs/heads/master' | |
uses: actions/upload-artifact@v1 | |
with: | |
name: detox-screenshots-android | |
path: artifacts |