feat: sign() on AuthClient #665
Workflow file for this run
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: Build | |
| on: | |
| pull_request: | |
| paths-ignore: | |
| - "**.md" | |
| - "**.mdx" | |
| schedule: | |
| # runs the CI everyday at 10AM | |
| - cron: "0 10 * * *" | |
| workflow_dispatch: | |
| inputs: | |
| dart_version: | |
| description: 'Dart version to test (stable or beta)' | |
| required: false | |
| default: 'stable' | |
| jobs: | |
| lint: | |
| name: Lint (Dart ${{ matrix.dart-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| dart-version: [stable, beta] | |
| defaults: | |
| run: | |
| working-directory: packages/dart_firebase_admin | |
| steps: | |
| - uses: actions/[email protected] | |
| - uses: subosito/[email protected] | |
| with: | |
| channel: ${{ matrix.dart-version }} | |
| - name: Cache pub dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.pub-cache | |
| key: pub-${{ matrix.dart-version }}-${{ hashFiles('**/pubspec.lock') }} | |
| restore-keys: | | |
| pub-${{ matrix.dart-version }}- | |
| pub- | |
| - name: Install Melos | |
| run: dart pub global activate melos | |
| working-directory: . | |
| - name: Bootstrap workspace | |
| run: melos bootstrap | |
| working-directory: . | |
| - name: Check format | |
| run: dart format --set-exit-if-changed . | |
| - name: Analyze | |
| run: dart analyze | |
| test: | |
| name: Test (Dart ${{ matrix.dart-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| dart-version: [stable, beta] | |
| defaults: | |
| run: | |
| working-directory: packages/dart_firebase_admin | |
| steps: | |
| - uses: actions/[email protected] | |
| with: | |
| fetch-depth: 2 | |
| - uses: actions/setup-node@v4 | |
| - uses: subosito/[email protected] | |
| with: | |
| channel: ${{ matrix.dart-version }} | |
| - name: Cache pub dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.pub-cache | |
| key: pub-${{ matrix.dart-version }}-${{ hashFiles('**/pubspec.lock') }} | |
| restore-keys: | | |
| pub-${{ matrix.dart-version }}- | |
| pub- | |
| - name: Cache Firebase CLI | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/firebase/emulators | |
| key: firebase-emulators | |
| restore-keys: | | |
| firebase- | |
| - name: Add pub cache bin to PATH | |
| run: | | |
| echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH | |
| echo "PUB_CACHE=$HOME/.pub-cache" >> $GITHUB_ENV | |
| - name: Install Melos | |
| run: dart pub global activate melos | |
| working-directory: . | |
| - name: Bootstrap workspace | |
| run: melos bootstrap | |
| working-directory: . | |
| - name: Install Firebase CLI | |
| run: npm install -g firebase-tools | |
| - name: Setup gcloud credentials | |
| run: | | |
| mkdir -p $HOME/.config/gcloud | |
| echo '${{ secrets.CREDS }}' > $HOME/.config/gcloud/application_default_credentials.json | |
| - name: Run tests with coverage | |
| run: ${{ github.workspace }}/scripts/coverage.sh | |
| - name: Check coverage threshold and generate report | |
| if: matrix.dart-version == 'stable' | |
| id: coverage | |
| run: | | |
| # coverage.lcov already generated by test_with_coverage in coverage script | |
| # Calculate total coverage | |
| TOTAL_LINES=$(grep -E "^(DA|LF):" coverage.lcov | grep "^LF:" | awk -F: '{sum+=$2} END {print sum}') | |
| HIT_LINES=$(grep -E "^(DA|LH):" coverage.lcov | grep "^LH:" | awk -F: '{sum+=$2} END {print sum}') | |
| if [ "$TOTAL_LINES" -gt 0 ]; then | |
| COVERAGE_PCT=$(awk "BEGIN {printf \"%.2f\", ($HIT_LINES/$TOTAL_LINES)*100}") | |
| else | |
| COVERAGE_PCT="0.00" | |
| fi | |
| echo "coverage=${COVERAGE_PCT}" >> $GITHUB_OUTPUT | |
| echo "total_lines=${TOTAL_LINES}" >> $GITHUB_OUTPUT | |
| echo "hit_lines=${HIT_LINES}" >> $GITHUB_OUTPUT | |
| echo "Coverage: ${COVERAGE_PCT}% (${HIT_LINES}/${TOTAL_LINES} lines)" | |
| # Check threshold | |
| if (( $(echo "$COVERAGE_PCT < 40" | bc -l) )); then | |
| echo "status=❌ Coverage ${COVERAGE_PCT}% is below 40% threshold" >> $GITHUB_OUTPUT | |
| exit 1 | |
| else | |
| echo "status=✅ Coverage ${COVERAGE_PCT}% meets 40% threshold" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Comment coverage on PR | |
| if: matrix.dart-version == 'stable' && github.event_name == 'pull_request' | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const coverage = '${{ steps.coverage.outputs.coverage }}'; | |
| const status = '${{ steps.coverage.outputs.status }}'; | |
| const hitLines = '${{ steps.coverage.outputs.hit_lines }}'; | |
| const totalLines = '${{ steps.coverage.outputs.total_lines }}'; | |
| const body = `## Coverage Report | |
| ${status} | |
| **Coverage:** ${coverage}% | |
| **Lines Covered:** ${hitLines}/${totalLines} | |
| _Minimum threshold: 40%_`; | |
| // Find existing comment | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const botComment = comments.find(comment => | |
| comment.user.type === 'Bot' && | |
| comment.body.includes('Coverage Report') | |
| ); | |
| if (botComment) { | |
| // Update existing comment | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: botComment.id, | |
| body: body | |
| }); | |
| } else { | |
| // Create new comment | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: body | |
| }); | |
| } | |
| - name: Upload coverage to codecov | |
| if: matrix.dart-version == 'stable' | |
| continue-on-error: true | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| files: packages/dart_firebase_admin/coverage.lcov | |
| flags: unittests | |
| fail_ci_if_error: false | |
| build: | |
| name: Build verification (Dart ${{ matrix.dart-version }}) | |
| runs-on: ubuntu-latest | |
| needs: [lint, test] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| dart-version: [stable, beta] | |
| defaults: | |
| run: | |
| working-directory: packages/dart_firebase_admin | |
| steps: | |
| - uses: actions/[email protected] | |
| - uses: subosito/[email protected] | |
| with: | |
| channel: ${{ matrix.dart-version }} | |
| - name: Cache pub dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.pub-cache | |
| key: pub-${{ matrix.dart-version }}-${{ hashFiles('**/pubspec.lock') }} | |
| restore-keys: | | |
| pub-${{ matrix.dart-version }}- | |
| pub- | |
| - name: Install Melos | |
| run: dart pub global activate melos | |
| working-directory: . | |
| - name: Bootstrap workspace | |
| run: melos bootstrap | |
| working-directory: . | |
| - name: Verify package | |
| run: dart pub publish --dry-run |