|
21 | 21 | - '**/example/**' |
22 | 22 | - '**.md' |
23 | 23 |
|
| 24 | +permissions: |
| 25 | + contents: read |
| 26 | + |
24 | 27 | jobs: |
25 | 28 | android: |
26 | 29 | runs-on: ubuntu-latest |
@@ -333,3 +336,82 @@ jobs: |
333 | 336 | key: ${{ steps.firebase-emulator-cache.outputs.cache-primary-key }} |
334 | 337 | # Must match the restore path exactly |
335 | 338 | path: ~/.cache/firebase/emulators |
| 339 | + |
| 340 | + web-wasm: |
| 341 | + runs-on: macos-latest |
| 342 | + timeout-minutes: 15 |
| 343 | + strategy: |
| 344 | + fail-fast: false |
| 345 | + steps: |
| 346 | + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 |
| 347 | + - uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a |
| 348 | + name: Install Node.js 20 |
| 349 | + with: |
| 350 | + node-version: '20' |
| 351 | + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b |
| 352 | + with: |
| 353 | + distribution: 'temurin' |
| 354 | + java-version: '21' |
| 355 | + - name: Setup PostgreSQL for Linux/macOS/Windows |
| 356 | + uses: ikalnytskyi/action-setup-postgres@v7 |
| 357 | + - uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff |
| 358 | + with: |
| 359 | + channel: 'stable' |
| 360 | + cache: true |
| 361 | + cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" |
| 362 | + pub-cache-key: "flutter-pub-:os:-:channel:-:version:-:arch:-:hash:" |
| 363 | + - uses: bluefireteam/melos-action@c7dcb921b23cc520cace360b95d02b37bf09cdaa |
| 364 | + with: |
| 365 | + run-bootstrap: false |
| 366 | + melos-version: '5.3.0' |
| 367 | + - name: 'Bootstrap package' |
| 368 | + run: melos bootstrap --scope "firebase_data_connect*" |
| 369 | + - name: 'Install Tools' |
| 370 | + run: | |
| 371 | + sudo npm i -g firebase-tools |
| 372 | + echo "FIREBASE_TOOLS_VERSION=$(npm firebase --version)" >> $GITHUB_ENV |
| 373 | + - name: Firebase Emulator Cache |
| 374 | + id: firebase-emulator-cache |
| 375 | + uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 |
| 376 | + continue-on-error: true |
| 377 | + with: |
| 378 | + # The firebase emulators are pure javascript and java, OS-independent |
| 379 | + enableCrossOsArchive: true |
| 380 | + # Must match the save path exactly |
| 381 | + path: ~/.cache/firebase/emulators |
| 382 | + key: firebase-emulators-v3-${{ env.FIREBASE_TOOLS_VERSION }} |
| 383 | + restore-keys: firebase-emulators-v3 |
| 384 | + - name: Start Firebase Emulator |
| 385 | + run: | |
| 386 | + cd ./packages/firebase_data_connect/firebase_data_connect/example |
| 387 | + unset PGSERVICEFILE |
| 388 | + firebase experiments:enable dataconnect |
| 389 | + ./start-firebase-emulator.sh |
| 390 | + - name: 'E2E Tests' |
| 391 | + working-directory: 'packages/firebase_data_connect/firebase_data_connect/example' |
| 392 | + # Web devices are not supported for the `flutter test` command yet. As a |
| 393 | + # workaround we can use the `flutter drive` command. Tracking issue: |
| 394 | + # https://github.com/flutter/flutter/issues/66264 |
| 395 | + run: | |
| 396 | + chromedriver --port=4444 --trace-buffer-size=100000 & |
| 397 | + mv ./web/wasm_index.html ./web/index.html |
| 398 | + flutter drive --target=./integration_test/e2e_test.dart --driver=./test_driver/integration_test.dart -d chrome --wasm --dart-define=CI=true | tee output.log |
| 399 | + # We have to check the output for failed tests matching the string "[E]" |
| 400 | + output=$(<output.log) |
| 401 | + if [[ "$output" =~ \[E\] ]]; then |
| 402 | + # You will see "All tests passed." in the logs even when tests failed. |
| 403 | + echo "All tests did not pass. Please check the logs for more information." |
| 404 | + exit 1 |
| 405 | + fi |
| 406 | + shell: bash |
| 407 | + - name: Save Firestore Emulator Cache |
| 408 | + # Branches can read main cache but main cannot read branch cache. Avoid LRU eviction with main-only cache. |
| 409 | + if: github.ref == 'refs/heads/main' |
| 410 | + uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 |
| 411 | + continue-on-error: true |
| 412 | + with: |
| 413 | + # The firebase emulators are pure javascript and java, OS-independent |
| 414 | + enableCrossOsArchive: true |
| 415 | + key: ${{ steps.firebase-emulator-cache.outputs.cache-primary-key }} |
| 416 | + # Must match the restore path exactly |
| 417 | + path: ~/.cache/firebase/emulators |
0 commit comments