chore: use streaming read to decode JSON #84
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: PR Checks | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| # Cancel in-progress runs when a new workflow run is triggered | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| quick-checks: | |
| name: Quick Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Dart SDK | |
| uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: stable | |
| - name: Install dependencies | |
| run: dart pub get | |
| - name: Check formatting | |
| run: dart format --output=none --set-exit-if-changed . | |
| - name: Analyze code | |
| run: dart analyze --fatal-infos | |
| builder-validation: | |
| name: Validate Builder | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Dart SDK | |
| uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: stable | |
| - name: Install dependencies | |
| run: dart pub get | |
| - name: Install example dependencies | |
| working-directory: example/basic | |
| run: dart pub get | |
| - name: Generate manifest | |
| working-directory: example/basic | |
| run: dart run build_runner build --delete-conflicting-outputs | |
| - name: Verify manifest exists | |
| run: | | |
| if [ ! -f "example/basic/.dart_tool/firebase/functions.yaml" ]; then | |
| echo "::error::functions.yaml was not generated by builder" | |
| exit 1 | |
| fi | |
| - name: Check manifest structure | |
| run: | | |
| # Verify basic structure | |
| if ! grep -q "specVersion:" example/basic/.dart_tool/firebase/functions.yaml; then | |
| echo "::error::Missing specVersion in manifest" | |
| exit 1 | |
| fi | |
| if ! grep -q "endpoints:" example/basic/.dart_tool/firebase/functions.yaml; then | |
| echo "::error::Missing endpoints in manifest" | |
| exit 1 | |
| fi | |
| echo "::notice::Manifest structure looks good" | |
| # Only run full snapshot tests on PRs targeting main | |
| snapshot-check: | |
| name: Snapshot Compatibility | |
| runs-on: ubuntu-latest | |
| if: github.base_ref == 'main' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Dart SDK | |
| uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: stable | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: dart pub get | |
| - name: Generate Dart manifest (basic) | |
| working-directory: example/basic | |
| run: | | |
| dart pub get | |
| dart run build_runner build --delete-conflicting-outputs | |
| - name: Generate Dart manifest (with_options) | |
| working-directory: example/with_options | |
| run: | | |
| dart pub get | |
| dart run build_runner build --delete-conflicting-outputs | |
| - name: Generate Node.js manifest (nodejs_reference) | |
| working-directory: example/nodejs_reference | |
| run: | | |
| npm ci | |
| GCLOUD_PROJECT="test-project" PORT="8080" FUNCTIONS_CONTROL_API="true" \ | |
| npx firebase-functions > /tmp/ff.log 2>&1 & | |
| FF_PID=$! | |
| for i in {1..30}; do | |
| if curl -s http://localhost:8080/__/functions.yaml > /dev/null 2>&1; then | |
| break | |
| fi | |
| sleep 1 | |
| done | |
| curl -s http://localhost:8080/__/functions.yaml | python3 -m json.tool > nodejs_manifest.json | |
| kill $FF_PID 2>/dev/null || true | |
| - name: Generate Node.js manifest (with_options_nodejs) | |
| working-directory: example/with_options_nodejs | |
| run: | | |
| npm ci | |
| GCLOUD_PROJECT="test-project" PORT="8081" FUNCTIONS_CONTROL_API="true" \ | |
| npx firebase-functions > /tmp/ff_options.log 2>&1 & | |
| FF_PID=$! | |
| for i in {1..30}; do | |
| if curl -s http://localhost:8081/__/functions.yaml > /dev/null 2>&1; then | |
| break | |
| fi | |
| sleep 1 | |
| done | |
| curl -s http://localhost:8081/__/functions.yaml | python3 -m json.tool > nodejs_manifest.json | |
| kill $FF_PID 2>/dev/null || true | |
| - name: Run snapshot tests | |
| run: dart test test/snapshots/manifest_snapshot_test.dart --reporter=github | |
| pr-status: | |
| name: PR Status | |
| runs-on: ubuntu-latest | |
| needs: [quick-checks, builder-validation] | |
| if: always() | |
| steps: | |
| - name: Check results | |
| run: | | |
| if [ "${{ needs.quick-checks.result }}" != "success" ] || \ | |
| [ "${{ needs.builder-validation.result }}" != "success" ]; then | |
| echo "::error::Some checks failed" | |
| exit 1 | |
| fi | |
| echo "::notice::All PR checks passed! ✅" |