|
| 1 | +name: e2e-fdc |
| 2 | + |
| 3 | +concurrency: |
| 4 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 5 | + cancel-in-progress: true |
| 6 | + |
| 7 | +on: |
| 8 | + pull_request: |
| 9 | + paths-ignore: |
| 10 | + - 'docs/**' |
| 11 | + - 'website/**' |
| 12 | + - '**/example/**' |
| 13 | + - '**/flutterfire_ui/**' |
| 14 | + - '**.md' |
| 15 | + push: |
| 16 | + branches: |
| 17 | + - master |
| 18 | + paths-ignore: |
| 19 | + - 'docs/**' |
| 20 | + - 'website/**' |
| 21 | + - '**/example/**' |
| 22 | + - '**.md' |
| 23 | + |
| 24 | +jobs: |
| 25 | + android: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + timeout-minutes: 45 |
| 28 | + strategy: |
| 29 | + fail-fast: false |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 |
| 32 | + - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 |
| 33 | + name: Install Node.js 20 |
| 34 | + with: |
| 35 | + node-version: '20' |
| 36 | + - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 |
| 37 | + with: |
| 38 | + distribution: 'temurin' |
| 39 | + java-version: '17' |
| 40 | + - name: Firebase Emulator Cache |
| 41 | + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 |
| 42 | + with: |
| 43 | + path: ~/.cache/firebase/emulators |
| 44 | + key: firebase-emulators-v3-fdc-${{ runner.os }} |
| 45 | + restore-keys: firebase-emulators-v3 |
| 46 | + - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 |
| 47 | + with: |
| 48 | + channel: 'stable' |
| 49 | + cache: true |
| 50 | + - name: Setup PostgreSQL for Linux/macOS/Windows |
| 51 | + uses: ikalnytskyi/action-setup-postgres@v6 |
| 52 | + - uses: bluefireteam/melos-action@6085791af7036f6366c9a4b9d55105c0ef9c6388 |
| 53 | + with: |
| 54 | + run-bootstrap: false |
| 55 | + melos-version: '5.3.0' |
| 56 | + - name: 'Bootstrap package' |
| 57 | + run: melos bootstrap --scope "firebase_data_connect*" |
| 58 | + - name: 'Install Tools' |
| 59 | + run: | |
| 60 | + sudo npm i -g firebase-tools |
| 61 | + - name: Start Firebase Emulator |
| 62 | + run: | |
| 63 | + cd ./packages/firebase_data_connect/firebase_data_connect/example |
| 64 | + unset PGSERVICEFILE |
| 65 | + firebase experiments:enable dataconnect |
| 66 | + ./start-firebase-emulator.sh |
| 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@v3 |
| 74 | + - name: AVD cache |
| 75 | + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 |
| 76 | + id: avd-cache |
| 77 | + with: |
| 78 | + path: | |
| 79 | + ~/.android/avd/* |
| 80 | + ~/.android/adb* |
| 81 | + key: avd-${{ runner.os }} |
| 82 | + - name: Start AVD then run E2E tests |
| 83 | + uses: reactivecircus/android-emulator-runner@v2 |
| 84 | + with: |
| 85 | + api-level: 34 |
| 86 | + target: google_apis |
| 87 | + arch: x86_64 |
| 88 | + working-directory: 'packages/firebase_data_connect/firebase_data_connect/example' |
| 89 | + script: | |
| 90 | + flutter test integration_test/e2e_test.dart --dart-define=CI=true -d emulator-5554 |
| 91 | +
|
| 92 | + ios: |
| 93 | + runs-on: macos-14 |
| 94 | + timeout-minutes: 45 |
| 95 | + strategy: |
| 96 | + fail-fast: false |
| 97 | + steps: |
| 98 | + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 |
| 99 | + - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 |
| 100 | + name: Install Node.js 20 |
| 101 | + with: |
| 102 | + node-version: '20' |
| 103 | + - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 |
| 104 | + with: |
| 105 | + distribution: 'temurin' |
| 106 | + java-version: '17' |
| 107 | + - name: Setup PostgreSQL for Linux/macOS/Windows |
| 108 | + uses: ikalnytskyi/action-setup-postgres@v6 |
| 109 | + - uses: hendrikmuhs/ccache-action@c92f40bee50034e84c763e33b317c77adaa81c92 |
| 110 | + name: Xcode Compile Cache |
| 111 | + with: |
| 112 | + key: xcode-cache-${{ runner.os }} |
| 113 | + max-size: 700M |
| 114 | + - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 |
| 115 | + name: Pods Cache |
| 116 | + id: pods-cache |
| 117 | + with: |
| 118 | + path: tests/ios/Pods |
| 119 | + key: ${{ runner.os }}-fdc-pods-v3-${{ hashFiles('tests/ios/Podfile.lock') }} |
| 120 | + restore-keys: ${{ runner.os }}-ios-pods-v2 |
| 121 | + - name: Firebase Emulator Cache |
| 122 | + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 |
| 123 | + with: |
| 124 | + path: ~/.cache/firebase/emulators |
| 125 | + key: firebase-emulators-v3-fdc-${{ runner.os }} |
| 126 | + restore-keys: firebase-emulators-v3 |
| 127 | + - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 |
| 128 | + with: |
| 129 | + channel: 'stable' |
| 130 | + cache: true |
| 131 | + - uses: bluefireteam/melos-action@6085791af7036f6366c9a4b9d55105c0ef9c6388 |
| 132 | + with: |
| 133 | + run-bootstrap: false |
| 134 | + melos-version: '5.3.0' |
| 135 | + - name: 'Bootstrap package' |
| 136 | + run: melos bootstrap --scope "firebase_data_connect*" |
| 137 | + - name: 'Install Tools' |
| 138 | + run: | |
| 139 | + sudo npm i -g firebase-tools |
| 140 | + - name: 'Build Application' |
| 141 | + working-directory: 'packages/firebase_data_connect/firebase_data_connect/example' |
| 142 | + run: | |
| 143 | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" |
| 144 | + export CCACHE_SLOPPINESS=clang_index_store,file_stat_matches,include_file_ctime,include_file_mtime,ivfsoverlay,pch_defines,modules,system_headers,time_macros |
| 145 | + export CCACHE_FILECLONE=true |
| 146 | + export CCACHE_DEPEND=true |
| 147 | + export CCACHE_INODECACHE=true |
| 148 | + ccache -s |
| 149 | + flutter build ios --no-codesign --simulator --debug --target=./integration_test/e2e_test.dart --dart-define=CI=true |
| 150 | + ccache -s |
| 151 | + - name: Start Firebase Emulator |
| 152 | + run: | |
| 153 | + sudo chown -R 501:20 "/Users/runner/.npm" |
| 154 | + cd ./packages/firebase_data_connect/firebase_data_connect/example |
| 155 | + unset PGSERVICEFILE |
| 156 | + firebase experiments:enable dataconnect |
| 157 | + ./start-firebase-emulator.sh |
| 158 | + - name: 'E2E Tests' |
| 159 | + working-directory: 'packages/firebase_data_connect/firebase_data_connect/example' |
| 160 | + run: | |
| 161 | + # Boot simulator and wait for System app to be ready. |
| 162 | + # List of available simulators: https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md#installed-simulators |
| 163 | + SIMULATOR="iPhone 15" |
| 164 | + xcrun simctl bootstatus "$SIMULATOR" -b |
| 165 | + xcrun simctl logverbose "$SIMULATOR" enable |
| 166 | + # Sleep to allow simulator to settle. |
| 167 | + sleep 15 |
| 168 | + # Uncomment following line to have simulator logs printed out for debugging purposes. |
| 169 | + # xcrun simctl spawn booted log stream --predicate 'eventMessage contains "flutter"' & |
| 170 | + flutter test integration_test/e2e_test.dart -d "$SIMULATOR" --dart-define=CI=true |
| 171 | +
|
| 172 | + web: |
| 173 | + runs-on: macos-latest |
| 174 | + timeout-minutes: 15 |
| 175 | + strategy: |
| 176 | + fail-fast: false |
| 177 | + steps: |
| 178 | + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 |
| 179 | + - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 |
| 180 | + name: Install Node.js 20 |
| 181 | + with: |
| 182 | + node-version: '20' |
| 183 | + - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 |
| 184 | + with: |
| 185 | + distribution: 'temurin' |
| 186 | + java-version: '17' |
| 187 | + - name: Setup PostgreSQL for Linux/macOS/Windows |
| 188 | + uses: ikalnytskyi/action-setup-postgres@v6 |
| 189 | + - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 |
| 190 | + with: |
| 191 | + channel: 'stable' |
| 192 | + cache: true |
| 193 | + - uses: bluefireteam/melos-action@6085791af7036f6366c9a4b9d55105c0ef9c6388 |
| 194 | + with: |
| 195 | + run-bootstrap: false |
| 196 | + melos-version: '5.3.0' |
| 197 | + - name: 'Bootstrap package' |
| 198 | + run: melos bootstrap --scope "firebase_data_connect*" |
| 199 | + - name: 'Install Tools' |
| 200 | + run: sudo npm i -g firebase-tools |
| 201 | + - name: Cache Firebase Emulator |
| 202 | + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 |
| 203 | + with: |
| 204 | + path: ~/.cache/firebase/emulators |
| 205 | + key: firebase-emulators-v3-fdc-${{ runner.os }} |
| 206 | + restore-keys: firebase-emulators-v3 |
| 207 | + - name: Start Firebase Emulator |
| 208 | + run: | |
| 209 | + sudo chown -R 501:20 "/Users/runner/.npm" |
| 210 | + cd ./packages/firebase_data_connect/firebase_data_connect/example |
| 211 | + unset PGSERVICEFILE |
| 212 | + firebase experiments:enable dataconnect |
| 213 | + ./start-firebase-emulator.sh |
| 214 | + - name: 'E2E Tests' |
| 215 | + working-directory: 'packages/firebase_data_connect/firebase_data_connect/example' |
| 216 | + # Web devices are not supported for the `flutter test` command yet. As a |
| 217 | + # workaround we can use the `flutter drive` command. Tracking issue: |
| 218 | + # https://github.com/flutter/flutter/issues/66264 |
| 219 | + run: | |
| 220 | + chromedriver --port=4444 --trace-buffer-size=100000 & |
| 221 | + flutter drive --target=./integration_test/e2e_test.dart --driver=./test_driver/integration_test.dart -d chrome --dart-define=CI=true | tee output.log |
| 222 | + # We have to check the output for failed tests matching the string "[E]" |
| 223 | + output=$(<output.log) |
| 224 | + if [[ "$output" =~ \[E\] ]]; then |
| 225 | + # You will see "All tests passed." in the logs even when tests failed. |
| 226 | + echo "All tests did not pass. Please check the logs for more information." |
| 227 | + exit 1 |
| 228 | + fi |
| 229 | + shell: bash |
| 230 | + |
0 commit comments