[Testing] CQ-CQ-699775-59223-59338-znqlk #11299
This file contains hidden or 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
| name: ci | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - CQ-* | |
| defaults: | |
| run: | |
| working-directory: lynx | |
| jobs: | |
| static-check: | |
| runs-on: lynx-ubuntu-22.04-medium | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Python Setup | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Download Source | |
| uses: actions/[email protected] | |
| with: | |
| fetch-depth: 2 | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| path: lynx | |
| - name: Install Common Dependencies | |
| uses: ./lynx/.github/actions/common-deps | |
| - name: Run file type check | |
| run: | | |
| source tools/envsetup.sh | |
| python3 tools_shared/git_lynx.py check --checkers file-type | |
| - name: Run cpplint check | |
| run: | | |
| source tools/envsetup.sh | |
| python3 tools_shared/git_lynx.py check --checkers cpplint | |
| - name: Run java-lint check | |
| run: | | |
| source tools/envsetup.sh | |
| python3 tools_shared/git_lynx.py check --checkers java-lint | |
| - name: Run commit-message check | |
| run: | | |
| source tools/envsetup.sh | |
| python3 tools_shared/git_lynx.py check --checkers commit-message | |
| - name: Run coding-style check | |
| run: | | |
| source tools/envsetup.sh | |
| python3 tools_shared/git_lynx.py check --checkers coding-style | |
| - name: Run android-check-style check | |
| run: | | |
| source tools/envsetup.sh | |
| python3 tools_shared/git_lynx.py check --checkers android-check-style | |
| - name: Run api check | |
| run: | | |
| source tools/envsetup.sh | |
| python3 tools_shared/git_lynx.py check --checkers api-check --all | |
| - name: Run gn relative path check | |
| run: | | |
| source tools/envsetup.sh | |
| python3 tools/gn_tools/gn_relative_path_checker.py | |
| darwin-native-unittests-check: | |
| timeout-minutes: 60 | |
| runs-on: lynx-darwin-14-medium | |
| steps: | |
| - name: Download Source | |
| uses: actions/[email protected] | |
| with: | |
| path: lynx | |
| - name: Install Common Dependencies | |
| uses: ./lynx/.github/actions/common-deps | |
| - name: Run Unittests | |
| run: | | |
| set -e | |
| source tools/envsetup.sh | |
| tools/rtf/rtf native-ut run --names lynx | |
| linux-native-unittests-check: | |
| runs-on: lynx-ubuntu-22.04-large | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Download Source | |
| uses: actions/[email protected] | |
| with: | |
| path: lynx | |
| - name: Python Setup | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install Common Dependencies | |
| uses: ./lynx/.github/actions/common-deps | |
| - name: Run Unittests | |
| run: | | |
| set -e | |
| source tools/envsetup.sh | |
| tools/rtf/rtf native-ut run --names lynx | |
| linux-native-devtool-unittests-check: | |
| runs-on: lynx-ubuntu-22.04-large | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Download Source | |
| uses: actions/[email protected] | |
| with: | |
| path: lynx | |
| - name: Python Setup | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install Common Dependencies | |
| uses: ./lynx/.github/actions/common-deps | |
| - name: Run Unittests | |
| run: | | |
| set -e | |
| source tools/envsetup.sh | |
| tools/rtf/rtf native-ut run --names devtool | |
| ios-unittests-check: | |
| timeout-minutes: 60 | |
| runs-on: lynx-darwin-14-medium | |
| steps: | |
| - name: Download Source | |
| uses: actions/[email protected] | |
| with: | |
| path: lynx | |
| - name: Install Common Dependencies | |
| uses: ./lynx/.github/actions/common-deps | |
| - name: Setup Ruby Cache | |
| uses: ./lynx/.github/actions/ios-common-deps | |
| - name: Install iOS Dependencies | |
| uses: nick-fields/retry@v2 | |
| with: | |
| timeout_minutes: 20 | |
| max_attempts: 3 | |
| command: | | |
| set -e | |
| cd $GITHUB_WORKSPACE/lynx | |
| source tools/envsetup.sh | |
| pushd explorer/darwin/ios/lynx_explorer | |
| git config --global url."https://github.com/".insteadOf "[email protected]:" | |
| bash bundle_install.sh --skip-card-build | |
| popd | |
| - name: Run Unittests | |
| run: | | |
| set -e | |
| source tools/envsetup.sh | |
| pushd explorer/darwin/ios/lynx_explorer | |
| xcodebuild -showsdks | grep -Eo -m 1 "iphonesimulator([0-9]{1,}\.)+[0-9]{1,}" > sdk.txt | |
| sdkVersion=$(awk '{ sub(/iphonesimulator/,""); print $0 }' sdk.txt) | |
| echo $sdkVersion > sdk.txt | |
| xcodebuild build-for-testing ARCHS=arm64 -workspace LynxExplorer.xcworkspace -scheme LynxExplorerTests -enableCodeCoverage YES -configuration Debug -sdk iphonesimulator$(cat sdk.txt) COMPILER_INDEX_STORE_ENABLE=NO -derivedDataPath iOSCoreBuild/DerivedData -dest"platform=iOS Simulator,OS=$(cat sdk.txt),name=iPhone 11" SYMROOT=`pwd`/Build/Products -testPlan UTTest | |
| chmod u+x xctestrunner | |
| ./xctestrunner --xctestrun `pwd`/Build/Products/LynxExplorerTests_UTTest_iphonesimulator$(cat sdk.txt)-arm64.xctestrun --work_dir `pwd` --output_dir `pwd`/iOSCoreBuild/DerivedData simulator_test | |
| popd | |
| tasm-linux-build: | |
| runs-on: lynx-ubuntu-22.04-large | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Download Source | |
| uses: actions/[email protected] | |
| with: | |
| path: lynx | |
| - name: Python Setup | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install Common Dependencies | |
| uses: ./lynx/.github/actions/common-deps | |
| - name: Build Linux Tasm | |
| run: | | |
| source tools/envsetup.sh | |
| pushd oliver/lynx-tasm | |
| npm install | |
| npm run build:release:linux | |
| popd | |
| tasm-darwin-build: | |
| timeout-minutes: 60 | |
| runs-on: lynx-darwin-14-medium | |
| steps: | |
| - name: Download Source | |
| uses: actions/[email protected] | |
| with: | |
| path: lynx | |
| - name: Install Common Dependencies | |
| uses: ./lynx/.github/actions/common-deps | |
| - name: Build Darwin Tasm | |
| run: | | |
| source tools/envsetup.sh | |
| python3 tools/oliver/lynx-tasm/gn_to_cmake_oliver.py | |
| pushd oliver/lynx-tasm | |
| npm install | |
| ../../buildtools/cmake/bin/cmake . | |
| ../../buildtools/cmake/bin/cmake --build . | |
| ./lepus_cmd | |
| npm run build:release:darwin | |
| popd | |
| tasm-wasm-build: | |
| timeout-minutes: 60 | |
| runs-on: lynx-darwin-14-medium | |
| steps: | |
| - name: Download Source | |
| uses: actions/[email protected] | |
| with: | |
| path: lynx | |
| - name: Install Common Dependencies | |
| uses: ./lynx/.github/actions/common-deps | |
| with: | |
| target: tasm | |
| - name: Build Wasm Tasm | |
| run: | | |
| source tools/envsetup.sh | |
| pushd oliver/lynx-tasm | |
| npm install | |
| npm run build:wasm | |
| popd | |
| lynx-types-check: | |
| runs-on: lynx-ubuntu-22.04-medium | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Download Source | |
| uses: actions/[email protected] | |
| with: | |
| path: lynx | |
| - name: Python Setup | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install Common Dependencies | |
| uses: ./lynx/.github/actions/common-deps | |
| - name: Lynx Types Check | |
| run: | | |
| cd $GITHUB_WORKSPACE/lynx | |
| source tools/envsetup.sh | |
| pushd js_libraries/types | |
| npm run test | |
| popd | |
| android-unittests-check: | |
| timeout-minutes: 60 | |
| runs-on: lynx-ubuntu-22.04-physical-medium | |
| steps: | |
| - name: Download Source | |
| uses: actions/[email protected] | |
| with: | |
| path: lynx | |
| - name: Python Setup | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install Common Dependencies | |
| uses: ./lynx/.github/actions/common-deps | |
| - name: Setup gradle cache | |
| uses: lynx-infra/cache@5c6160a6a4c7fca80a2f3057bb9dfc9513fcb732 | |
| with: | |
| path: ~/.gradle/caches/modules-2 | |
| key: gradle-android-unittests-check | |
| - name: Build Example App | |
| run: | | |
| source tools/envsetup.sh | |
| tools/rtf/rtf android-ut run --name lynx | |
| android-explorer-build: | |
| runs-on: lynx-ubuntu-22.04-large | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Download Source | |
| uses: actions/[email protected] | |
| with: | |
| path: lynx | |
| - name: Setup gradle cache | |
| uses: lynx-infra/cache@5c6160a6a4c7fca80a2f3057bb9dfc9513fcb732 | |
| with: | |
| path: ~/.gradle/caches/modules-2 | |
| key: gradle-android-explorer-build | |
| - name: Build Explorer App | |
| uses: ./lynx/.github/actions/android-explorer-build | |
| with: | |
| abi-list: x86,arm64-v8a | |
| build-params: -PIntegrationTest | |
| android-sdk-release: | |
| timeout-minutes: 60 | |
| runs-on: lynx-ubuntu-22.04-large | |
| steps: | |
| - name: Download Source | |
| uses: actions/[email protected] | |
| with: | |
| path: lynx | |
| - name: Python Setup | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install Common Dependencies | |
| uses: ./lynx/.github/actions/common-deps | |
| with: | |
| cache-backend: 'lynx-infra' | |
| - name: Setup gradle cache | |
| uses: lynx-infra/cache@5c6160a6a4c7fca80a2f3057bb9dfc9513fcb732 | |
| with: | |
| path: ~/.gradle/caches/modules-2 | |
| key: gradle-android-sdk-release | |
| - name: Build Android SDK | |
| uses: ./lynx/.github/actions/android-sdk-release | |
| with: | |
| version: 0.0.1-alpha.1 | |
| - name: Collect and zip artifacts | |
| run: | | |
| cd $GITHUB_WORKSPACE/lynx/platform/android | |
| ./gradlew zipAllArtifacts | |
| - name: upload zip artifact | |
| uses: lynx-infra/upload-artifact@332ec52e99f7cbf1fbbdc9bcc09280d49147d092 | |
| continue-on-error: true | |
| with: | |
| name: android-sdk-release | |
| path: '${{ github.workspace }}/lynx/platform/android/build/artifacts-collection.zip' | |
| android-e2e-test: | |
| timeout-minutes: 60 | |
| needs: [android-explorer-build] | |
| env: | |
| APPIUM_TEST_SERVER_PORT: 4723 | |
| APPIUM_TEST_SERVER_HOST: 127.0.0.1 | |
| runs-on: lynx-ubuntu-22.04-physical-medium | |
| steps: | |
| - name: Download Source | |
| uses: actions/[email protected] | |
| with: | |
| path: lynx | |
| - name: Python Setup | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install Common Dependencies | |
| uses: ./lynx/.github/actions/common-deps | |
| - name: Install Appium | |
| run: | | |
| pushd $GITHUB_WORKSPACE/lynx | |
| source tools/envsetup.sh | |
| pnpm install [email protected] -w | |
| pnpm install [email protected] -w | |
| popd | |
| - name: Setup Java SDK | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: 17 | |
| distribution: 'zulu' | |
| - name: Start Android 28 emulator | |
| run: | | |
| set -x | |
| target_avd=$(emulator -list-avds | head -n 1) | |
| if [ -z "$target_avd" ]; then | |
| echo "No available emulator was found!" | |
| exit 1 | |
| fi | |
| export QT_QPA_PLATFORM=offscreen | |
| nohup $ANDROID_HOME/emulator/emulator -no-window -avd $target_avd -no-snapshot -no-audio -no-boot-anim & | |
| max_wait_time=300 | |
| start_time=$(date +%s) | |
| while true; do | |
| current_time=$(date +%s) | |
| elapsed_time=$((current_time - start_time)) | |
| if [ $elapsed_time -gt $max_wait_time ]; then | |
| echo "Emulator startup timed out." | |
| exit 1 | |
| fi | |
| $ANDROID_HOME/platform-tools/adb devices | |
| if $ANDROID_HOME/platform-tools/adb devices | grep -q "device$"; then | |
| echo "Emulator startup completed." | |
| break | |
| fi | |
| echo "Waiting for emulator to startup..." | |
| sleep 10 | |
| done | |
| $ANDROID_HOME/platform-tools/adb devices | |
| - name: Download Explorer APK | |
| uses: lynx-infra/download-artifact@79d9914484f933089c2840552cf439bac85debad | |
| with: | |
| name: android-lynx-explorer | |
| path: lynx/explorer/android/lynx_explorer/build_temp | |
| - name: Repack and Install Explorer App | |
| run: | | |
| pushd $GITHUB_WORKSPACE/lynx | |
| LATEST_VERSION=$(ls -1 "$ANDROID_HOME/build-tools" | sort -V | tail -n 1) | |
| target_dir=$(find ./node_modules/.pnpm -type d -name "appium-adb@*" | head -n 1) | |
| ESPRESSO_SIGN_KEYS_DIR="" | |
| if [ -n "$target_dir" ]; then | |
| ESPRESSO_SIGN_KEYS_DIR="$target_dir/node_modules/appium-adb/keys" | |
| else | |
| echo "node_modules/.pnpm/appium-adb is not founded!" | |
| exit 1 | |
| fi | |
| APK_PATH=${{ github.workspace }}/lynx/explorer/android/lynx_explorer/build_temp | |
| java -jar $ANDROID_HOME/build-tools/$LATEST_VERSION/lib/apksigner.jar sign --key $ESPRESSO_SIGN_KEYS_DIR/testkey.pk8 --cert $ESPRESSO_SIGN_KEYS_DIR/testkey.x509.pem --out $APK_PATH/LynxExplorer-noasan-release-signed.apk $APK_PATH/LynxExplorer-noasan-release.apk | |
| adb install $APK_PATH/LynxExplorer-noasan-release-signed.apk | |
| - name: Start Appium server | |
| run: | | |
| pushd $GITHUB_WORKSPACE/lynx | |
| source tools/envsetup.sh | |
| pushd node_modules/appium/node_modules/.bin | |
| ls | |
| nohup ./appium server \ | |
| --port=$APPIUM_TEST_SERVER_PORT \ | |
| --address=$APPIUM_TEST_SERVER_HOST \ | |
| --log-no-colors \ | |
| --log-timestamp \ | |
| 2>&1 > "$GITHUB_WORKSPACE/lynx/appium.log" & | |
| adb logcat > "$GITHUB_WORKSPACE/lynx/device.log" 2>&1 & | |
| popd | |
| popd | |
| - name: Check if Appium Server is running | |
| run: | | |
| max_attempts=10 | |
| attempt=0 | |
| while [ $attempt -lt $max_attempts ]; do | |
| if nc -z $APPIUM_TEST_SERVER_HOST $APPIUM_TEST_SERVER_PORT; then | |
| echo "Appium Server is running." | |
| break | |
| else | |
| attempt=$((attempt + 1)) | |
| echo "Attempt $attempt: Appium Server is not yet running. Retrying in 2 seconds..." | |
| sleep 2 | |
| fi | |
| done | |
| if [ $attempt -eq $max_attempts ]; then | |
| echo "Failed to start Appium Server." | |
| exit 1 | |
| fi | |
| - name: Run Android E2E Test | |
| uses: nick-fields/retry@v3 | |
| with: | |
| max_attempts: 2 | |
| retry_wait_seconds: 5 | |
| timeout_minutes: 20 | |
| command: | | |
| set -e | |
| source $GITHUB_WORKSPACE/lynx/tools/envsetup.sh | |
| pushd $GITHUB_WORKSPACE/lynx/testing/integration_test/test_script | |
| export server_port=$APPIUM_TEST_SERVER_PORT | |
| export platform=android | |
| python3 -m pip install -r requirements.txt | |
| python3 manage.py runtest android_test.core | |
| echo "TASK_STATUS=success" >> $GITHUB_OUTPUT | |
| id: run_test | |
| - name: Collect Lynx-E2E execution logs | |
| if: always() | |
| run: | | |
| TASK_STATUS="${{ steps.run_test.outputs.TASK_STATUS }}" | |
| if [ -n "$TASK_STATUS" ] && [ "$TASK_STATUS" = "success" ]; then | |
| echo "Test execution succeeded." | |
| else | |
| echo "Test execution failed, collecting logs..." | |
| pushd $GITHUB_WORKSPACE/lynx/testing/integration_test/test_script | |
| ls | grep -E "^lynx_e2e_devtools_.*\.log$" | xargs cat | |
| popd | |
| fi | |
| - name: Collect Appium Server logs | |
| if: always() | |
| run: | | |
| TASK_STATUS="${{ steps.run_test.outputs.TASK_STATUS }}" | |
| if [ -n "$TASK_STATUS" ] && [ "$TASK_STATUS" = "success" ]; then | |
| echo "Test execution succeeded." | |
| else | |
| echo "Test execution failed, collecting logs..." | |
| pushd $GITHUB_WORKSPACE/lynx/ | |
| if [ -f "appium.log" ]; then | |
| cat appium.log | |
| else | |
| echo "Warning: appium.log file not found" | |
| fi | |
| popd | |
| fi | |
| - name: Collect Generated Resource Files | |
| if: always() | |
| run: | | |
| TASK_STATUS="${{ steps.run_test.outputs.TASK_STATUS }}" | |
| if [ -n "$TASK_STATUS" ] && [ "$TASK_STATUS" = "success" ]; then | |
| echo "Test execution succeeded." | |
| else | |
| pushd $GITHUB_WORKSPACE/lynx/testing/integration_test/test_script | |
| if [ -d "screenshots" ]; then | |
| zip -r screenshots.zip ./screenshots/ | |
| echo "Successfully created screenshots.zip" | |
| echo "ZIP_RESOURCES=success" >> $GITHUB_OUTPUT | |
| else | |
| echo "Warning: screenshot directory not found" | |
| fi | |
| fi | |
| id: collect_resource | |
| - name: Upload Generated Resource Files | |
| if: always() && steps.collect_resource.outputs.ZIP_RESOURCES == 'success' | |
| uses: lynx-infra/upload-artifact@332ec52e99f7cbf1fbbdc9bcc09280d49147d092 | |
| continue-on-error: true | |
| with: | |
| name: android-e2e-resources | |
| path: '${{ github.workspace }}/lynx/testing/integration_test/test_script/screenshots.zip' | |
| android-integeration-test: | |
| needs: [android-sdk-release] | |
| timeout-minutes: 15 | |
| runs-on: lynx-ubuntu-22.04-large | |
| steps: | |
| - name: Download Integeration Demo Source Code | |
| uses: actions/[email protected] | |
| with: | |
| repository: lynx-family/integrating-lynx-demo-projects | |
| ref: b106f7f21d5221acfed645f4afa9d829a1cc0cc2 | |
| path: lynx | |
| - name: Cherry Pick Commit To Build With Local AAR | |
| run: | | |
| echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE" | |
| git config user.name "GitHub Actions" | |
| git config user.email "[email protected]" | |
| git fetch origin 12858f5a4f51454057f738f0b1d2bb001986dc91 | |
| git cherry-pick 12858f5a4f51454057f738f0b1d2bb001986dc91 | |
| - name: Download Lynx SDK Artifacts | |
| uses: lynx-infra/download-artifact@79d9914484f933089c2840552cf439bac85debad | |
| with: | |
| name: android-sdk-release | |
| path: lynx | |
| - name: Python Setup | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Setup Java SDK | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: 17 | |
| distribution: 'zulu' | |
| - name: Gradle Wrapper Cache | |
| uses: lynx-infra/cache@5c6160a6a4c7fca80a2f3057bb9dfc9513fcb732 | |
| with: | |
| path: ~/.gradle/wrapper/dists | |
| key: gradle-wrapper-${{ runner.os }} | |
| - name: Setup cache action | |
| uses: lynx-infra/cache@5c6160a6a4c7fca80a2f3057bb9dfc9513fcb732 | |
| with: | |
| path: ~/.gradle/caches/modules-2 | |
| key: gradle-integration-deps-${{ runner.os }} | |
| - name: Build With Local AAR | |
| id: build_apk | |
| run: | | |
| set -e | |
| pushd android/JavaEmptyProject/ | |
| python3 shell/prepare_package_with_local_aar.py $GITHUB_WORKSPACE/lynx/artifacts-collection.zip 0.0.1-alpha.1 | |
| ./gradlew publishAllZips | |
| ./gradlew :app:assembleDebug | |
| popd | |
| harmony-explorer-build: | |
| runs-on: lynx-custom-container | |
| container: | |
| image: ghcr.io/lynx-family/ubuntu24.04-harmony@sha256:bf493c3710de3c44bfa84caf402c0727b9310c42497f6e52580ad441ea640ef1 | |
| credentials: | |
| username: lynx-family | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Download Source | |
| uses: actions/[email protected] | |
| with: | |
| path: lynx | |
| - name: Build Explorer App | |
| uses: ./lynx/.github/actions/harmony-explorer-build | |
| ios-explorer-build: | |
| timeout-minutes: 60 | |
| runs-on: lynx-darwin-14-medium | |
| strategy: | |
| matrix: | |
| arch: [arm64, x86_64] | |
| steps: | |
| - name: Download Source | |
| uses: actions/[email protected] | |
| with: | |
| path: lynx | |
| - name: Build Explorer App | |
| uses: ./lynx/.github/actions/ios-explorer-build | |
| with: | |
| build-arch: ${{ matrix.arch }} | |
| build-params: '--integration-test' | |
| - name: upload artifact | |
| uses: lynx-infra/upload-artifact@332ec52e99f7cbf1fbbdc9bcc09280d49147d092 | |
| continue-on-error: true | |
| with: | |
| name: ios-explorer-build-${{ matrix.arch }} | |
| path: '${{ github.workspace }}/lynx/LynxExplorer-${{ matrix.arch }}.app.tar.gz' | |
| ios-integration-test: | |
| timeout-minutes: 15 | |
| runs-on: lynx-darwin-14-medium | |
| env: | |
| LOCAL_POD_NAME: 'local_pod' | |
| POD_VERSION: '0.0.1-alpha.1' | |
| steps: | |
| - name: Download Source | |
| uses: actions/[email protected] | |
| with: | |
| fetch-depth: 2 | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| path: lynx | |
| - name: Install Common Dependencies | |
| uses: ./lynx/.github/actions/common-deps | |
| - name: Setup Ruby Cache | |
| uses: ./lynx/.github/actions/ios-common-deps | |
| - name: Prepare cocoapods publish source | |
| run: |- | |
| source tools/envsetup.sh | |
| export LANG=en_US.UTF-8 | |
| python3 tools/ios_tools/cocoapods_publish_helper.py --prepare-source --tag $POD_VERSION --version $POD_VERSION --component all | |
| - name: Publish to Local Pod Source | |
| run: |- | |
| cd $GITHUB_WORKSPACE/lynx | |
| source tools/envsetup.sh | |
| git config --global user.name "lynx.authors" | |
| git config --global user.email "[email protected]" | |
| python3 tools/ios_tools/cocoapods_publish_helper.py --publish_local $LOCAL_POD_NAME --component all | |
| - name: Download the Demo Project | |
| uses: actions/[email protected] | |
| with: | |
| path: demo | |
| repository: lynx-family/integrating-lynx-demo-projects | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build the Demo Project | |
| run: |- | |
| cd $GITHUB_WORKSPACE | |
| python3 lynx/tools/ios_tools/process_podfile.py --action replace_pod_version --component Lynx --version $POD_VERSION --podfile demo/ios/HelloLynxObjc/Podfile | |
| python3 lynx/tools/ios_tools/process_podfile.py --action replace_pod_version --component LynxService --version $POD_VERSION --podfile demo/ios/HelloLynxObjc/Podfile | |
| python3 lynx/tools/ios_tools/process_podfile.py --action replace_pod_version --component XElement --version $POD_VERSION --podfile demo/ios/HelloLynxObjc/Podfile | |
| python3 lynx/tools/ios_tools/process_podfile.py --action insert_pod_source --podfile demo/ios/HelloLynxObjc/Podfile --pod_source "file://$GITHUB_WORKSPACE/lynx/$LOCAL_POD_NAME" | |
| cd demo/ios/HelloLynxObjc | |
| export LANG=en_US.UTF-8 | |
| BUNDLE_GEMFILE=$GITHUB_WORKSPACE/lynx/Gemfile bundle --version | |
| BUNDLE_GEMFILE=$GITHUB_WORKSPACE/lynx/Gemfile bundle exec pod install | |
| xcodebuild -workspace Hello-Lynx-OC.xcworkspace/ -scheme Hello-Lynx-OC CODE_SIGNING_ALLOWED=NO build | |
| ios-e2e-test: | |
| timeout-minutes: 60 | |
| needs: [ios-explorer-build] | |
| env: | |
| APPIUM_TEST_SERVER_PORT: 4723 | |
| APPIUM_TEST_SERVER_HOST: 127.0.0.1 | |
| runs-on: lynx-darwin-14-medium | |
| steps: | |
| - name: Download Source | |
| uses: actions/[email protected] | |
| with: | |
| path: lynx | |
| - name: Install Common Dependencies | |
| uses: ./lynx/.github/actions/common-deps | |
| - name: Setup Ruby Cache | |
| uses: ./lynx/.github/actions/ios-common-deps | |
| - name: Get iOS simulator SDK version | |
| run: | | |
| xcodebuild -showsdks | grep -Eo -m 1 "iphonesimulator([0-9]{1,}\.)+[0-9]{1,}" > sdk.txt | |
| sdkVersion=$(awk '{ sub(/iphonesimulator/,""); print $0 }' sdk.txt) | |
| echo "SDK_VERSION=$sdkVersion" >> $GITHUB_ENV | |
| - name: Build WebDriverAgent | |
| uses: nick-fields/retry@v3 | |
| with: | |
| max_attempts: 2 | |
| retry_wait_seconds: 5 | |
| timeout_minutes: 5 | |
| command: | | |
| pushd $GITHUB_WORKSPACE | |
| git clone https://github.com/appium/WebDriverAgent.git | |
| xcodebuild build-for-testing \ | |
| -project ./WebDriverAgent/WebDriverAgent.xcodeproj \ | |
| -scheme WebDriverAgentRunner \ | |
| -configuration Release \ | |
| -sdk iphonesimulator${{ env.SDK_VERSION }} \ | |
| -derivedDataPath ./WebDriverAgent/DerivedData \ | |
| -destination "platform=iOS Simulator,OS=${{ env.SDK_VERSION }},name=iPhone 15" \ | |
| SYMROOT=$GITHUB_WORKSPACE/Build/Products | |
| popd | |
| - name: Start iOS Simulator | |
| run: | | |
| xcrun simctl boot "iPhone 15" | |
| - name: Install WebDriverAgent to Simulator | |
| run: | | |
| set -e | |
| SIMULATOR_UDID=$(xcrun simctl list devices "iOS ${{ env.SDK_VERSION }}" | grep "iPhone 15 (" | grep -oE '[0-9A-F-]{36}') | |
| echo "SIMULATOR_UDID=$SIMULATOR_UDID" >> $GITHUB_ENV | |
| xcrun simctl install $SIMULATOR_UDID \ | |
| $GITHUB_WORKSPACE/Build/Products/Release-iphonesimulator/WebDriverAgentRunner-Runner.app | |
| - name: Install Appium | |
| run: | | |
| pushd $GITHUB_WORKSPACE/lynx | |
| source tools/envsetup.sh | |
| pnpm install [email protected] -w | |
| pnpm install [email protected] -w | |
| pnpm install [email protected] -w | |
| popd | |
| env: | |
| npm_config_store_dir: ~/.local/share/pnpm/store | |
| - name: Download Explorer App | |
| uses: lynx-infra/download-artifact@79d9914484f933089c2840552cf439bac85debad | |
| with: | |
| name: ios-explorer-build-arm64 | |
| path: lynx/explorer/darwin/ios/lynx_explorer/build_temp | |
| - name: Install Explorer App | |
| run: | | |
| mkdir -p $GITHUB_WORKSPACE/lynx/explorer/darwin/ios/lynx_explorer/build_temp/LynxExplorer.app | |
| tar -xzvf $GITHUB_WORKSPACE/lynx/explorer/darwin/ios/lynx_explorer/build_temp/LynxExplorer-arm64.app.tar.gz -C $GITHUB_WORKSPACE/lynx/explorer/darwin/ios/lynx_explorer/build_temp/LynxExplorer.app | |
| xcrun simctl install $SIMULATOR_UDID $GITHUB_WORKSPACE/lynx/explorer/darwin/ios/lynx_explorer/build_temp/LynxExplorer.app | |
| - name: Start Appium server | |
| run: | | |
| pushd $GITHUB_WORKSPACE/lynx | |
| source tools/envsetup.sh | |
| pushd node_modules/appium/node_modules/.bin | |
| ls | |
| ./appium server \ | |
| --port=$APPIUM_TEST_SERVER_PORT \ | |
| --address=$APPIUM_TEST_SERVER_HOST \ | |
| --log-no-colors \ | |
| --log-timestamp \ | |
| 2>&1 > "$GITHUB_WORKSPACE/lynx/appium.log" < /dev/null & | |
| popd | |
| popd | |
| - name: Check if Appium Server is running | |
| run: | | |
| max_attempts=10 | |
| attempt=0 | |
| while [ $attempt -lt $max_attempts ]; do | |
| if nc -z $APPIUM_TEST_SERVER_HOST $APPIUM_TEST_SERVER_PORT; then | |
| echo "Appium Server is running." | |
| break | |
| else | |
| attempt=$((attempt + 1)) | |
| echo "Attempt $attempt: Appium Server is not yet running. Retrying in 2 seconds..." | |
| sleep 2 | |
| fi | |
| done | |
| if [ $attempt -eq $max_attempts ]; then | |
| echo "Failed to start Appium Server." | |
| exit 1 | |
| fi | |
| - name: Run iOS E2E Test | |
| uses: nick-fields/retry@v3 | |
| with: | |
| max_attempts: 2 | |
| retry_wait_seconds: 5 | |
| timeout_minutes: 20 | |
| command: | | |
| set -e | |
| pushd $GITHUB_WORKSPACE/lynx | |
| source tools/envsetup.sh | |
| pushd $GITHUB_WORKSPACE/lynx/testing/integration_test/test_script | |
| export server_port=$APPIUM_TEST_SERVER_PORT | |
| export platform=ios | |
| export APPIUM_isHeadless=True | |
| pip3 install -r requirements.txt | |
| python3 manage.py runtest ios_test.core | |
| echo "TASK_STATUS=success" >> $GITHUB_OUTPUT | |
| popd | |
| popd | |
| id: run_test | |
| - name: Collect Lynx-E2E execution logs | |
| if: always() | |
| run: | | |
| TASK_STATUS="${{ steps.run_test.outputs.TASK_STATUS }}" | |
| if [ -n "$TASK_STATUS" ] && [ "$TASK_STATUS" = "success" ]; then | |
| echo "Test execution succeeded." | |
| else | |
| echo "Test execution failed, collecting logs..." | |
| pushd $GITHUB_WORKSPACE/lynx/testing/integration_test/test_script | |
| ls | grep -E "^lynx_e2e_devtools_.*\.log$" | xargs cat | |
| popd | |
| fi | |
| - name: Collect Appium Server logs | |
| if: always() | |
| run: | | |
| TASK_STATUS="${{ steps.run_test.outputs.TASK_STATUS }}" | |
| if [ -n "$TASK_STATUS" ] && [ "$TASK_STATUS" = "success" ]; then | |
| echo "Test execution succeeded." | |
| else | |
| echo "Test execution failed, collecting logs..." | |
| pushd $GITHUB_WORKSPACE/lynx/ | |
| if [ -f "appium.log" ]; then | |
| cat appium.log | |
| else | |
| echo "Warning: appium.log file not found" | |
| fi | |
| popd | |
| fi | |
| - name: Collect Generated Resource Files | |
| if: always() | |
| run: | | |
| TASK_STATUS="${{ steps.run_test.outputs.TASK_STATUS }}" | |
| if [ -n "$TASK_STATUS" ] && [ "$TASK_STATUS" = "success" ]; then | |
| echo "Test execution succeeded." | |
| else | |
| pushd $GITHUB_WORKSPACE/lynx/testing/integration_test/test_script | |
| if [ -d "screenshots" ]; then | |
| zip -r screenshots.zip ./screenshots/ | |
| echo "Successfully created screenshots.zip" | |
| echo "ZIP_RESOURCES=success" >> $GITHUB_OUTPUT | |
| else | |
| echo "Warning: screenshot directory not found" | |
| fi | |
| fi | |
| id: collect_resource | |
| - name: Upload Generated Resource Files | |
| if: always() && steps.collect_resource.outputs.ZIP_RESOURCES == 'success' | |
| uses: lynx-infra/upload-artifact@332ec52e99f7cbf1fbbdc9bcc09280d49147d092 | |
| continue-on-error: true | |
| with: | |
| name: ios-e2e-resources | |
| path: '${{ github.workspace }}/lynx/testing/integration_test/test_script/screenshots.zip' |