|
| 1 | +name: e2e-pipeline |
| 2 | + |
| 3 | +concurrency: |
| 4 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 5 | + cancel-in-progress: true |
| 6 | + |
| 7 | +# on: |
| 8 | +# pull_request: |
| 9 | +# paths: |
| 10 | +# - 'packages/cloud_firestore/cloud_firestore/pipeline_example/**' |
| 11 | +# - 'packages/cloud_firestore/cloud_firestore/lib/**' |
| 12 | +# - '.github/workflows/e2e_tests_pipeline.yaml' |
| 13 | +# push: |
| 14 | +# branches: |
| 15 | +# - main |
| 16 | +# - firestore-pipelines-dart-api-v2 |
| 17 | +# - master |
| 18 | +# paths: |
| 19 | +# - 'packages/cloud_firestore/cloud_firestore/pipeline_example/**' |
| 20 | +# - 'packages/cloud_firestore/cloud_firestore/lib/**' |
| 21 | +# - '.github/workflows/e2e_tests_pipeline.yaml' |
| 22 | + |
| 23 | +on: |
| 24 | + pull_request: |
| 25 | + push: |
| 26 | + workflow_dispatch: |
| 27 | + |
| 28 | +jobs: |
| 29 | + pipeline-e2e-android: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + timeout-minutes: 45 |
| 32 | + env: |
| 33 | + AVD_ARCH: x86_64 |
| 34 | + AVD_API_LEVEL: 34 |
| 35 | + AVD_TARGET: google_apis |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 |
| 38 | + - uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a |
| 39 | + name: Install Node.js 20 |
| 40 | + with: |
| 41 | + node-version: '20' |
| 42 | + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b |
| 43 | + with: |
| 44 | + distribution: 'temurin' |
| 45 | + java-version: '21' |
| 46 | + - uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff |
| 47 | + with: |
| 48 | + channel: 'stable' |
| 49 | + cache: true |
| 50 | + cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" |
| 51 | + pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:" |
| 52 | + - uses: bluefireteam/melos-action@c7dcb921b23cc520cace360b95d02b37bf09cdaa |
| 53 | + with: |
| 54 | + run-bootstrap: false |
| 55 | + melos-version: '5.3.0' |
| 56 | + - name: Inject Firebase config for pipeline E2E |
| 57 | + env: |
| 58 | + FIREBASE_OPTIONS_DART: ${{ secrets.PIPELINE_E2E_FIREBASE_OPTIONS_DART }} |
| 59 | + GOOGLE_SERVICES_JSON: ${{ secrets.PIPELINE_E2E_GOOGLE_SERVICES_JSON }} |
| 60 | + GOOGLE_SERVICE_INFO_PLIST: ${{ secrets.PIPELINE_E2E_GOOGLE_SERVICE_INFO_PLIST }} |
| 61 | + run: | |
| 62 | + echo "$FIREBASE_OPTIONS_DART" > packages/cloud_firestore/cloud_firestore/pipeline_example/lib/firebase_options.dart |
| 63 | + echo "$GOOGLE_SERVICES_JSON" > packages/cloud_firestore/cloud_firestore/pipeline_example/android/app/google-services.json |
| 64 | + echo "$GOOGLE_SERVICE_INFO_PLIST" > packages/cloud_firestore/cloud_firestore/pipeline_example/ios/Runner/GoogleService-Info.plist |
| 65 | + - name: Bootstrap package |
| 66 | + run: melos bootstrap --scope "cloud_firestore*" |
| 67 | + - name: Enable KVM |
| 68 | + run: | |
| 69 | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules |
| 70 | + sudo udevadm control --reload-rules |
| 71 | + sudo udevadm trigger --name-match=kvm |
| 72 | + - name: Gradle cache |
| 73 | + uses: gradle/actions/setup-gradle@v4 |
| 74 | + - name: Free Disk Space (Ubuntu) |
| 75 | + uses: AdityaGarg8/remove-unwanted-software@90e01b21170618765a73370fcc3abbd1684a7793 |
| 76 | + with: |
| 77 | + remove-dotnet: true |
| 78 | + remove-haskell: true |
| 79 | + remove-codeql: true |
| 80 | + remove-docker-images: true |
| 81 | + remove-large-packages: true |
| 82 | + - name: AVD cache |
| 83 | + uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 |
| 84 | + continue-on-error: true |
| 85 | + id: avd-cache |
| 86 | + with: |
| 87 | + path: | |
| 88 | + ~/.android/avd/* |
| 89 | + ~/.android/adb* |
| 90 | + key: avd-${{ runner.os }}-${{ env.AVD_API_LEVEL }}-${{ env.AVD_TARGET }}-${{ env.AVD_ARCH }} |
| 91 | + - name: Start AVD then run pipeline E2E tests |
| 92 | + uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b |
| 93 | + with: |
| 94 | + api-level: ${{ env.AVD_API_LEVEL }} |
| 95 | + target: ${{ env.AVD_TARGET }} |
| 96 | + arch: ${{ env.AVD_ARCH }} |
| 97 | + emulator-build: 14214601 |
| 98 | + working-directory: packages/cloud_firestore/cloud_firestore/pipeline_example |
| 99 | + script: | |
| 100 | + flutter test integration_test/pipeline/pipeline_live_test.dart --timeout 10x --dart-define=CI=true -d emulator-5554 |
| 101 | + - name: Ensure Appium is shut down |
| 102 | + run: | |
| 103 | + pgrep -f appium && pkill -f appium || echo "No Appium process found" |
| 104 | + - name: Save Android Emulator Cache |
| 105 | + if: github.ref == 'refs/heads/main' |
| 106 | + uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 |
| 107 | + continue-on-error: true |
| 108 | + with: |
| 109 | + key: ${{ steps.avd-cache.outputs.cache-primary-key }} |
| 110 | + path: | |
| 111 | + ~/.android/avd/* |
| 112 | + ~/.android/adb* |
| 113 | +
|
| 114 | + pipeline-e2e-web: |
| 115 | + runs-on: macos-latest |
| 116 | + timeout-minutes: 25 |
| 117 | + steps: |
| 118 | + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 |
| 119 | + - uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a |
| 120 | + name: Install Node.js 20 |
| 121 | + with: |
| 122 | + node-version: '20' |
| 123 | + - uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff |
| 124 | + with: |
| 125 | + channel: 'stable' |
| 126 | + cache: true |
| 127 | + cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" |
| 128 | + pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:" |
| 129 | + - uses: bluefireteam/melos-action@c7dcb921b23cc520cace360b95d02b37bf09cdaa |
| 130 | + with: |
| 131 | + run-bootstrap: false |
| 132 | + melos-version: '5.3.0' |
| 133 | + - name: Inject Firebase config for pipeline E2E |
| 134 | + env: |
| 135 | + FIREBASE_OPTIONS_DART: ${{ secrets.PIPELINE_E2E_FIREBASE_OPTIONS_DART }} |
| 136 | + GOOGLE_SERVICES_JSON: ${{ secrets.PIPELINE_E2E_GOOGLE_SERVICES_JSON }} |
| 137 | + GOOGLE_SERVICE_INFO_PLIST: ${{ secrets.PIPELINE_E2E_GOOGLE_SERVICE_INFO_PLIST }} |
| 138 | + run: | |
| 139 | + echo "$FIREBASE_OPTIONS_DART" > packages/cloud_firestore/cloud_firestore/pipeline_example/lib/firebase_options.dart |
| 140 | + echo "$GOOGLE_SERVICES_JSON" > packages/cloud_firestore/cloud_firestore/pipeline_example/android/app/google-services.json |
| 141 | + echo "$GOOGLE_SERVICE_INFO_PLIST" > packages/cloud_firestore/cloud_firestore/pipeline_example/ios/Runner/GoogleService-Info.plist |
| 142 | + - name: Bootstrap package |
| 143 | + run: melos bootstrap --scope "cloud_firestore*" |
| 144 | + - name: Run pipeline E2E tests (Chrome) |
| 145 | + working-directory: packages/cloud_firestore/cloud_firestore/pipeline_example |
| 146 | + # Web devices are not supported for the `flutter test` command yet. As a |
| 147 | + # workaround we use the `flutter drive` command. Tracking issue: |
| 148 | + # https://github.com/flutter/flutter/issues/66264 |
| 149 | + run: | |
| 150 | + chromedriver --port=4444 --trace-buffer-size=100000 & |
| 151 | + flutter drive --target=./integration_test/pipeline/pipeline_live_test.dart --driver=./test_driver/integration_test.dart -d chrome --dart-define=CI=true | tee output.log |
| 152 | + output=$(<output.log) |
| 153 | + if [[ "$output" =~ \[E\] ]]; then |
| 154 | + echo "All tests did not pass. Please check the logs for more information." |
| 155 | + exit 1 |
| 156 | + fi |
| 157 | + shell: bash |
| 158 | + |
| 159 | + pipeline-e2e-ios: |
| 160 | + runs-on: macos-15 |
| 161 | + timeout-minutes: 50 |
| 162 | + steps: |
| 163 | + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 |
| 164 | + - uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a |
| 165 | + name: Install Node.js 20 |
| 166 | + with: |
| 167 | + node-version: '20' |
| 168 | + - name: Xcode |
| 169 | + run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer |
| 170 | + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b |
| 171 | + with: |
| 172 | + distribution: 'temurin' |
| 173 | + java-version: '21' |
| 174 | + - uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff |
| 175 | + with: |
| 176 | + channel: 'stable' |
| 177 | + cache: true |
| 178 | + cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" |
| 179 | + pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:" |
| 180 | + - uses: bluefireteam/melos-action@c7dcb921b23cc520cace360b95d02b37bf09cdaa |
| 181 | + with: |
| 182 | + run-bootstrap: false |
| 183 | + melos-version: '5.3.0' |
| 184 | + - name: Inject Firebase config for pipeline E2E |
| 185 | + env: |
| 186 | + FIREBASE_OPTIONS_DART: ${{ secrets.PIPELINE_E2E_FIREBASE_OPTIONS_DART }} |
| 187 | + GOOGLE_SERVICES_JSON: ${{ secrets.PIPELINE_E2E_GOOGLE_SERVICES_JSON }} |
| 188 | + GOOGLE_SERVICE_INFO_PLIST: ${{ secrets.PIPELINE_E2E_GOOGLE_SERVICE_INFO_PLIST }} |
| 189 | + run: | |
| 190 | + echo "$FIREBASE_OPTIONS_DART" > packages/cloud_firestore/cloud_firestore/pipeline_example/lib/firebase_options.dart |
| 191 | + echo "$GOOGLE_SERVICES_JSON" > packages/cloud_firestore/cloud_firestore/pipeline_example/android/app/google-services.json |
| 192 | + echo "$GOOGLE_SERVICE_INFO_PLIST" > packages/cloud_firestore/cloud_firestore/pipeline_example/ios/Runner/GoogleService-Info.plist |
| 193 | + - name: Bootstrap package |
| 194 | + run: melos bootstrap --scope "cloud_firestore*" |
| 195 | + - uses: futureware-tech/simulator-action@e89aa8f93d3aec35083ff49d2854d07f7186f7f5 |
| 196 | + id: simulator |
| 197 | + with: |
| 198 | + model: "iPhone 16" |
| 199 | + - name: Build iOS (simulator) |
| 200 | + working-directory: packages/cloud_firestore/cloud_firestore/pipeline_example |
| 201 | + run: | |
| 202 | + flutter build ios --no-codesign --simulator --debug --target=./integration_test/pipeline/pipeline_live_test.dart --dart-define=CI=true |
| 203 | + - name: Run pipeline E2E tests (iOS) |
| 204 | + working-directory: packages/cloud_firestore/cloud_firestore/pipeline_example |
| 205 | + env: |
| 206 | + SIMULATOR: ${{ steps.simulator.outputs.udid }} |
| 207 | + run: | |
| 208 | + flutter test integration_test/pipeline/pipeline_live_test.dart -d "$SIMULATOR" --timeout 10x --dart-define=CI=true |
0 commit comments