Skip to content

doc: add deployment section to README (#145) #483

doc: add deployment section to README (#145)

doc: add deployment section to README (#145) #483

Workflow file for this run

# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
schedule:
- cron: "0 0 * * 0" # weekly
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# Check license headers on all source files
check-license-header:
name: Check License Headers
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
- name: Download addlicense
run: |
curl -sL https://github.com/google/addlicense/releases/download/v1.2.0/addlicense_v1.2.0_Linux_x86_64.tar.gz | tar xz -C /usr/local/bin addlicense
chmod +x /usr/local/bin/addlicense
- name: Check license headers
run: |
addlicense -f header_template.txt \
--check \
--ignore "**/*.yml" \
--ignore "**/*.yaml" \
--ignore "**/*.xml" \
--ignore "**/*.g.dart" \
--ignore "**/*.sh" \
--ignore "**/*.html" \
--ignore "**/*.js" \
--ignore "**/*.ts" \
--ignore "**/*.txt" \
--ignore "**/.dart_tool/**" \
--ignore "**/test/fixtures/nodejs_reference/**" \
--ignore "**/test/fixtures/with_options_nodejs/**" \
.
# Dart package analysis and formatting
lint-analyze:
name: Format & Analyze (${{ matrix.sdk }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [stable, dev]
steps:
- name: Checkout repository
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
- name: Setup Dart SDK
uses: dart-lang/setup-dart@cb7127289503113089d94a9c7247ada34feeb436
with:
sdk: ${{ matrix.sdk }}
- name: Print Dart version
run: dart --version
- name: Install dependencies
run: dart pub upgrade
- name: Verify formatting
run: dart format --output=none --set-exit-if-changed .
if: matrix.sdk == 'stable'
- name: Analyze all packages
run: |
dart analyze --fatal-infos
find example -type f -name pubspec.yaml -not -path '*/.*' -exec dirname {} \; | while read -r dir; do
echo "Analyzing $dir..."
dart analyze --fatal-infos "$dir"
done
dart analyze --fatal-infos test/fixtures/dart_reference
- name: Run unit tests
run: dart test --exclude-tags=snapshot,integration,e2e
# Builder tests - generate and display functions.yaml
builder-tests:
name: Builder Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
- name: Setup Dart SDK
uses: dart-lang/setup-dart@cb7127289503113089d94a9c7247ada34feeb436
with:
sdk: stable
- name: Install dependencies (root)
run: dart pub upgrade
- name: Install dependencies (fixture)
working-directory: test/fixtures/dart_reference
run: dart pub upgrade
- name: Run build_runner
working-directory: test/fixtures/dart_reference
run: dart run build_runner build --delete-conflicting-outputs
- name: Verify functions.yaml was generated
run: |
if [ ! -f "test/fixtures/dart_reference/functions.yaml" ]; then
echo "Error: functions.yaml was not generated"
exit 1
fi
echo "✓ functions.yaml generated successfully"
- name: Display generated manifest
run: |
echo "Generated Dart manifest:"
cat test/fixtures/dart_reference/functions.yaml
- name: Upload generated manifest
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: dart-manifest
path: test/fixtures/dart_reference/functions.yaml
retention-days: 7
# Snapshot tests - compare Dart manifest with Node.js reference
snapshot-tests:
name: Snapshot Tests
runs-on: ubuntu-latest
needs: builder-tests
steps:
- name: Checkout repository
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
- name: Setup Dart SDK
uses: dart-lang/setup-dart@cb7127289503113089d94a9c7247ada34feeb436
with:
sdk: stable
- name: Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: test/fixtures/nodejs_reference/package-lock.json
- name: Install Dart dependencies
run: dart pub upgrade
- name: Download Dart manifest from builder-tests
uses: actions/download-artifact@484a0b528fb4d7bd804637ccb632e47a0e638317
with:
name: dart-manifest
path: test/fixtures/dart_reference
- name: Install Node.js dependencies (nodejs_reference)
working-directory: test/fixtures/nodejs_reference
run: npm ci
- name: Generate Node.js manifest
run: bash tool/run_snapshot_server.sh
- name: Display all manifests
run: |
echo "========== DART MANIFEST =========="
cat test/fixtures/dart_reference/functions.yaml
echo ""
echo "========== NODE.JS MANIFEST =========="
cat test/fixtures/nodejs_reference/nodejs_manifest.json
- name: Run snapshot comparison tests
run: dart test test/snapshots/manifest_snapshot_test.dart --reporter=expanded
- name: Upload manifests on failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: manifests-comparison
path: |
test/fixtures/dart_reference/functions.yaml
test/fixtures/nodejs_reference/nodejs_manifest.json
retention-days: 30
# E2E tests with Firebase Emulator
e2e-tests:
name: E2E Tests (Emulator)
runs-on: ubuntu-latest
needs: builder-tests
steps:
- name: Checkout repository
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
- name: Setup Dart SDK
uses: dart-lang/setup-dart@cb7127289503113089d94a9c7247ada34feeb436
with:
sdk: stable
- name: Setup Java 21
uses: actions/setup-java@b622de1dfa918ecc0ab28f40cd42e3c3752cd6c5
with:
distribution: temurin
java-version: '21'
- name: Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
with:
node-version: '20'
- name: Install firebase-tools
run: npm install -g firebase-tools
- name: Verify Firebase CLI
run: firebase --version
- name: Install dependencies (root)
run: dart pub upgrade
- name: Download Dart manifest from builder-tests
uses: actions/download-artifact@484a0b528fb4d7bd804637ccb632e47a0e638317
with:
name: dart-manifest
path: test/fixtures/dart_reference
- name: Create .env.local for params
run: |
cat > test/fixtures/dart_reference/.env.local << 'EOF'
WELCOME_MESSAGE=Hello from Dart Functions!
MIN_INSTANCES=0
IS_PRODUCTION=false
EOF
echo "✓ Created .env.local with default param values"
- name: Run E2E tests
run: dart test test/e2e/e2e_test.dart --reporter=expanded
timeout-minutes: 5
- name: Upload test logs on failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: e2e-test-logs
path: |
test/fixtures/dart_reference/functions.yaml
test/fixtures/dart_reference/firebase-debug.log
retention-days: 7
# Test result summary
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [check-license-header, lint-analyze, builder-tests, snapshot-tests, e2e-tests]
if: always()
steps:
- name: Check test results
run: |
results='${{ toJSON(needs) }}'
failed_jobs=$(echo "$results" | jq -r 'to_entries[] | select(.value.result != "success") | .key')
if [ -n "$failed_jobs" ]; then
echo "❌ The following jobs did not succeed:"
echo "$failed_jobs" | sed 's/^/- /'
exit 1
else
echo "✅ All tests passed!"
fi