|
64 | 64 | test: |
65 | 65 | name: Test (Dart ${{ matrix.dart-version }}) |
66 | 66 | runs-on: ubuntu-latest |
| 67 | + permissions: |
| 68 | + contents: 'read' |
| 69 | + id-token: 'write' |
67 | 70 |
|
68 | 71 | strategy: |
69 | 72 | fail-fast: false |
|
90 | 93 | with: |
91 | 94 | channel: ${{ matrix.dart-version }} |
92 | 95 |
|
| 96 | + - name: Authenticate to Google Cloud/Firebase |
| 97 | + uses: google-github-actions/auth@v2 |
| 98 | + with: |
| 99 | + workload_identity_provider: '${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}' |
| 100 | + service_account: '${{ secrets.SERVICE_ACCOUNT }}' |
| 101 | + |
93 | 102 | - name: Cache pub dependencies |
94 | 103 | uses: actions/cache@v3 |
95 | 104 | with: |
@@ -134,13 +143,13 @@ jobs: |
134 | 143 | # Save individual package coverage files before merging |
135 | 144 | cp coverage.lcov coverage_admin.lcov |
136 | 145 | cp ../google_cloud_firestore/coverage.lcov coverage_firestore.lcov |
137 | | -
|
| 146 | + |
138 | 147 | # Merge coverage reports from all packages (relative to packages/dart_firebase_admin) |
139 | 148 | # Only merge files that exist |
140 | 149 | COVERAGE_FILES="" |
141 | 150 | [ -f coverage.lcov ] && COVERAGE_FILES="$COVERAGE_FILES coverage.lcov" |
142 | 151 | [ -f ../google_cloud_firestore/coverage.lcov ] && COVERAGE_FILES="$COVERAGE_FILES ../google_cloud_firestore/coverage.lcov" |
143 | | -
|
| 152 | + |
144 | 153 | if [ -n "$COVERAGE_FILES" ]; then |
145 | 154 | cat $COVERAGE_FILES > merged_coverage.lcov |
146 | 155 | mv merged_coverage.lcov coverage.lcov |
@@ -201,7 +210,7 @@ jobs: |
201 | 210 | echo "coverage=${COVERAGE_PCT}" >> $GITHUB_OUTPUT |
202 | 211 | echo "total_lines=${TOTAL_LINES}" >> $GITHUB_OUTPUT |
203 | 212 | echo "hit_lines=${HIT_LINES}" >> $GITHUB_OUTPUT |
204 | | -
|
| 213 | + |
205 | 214 | echo "admin_coverage=${ADMIN_PCT}" >> $GITHUB_OUTPUT |
206 | 215 | echo "firestore_coverage=${FIRESTORE_PCT}" >> $GITHUB_OUTPUT |
207 | 216 | echo "storage_coverage=${STORAGE_PCT}" >> $GITHUB_OUTPUT |
@@ -288,74 +297,10 @@ jobs: |
288 | 297 | flags: unittests |
289 | 298 | fail_ci_if_error: false |
290 | 299 |
|
291 | | - test-integration: |
292 | | - name: Test - Integration (Dart ${{ matrix.dart-version }}) |
293 | | - runs-on: ubuntu-latest |
294 | | - # Skip for fork PRs — secrets are not available |
295 | | - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false |
296 | | - permissions: |
297 | | - contents: 'read' |
298 | | - id-token: 'write' |
299 | | - |
300 | | - strategy: |
301 | | - fail-fast: false |
302 | | - matrix: |
303 | | - dart-version: [stable, beta] |
304 | | - |
305 | | - defaults: |
306 | | - run: |
307 | | - working-directory: packages/dart_firebase_admin |
308 | | - |
309 | | - steps: |
310 | | - - uses: actions/checkout@v4 |
311 | | - with: |
312 | | - fetch-depth: 2 |
313 | | - |
314 | | - - uses: subosito/flutter-action@v2.7.1 |
315 | | - with: |
316 | | - channel: ${{ matrix.dart-version }} |
317 | | - |
318 | | - - name: Authenticate to Google Cloud/Firebase |
319 | | - uses: google-github-actions/auth@v2 |
320 | | - with: |
321 | | - workload_identity_provider: '${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}' |
322 | | - service_account: '${{ secrets.SERVICE_ACCOUNT }}' |
323 | | - |
324 | | - - name: Cache pub dependencies |
325 | | - uses: actions/cache@v3 |
326 | | - with: |
327 | | - path: ~/.pub-cache |
328 | | - key: pub-${{ matrix.dart-version }}-${{ hashFiles('**/pubspec.lock') }} |
329 | | - restore-keys: | |
330 | | - pub-${{ matrix.dart-version }}- |
331 | | - pub- |
332 | | -
|
333 | | - - name: Add pub cache bin to PATH |
334 | | - run: | |
335 | | - echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH |
336 | | - echo "PUB_CACHE=$HOME/.pub-cache" >> $GITHUB_ENV |
337 | | -
|
338 | | - - name: Install Melos |
339 | | - run: dart pub global activate melos |
340 | | - working-directory: . |
341 | | - |
342 | | - - name: Bootstrap workspace |
343 | | - run: melos bootstrap |
344 | | - working-directory: . |
345 | | - |
346 | | - - name: Run integration tests |
347 | | - run: dart test test/app/firebase_app_prod_test.dart --concurrency=1 |
348 | | - |
349 | 300 | build: |
350 | 301 | name: Build verification (Dart ${{ matrix.dart-version }}) |
351 | 302 | runs-on: ubuntu-latest |
352 | | - needs: [lint, test, test-integration] |
353 | | - # Run even if test-integration was skipped (fork PRs), but not if lint or test failed |
354 | | - if: | |
355 | | - always() && |
356 | | - needs.lint.result == 'success' && |
357 | | - needs.test.result == 'success' && |
358 | | - (needs.test-integration.result == 'success' || needs.test-integration.result == 'skipped') |
| 303 | + needs: [lint, test] |
359 | 304 |
|
360 | 305 | strategy: |
361 | 306 | fail-fast: false |
|
0 commit comments