From 07110320804214bf57bc33aa4befe8820f81c5e2 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Mon, 20 Jan 2025 18:42:03 +0000 Subject: [PATCH 01/31] (revert me) delete existing workflows for convenience while developing --- .github/workflows/api-information.yml | 31 --- .github/workflows/build-release-artifacts.yml | 47 ---- .github/workflows/changelog.yml | 29 -- .github/workflows/check-head-dependencies.yml | 22 -- .../workflows/check-vertexai-responses.yml | 40 --- .github/workflows/check_format.yml | 73 ----- .github/workflows/ci_tests.yml | 177 ------------ .github/workflows/config-e2e.yml | 42 --- .github/workflows/copyright-check.yml | 27 -- .github/workflows/create_releases.yml | 50 ---- .github/workflows/dataconnect_demo_app.yml | 164 ----------- .github/workflows/diff-javadoc.yml | 64 ----- .github/workflows/fireci.yml | 27 -- .github/workflows/fireperf-e2e.yml | 107 ------- .github/workflows/firestore_ci_tests.yml | 261 ------------------ .github/workflows/health-metrics.yml | 134 --------- .github/workflows/jekyll-gh-pages.yml | 55 ---- .github/workflows/make-bom.yml | 39 --- .github/workflows/merge-to-main.yml | 30 -- .github/workflows/plugins-check.yml | 32 --- .github/workflows/post_release_cleanup.yml | 46 --- .github/workflows/private-mirror-sync.yml | 30 -- .github/workflows/release-note-changes.yml | 67 ----- .github/workflows/scorecards.yml | 86 ------ .github/workflows/semver-check.yml | 22 -- .github/workflows/sessions-e2e.yml | 42 --- .github/workflows/smoke-tests.yml | 60 ---- .../workflows/update-cpp-sdk-on-release.yml | 75 ----- .github/workflows/validate-dependencies.yml | 22 -- .github/workflows/version-check.yml | 22 -- 30 files changed, 1923 deletions(-) delete mode 100644 .github/workflows/api-information.yml delete mode 100644 .github/workflows/build-release-artifacts.yml delete mode 100644 .github/workflows/changelog.yml delete mode 100644 .github/workflows/check-head-dependencies.yml delete mode 100644 .github/workflows/check-vertexai-responses.yml delete mode 100644 .github/workflows/check_format.yml delete mode 100644 .github/workflows/ci_tests.yml delete mode 100644 .github/workflows/config-e2e.yml delete mode 100644 .github/workflows/copyright-check.yml delete mode 100644 .github/workflows/create_releases.yml delete mode 100644 .github/workflows/dataconnect_demo_app.yml delete mode 100644 .github/workflows/diff-javadoc.yml delete mode 100644 .github/workflows/fireci.yml delete mode 100644 .github/workflows/fireperf-e2e.yml delete mode 100644 .github/workflows/firestore_ci_tests.yml delete mode 100644 .github/workflows/health-metrics.yml delete mode 100644 .github/workflows/jekyll-gh-pages.yml delete mode 100644 .github/workflows/make-bom.yml delete mode 100644 .github/workflows/merge-to-main.yml delete mode 100644 .github/workflows/plugins-check.yml delete mode 100644 .github/workflows/post_release_cleanup.yml delete mode 100644 .github/workflows/private-mirror-sync.yml delete mode 100644 .github/workflows/release-note-changes.yml delete mode 100644 .github/workflows/scorecards.yml delete mode 100644 .github/workflows/semver-check.yml delete mode 100644 .github/workflows/sessions-e2e.yml delete mode 100644 .github/workflows/smoke-tests.yml delete mode 100644 .github/workflows/update-cpp-sdk-on-release.yml delete mode 100644 .github/workflows/validate-dependencies.yml delete mode 100644 .github/workflows/version-check.yml diff --git a/.github/workflows/api-information.yml b/.github/workflows/api-information.yml deleted file mode 100644 index f0f1c57d650..00000000000 --- a/.github/workflows/api-information.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: API Information - -on: [ pull_request ] - -jobs: - api-information-check: - if: github.event.pull_request.head.repo.full_name == github.repository - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 2 - submodules: true - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - name: Set up Python 3.10 - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 - with: - python-version: '3.10' - - name: Set up fireci - run: pip3 install -e ci/fireci - - name: Run api-information check - run: | - fireci api_information \ - --issue_number=${{ github.event.pull_request.number }} \ - --repo_name=${{ github.repository }} \ - --auth_token=${{ secrets.GOOGLE_OSS_BOT_TOKEN }} diff --git a/.github/workflows/build-release-artifacts.yml b/.github/workflows/build-release-artifacts.yml deleted file mode 100644 index 313226dce97..00000000000 --- a/.github/workflows/build-release-artifacts.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Build Release Artifacts - -on: - workflow_dispatch: - pull_request: - branches: - - 'releases/**' - -jobs: - build-artifacts: - runs-on: ubuntu-latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v4.1.1 - - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - - name: Perform gradle build - run: | - ./gradlew firebasePublish - - - name: Upload m2 repo - uses: actions/upload-artifact@v4.3.3 - with: - name: m2repository - path: build/m2repository/ - retention-days: 15 - - - name: Upload release notes - uses: actions/upload-artifact@v4.3.3 - with: - name: release_notes - path: build/release-notes/ - retention-days: 15 - - - name: Upload kotlindocs - uses: actions/upload-artifact@v4.3.3 - with: - name: kotlindocs - path: build/firebase-kotlindoc/ - retention-days: 15 diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml deleted file mode 100644 index 7937f67acd5..00000000000 --- a/.github/workflows/changelog.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Verify changelog update - -on: - pull_request - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} - cancel-in-progress: true - -jobs: - changelog-check: - runs-on: ubuntu-22.04 - env: - BUNDLE_GEMFILE: ./ci/danger/Gemfile - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 100 - submodules: true - - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7' - - name: Setup Bundler - run: ./ci/danger/setup_bundler.sh - - name: Danger CHANGELOG verifier - env: - DANGER_GITHUB_API_TOKEN: ${{ secrets.GOOGLE_OSS_BOT_TOKEN }} - run: - '[ ! -z $DANGER_GITHUB_API_TOKEN ] && bundle exec danger --dangerfile=./ci/danger/Dangerfile || echo "Skipping Danger for External Contributor"' diff --git a/.github/workflows/check-head-dependencies.yml b/.github/workflows/check-head-dependencies.yml deleted file mode 100644 index 088724bf1d4..00000000000 --- a/.github/workflows/check-head-dependencies.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Check Head Dependencies - -on: - workflow_dispatch: - pull_request: - branches: - - 'releases/**' - -jobs: - check-head-dependencies: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.1 - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - name: Perform gradle build - run: | - ./gradlew checkHeadDependencies diff --git a/.github/workflows/check-vertexai-responses.yml b/.github/workflows/check-vertexai-responses.yml deleted file mode 100644 index 482254c553d..00000000000 --- a/.github/workflows/check-vertexai-responses.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Check Vertex AI Responses - -on: pull_request - -jobs: - check-version: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Clone mock responses - run: firebase-vertexai/update_responses.sh - - name: Find cloned and latest versions - run: | - CLONED=$(git describe --tags) - LATEST=$(git tag --sort=v:refname | tail -n1) - echo "cloned_tag=$CLONED" >> $GITHUB_ENV - echo "latest_tag=$LATEST" >> $GITHUB_ENV - working-directory: firebase-vertexai/src/test/resources/vertexai-sdk-test-data - - name: Find comment from previous run if exists - uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e - id: fc - with: - issue-number: ${{github.event.number}} - body-includes: Vertex AI Mock Responses Check - - name: Comment on PR if newer version is available - if: ${{env.cloned_tag != env.latest_tag && !steps.fc.outputs.comment-id}} - uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 - with: - issue-number: ${{github.event.number}} - body: > - ### Vertex AI Mock Responses Check :warning: - - A newer major version of the mock responses for Vertex AI unit tests is available. - [update_responses.sh](https://github.com/firebase/firebase-android-sdk/blob/main/firebase-vertexai/update_responses.sh) - should be updated to clone the latest version of the responses: `${{env.latest_tag}}` - - name: Delete comment when version gets updated - if: ${{env.cloned_tag == env.latest_tag && steps.fc.outputs.comment-id}} - uses: detomarco/delete-comment@850734dd44d8b15fef55b45252613b903ceb06f0 - with: - comment-id: ${{ steps.fc.outputs.comment-id }} diff --git a/.github/workflows/check_format.yml b/.github/workflows/check_format.yml deleted file mode 100644 index 6bdfb0ea4d1..00000000000 --- a/.github/workflows/check_format.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Check Format -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true -on: - pull_request: - push: - branches: - - main - -jobs: - determine_changed: - name: "Determine changed modules" - runs-on: ubuntu-22.04 - if: (github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || github.event_name == 'pull_request' - outputs: - modules: ${{ steps.changed-modules.outputs.modules }} - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 2 - submodules: true - - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - - id: changed-modules - run: | - git diff --name-only HEAD~1 | xargs printf -- '--changed-git-paths %s\n' | xargs ./gradlew writeChangedProjects --output-file-path=modules.json - echo modules=$(cat modules.json) >> $GITHUB_OUTPUT - - check_format: - name: "Check Format" - runs-on: ubuntu-22.04 - needs: - - determine_changed - strategy: - fail-fast: false - matrix: - module: ${{ fromJSON(needs.determine_changed.outputs.modules) }} - - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 2 - submodules: true - - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - - name: ${{ matrix.module }} Check Format - run: | - ./gradlew ${{matrix.module}}:spotlessCheck - - # A job that fails if any job in the check_format matrix fails, - # to be used as a required check for merging. - check_all: - runs-on: ubuntu-22.04 - if: always() - name: Check Format (matrix) - needs: check_format - steps: - - name: Check matrix - if: needs.check_format.result != 'success' - run: exit 1 diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml deleted file mode 100644 index 52c45abc18b..00000000000 --- a/.github/workflows/ci_tests.yml +++ /dev/null @@ -1,177 +0,0 @@ -name: CI Tests -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true -on: - pull_request: - push: - branches: - - main - -jobs: - determine_changed: - name: "Determine changed modules" - runs-on: ubuntu-22.04 - if: (github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || github.event_name == 'pull_request' - outputs: - modules: ${{ steps.changed-modules.outputs.modules }} - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 2 - submodules: true - - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - - id: changed-modules - run: | - git diff --name-only HEAD~1 | xargs printf -- '--changed-git-paths %s\n' | xargs ./gradlew writeChangedProjects --output-file-path=modules.json - echo modules=$(cat modules.json) >> $GITHUB_OUTPUT - - unit_tests: - name: "Unit Tests" - runs-on: ubuntu-22.04 - needs: - - determine_changed - strategy: - fail-fast: false - matrix: - module: ${{ fromJSON(needs.determine_changed.outputs.modules) }} - - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 2 - submodules: true - - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - - name: Pull genai-common - if: matrix.module == ':firebase-vertexai' - run: | - git clone https://github.com/google-gemini/generative-ai-android.git - cd generative-ai-android - ./gradlew :common:updateVersion common:publishToMavenLocal - cd .. - - - name: Clone mock responses - if: matrix.module == ':firebase-vertexai' - run: | - firebase-vertexai/update_responses.sh - - - name: Add google-services.json - env: - INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.INTEG_TESTS_GOOGLE_SERVICES }} - run: | - echo $INTEG_TESTS_GOOGLE_SERVICES | base64 -d > google-services.json - - - name: ${{ matrix.module }} Unit Tests - env: - FIREBASE_CI: 1 - run: | - ./gradlew ${{matrix.module}}:check withErrorProne - - name: Compute upload file name - run: | - MODULE=${{matrix.module}} - echo "ARTIFACT_NAME=${MODULE//:/_}" >> $GITHUB_ENV - - name: Upload Test Results - uses: actions/upload-artifact@v4.3.3 - if: always() - with: - name: unit-test-result-${{env.ARTIFACT_NAME}} - path: "**/build/test-results/**/*.xml" - retention-days: 7 - if-no-files-found: ignore - - # A job that fails if any job in the unit_tests matrix fails, - # to be used as a required check for merging. - check_all: - runs-on: ubuntu-22.04 - if: always() - name: Unit Tests (matrix) - needs: unit_tests - steps: - - name: Check test matrix - if: needs.unit_tests.result != 'success' - run: exit 1 - - - integ_tests: - name: "Instrumentation Tests" - # only run on post submit or PRs not originating from forks. - if: (github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) - runs-on: ubuntu-22.04 - needs: - - determine_changed - strategy: - fail-fast: false - matrix: - module: ${{ fromJSON(needs.determine_changed.outputs.modules) }} - exclude: - - module: :firebase-firestore - - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 2 - submodules: true - - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - - name: Add google-services.json - env: - INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.INTEG_TESTS_GOOGLE_SERVICES }} - run: | - echo $INTEG_TESTS_GOOGLE_SERVICES | base64 -d > google-services.json - - uses: google-github-actions/auth@v2 - with: - credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} - - uses: google-github-actions/setup-gcloud@v2 - - name: ${{ matrix.module }} Integ Tests - env: - FIREBASE_CI: 1 - FTL_RESULTS_BUCKET: android-ci - FTL_RESULTS_DIR: ${{ github.event_name == 'pull_request' && format('pr-logs/pull/{0}/{1}/{2}/{3}_{4}/artifacts/', github.repository, github.event.pull_request.number, github.job, github.run_id, github.run_attempt) || format('logs/{0}/{1}_{2}/artifacts/', github.workflow, github.run_id, github.run_attempt)}} - FIREBASE_APP_CHECK_DEBUG_SECRET: ${{ secrets.FIREBASE_APP_CHECK_DEBUG_SECRET }} - run: | - ./gradlew ${{matrix.module}}:deviceCheck withErrorProne -PtargetBackend="prod" - - publish-test-results: - name: "Publish Tests Results" - needs: - - unit_tests - runs-on: ubuntu-22.04 - - permissions: - checks: write - - # only needed unless run with comment_mode: off - pull-requests: write - - if: always() - - steps: - - name: Download Artifacts - uses: actions/download-artifact@v4.1.7 - with: - path: artifacts - - - name: Publish Test Results - uses: EnricoMi/publish-unit-test-result-action@82082dac68ad6a19d980f8ce817e108b9f496c2a - with: - files: "artifacts/**/*.xml" diff --git a/.github/workflows/config-e2e.yml b/.github/workflows/config-e2e.yml deleted file mode 100644 index 604115b324d..00000000000 --- a/.github/workflows/config-e2e.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Firebase Remote Config E2E Tests - -on: - schedule: - - cron: 24 */4 * * * # every 4 hours @ 24 minutes past the hour - workflow_dispatch: # allow triggering the workflow manually - -concurrency: - group: ${{ github.workflow }} - -env: - REMOTE_CONFIG_E2E_GOOGLE_SERVICES: ${{ secrets.REMOTE_CONFIG_E2E_GOOGLE_SERVICES }} - -jobs: - test: - - runs-on: ubuntu-latest - - steps: - - name: Checkout firebase-config - uses: actions/checkout@v4.1.1 - - - name: set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: '17' - distribution: 'temurin' - cache: gradle - - - name: Add google-services.json - run: | - echo $REMOTE_CONFIG_E2E_GOOGLE_SERVICES | base64 -d > google-services.json - - - uses: google-github-actions/auth@v2 - with: - credentials_json: ${{ secrets.GCP_service_account }} - - uses: google-github-actions/setup-gcloud@v2 - - name: Run Remote Config end-to-end tests - env: - FTL_RESULTS_BUCKET: fireescape - run: | - ./gradlew :firebase-config:test-app:deviceCheck withErrorProne -PtargetBackend="prod" diff --git a/.github/workflows/copyright-check.yml b/.github/workflows/copyright-check.yml deleted file mode 100644 index b9e3aeba227..00000000000 --- a/.github/workflows/copyright-check.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Copyright check - -on: pull_request - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - copyright-check: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4.1.1 - - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 - with: - python-version: '3.9' - - run: | - pip install -e "ci/fireci" - - run: | - fireci copyright_check \ - -e py \ - -e gradle \ - -e java \ - -e kt \ - -e groovy \ - -e sh \ - -e proto diff --git a/.github/workflows/create_releases.yml b/.github/workflows/create_releases.yml deleted file mode 100644 index 8920ee50d09..00000000000 --- a/.github/workflows/create_releases.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Create release - -on: - workflow_dispatch: - inputs: - name: - description: 'Release name' - required: true - type: string - past-name: - description: 'Past release name' - required: true - type: string - -jobs: - create-branches: - runs-on: ubuntu-latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - name: Create base branch - uses: peterjgrainger/action-create-branch@08259812c8ebdbf1973747f9297e332fa078d3c1 - with: - branch: 'releases/${{ inputs.name }}' - - create-pull-request: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 0 - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - name: Create release configuration template - run: | - ./gradlew generateReleaseConfig -PcurrentRelease=${{ inputs.name }} -PpastRelease=${{ inputs.past-name }} -PprintOutput=true - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 - with: - base: 'releases/${{ inputs.name }}' - branch: 'releases/${{ inputs.name }}.release' - add-paths: release.json,release_report.md,release_report.json - title: '${{ inputs.name}} release' - body: 'Auto-generated PR for release ${{ inputs.name}}' - commit-message: 'Create release config for ${{ inputs.name }}' diff --git a/.github/workflows/dataconnect_demo_app.yml b/.github/workflows/dataconnect_demo_app.yml deleted file mode 100644 index 7ce51814b4d..00000000000 --- a/.github/workflows/dataconnect_demo_app.yml +++ /dev/null @@ -1,164 +0,0 @@ -name: Data Connect Demo App - -on: - workflow_dispatch: - inputs: - nodeVersion: - firebaseToolsVersion: - javaVersion: - gradleInfoLog: - type: boolean - pull_request: - paths: - - firebase-dataconnect/demo/** - - .github/workflows/dataconnect_demo_app.yml - schedule: - - cron: '0 11 * * *' # Run nightly at 11am UTC (3am Pacific, 6am Eastern) - -env: - FDC_NODE_VERSION: ${{ inputs.nodeVersion || '20' }} - FDC_FIREBASE_TOOLS_VERSION: ${{ inputs.firebaseToolsVersion || '13.28.0' }} - FDC_JAVA_VERSION: ${{ inputs.javaVersion || '17' }} - FDC_FIREBASE_TOOLS_DIR: ${{ github.workspace }}/firebase-tools - FDC_FIREBASE_COMMAND: ${{ github.workspace }}/firebase-tools/node_modules/.bin/firebase - -defaults: - run: - shell: bash - working-directory: firebase-dataconnect/demo - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - test: - continue-on-error: false - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - sparse-checkout: firebase-dataconnect/demo - - - name: Create Cache Key Files - run: | - echo "gmagjr2b9d" >github_actions_demo_test_cache_key.txt - echo "${{ env.FDC_FIREBASE_TOOLS_VERSION }}" >github_actions_demo_assemble_firebase_tools_version.txt - - - uses: actions/setup-node@v3 - with: - node-version: ${{ env.FDC_NODE_VERSION }} - cache: 'npm' - cache-dependency-path: | - firebase-dataconnect/demo/github_actions_demo_test_cache_key.txt - firebase-dataconnect/demo/github_actions_demo_assemble_firebase_tools_version.txt - - - name: cache package-lock.json - id: package_json_lock - uses: actions/cache@v4 - with: - path: ${{ env.FDC_FIREBASE_TOOLS_DIR }}/package*.json - key: firebase_tools_package_json-${{ env.FDC_FIREBASE_TOOLS_VERSION }} - - - name: install firebase-tools from scratch - if: steps.package_json_lock.outputs.cache-hit != 'true' - run: | - set -v - mkdir -p ${{ env.FDC_FIREBASE_TOOLS_DIR }} - cd ${{ env.FDC_FIREBASE_TOOLS_DIR }} - echo '{}' > package.json - npm install --fund=false --audit=false --save --save-exact firebase-tools@${{ env.FDC_FIREBASE_TOOLS_VERSION }} - - - name: install firebase-tools from package-lock.json - if: steps.package_json_lock.outputs.cache-hit == 'true' - run: | - cd ${{ env.FDC_FIREBASE_TOOLS_DIR }} - npm ci --fund=false --audit=false - - - uses: actions/setup-java@v4 - with: - java-version: ${{ env.FDC_JAVA_VERSION }} - distribution: temurin - cache: gradle - cache-dependency-path: | - firebase-dataconnect/demo/build.gradle.kts - firebase-dataconnect/demo/gradle.properties - firebase-dataconnect/demo/gradle/wrapper/gradle-wrapper.properties - firebase-dataconnect/demo/github_actions_demo_test_cache_key.txt - - - name: tool versions - continue-on-error: true - run: | - set +e -v - which java - java -version - which javac - javac -version - which node - node --version - ${{ env.FDC_FIREBASE_COMMAND }} --version - ./gradlew --version - - - name: ./gradlew assemble test - run: | - set -x - ./gradlew \ - --no-daemon \ - ${{ (inputs.gradleInfoLog && '--info') || '' }} \ - --profile \ - -PdataConnect.minimalApp.firebaseCommand=${{ env.FDC_FIREBASE_COMMAND }} \ - assemble test - - - uses: actions/upload-artifact@v4 - with: - name: apks - path: firebase-dataconnect/demo/build/**/*.apk - if-no-files-found: warn - compression-level: 0 - - - uses: actions/upload-artifact@v4 - with: - name: gradle_build_reports - path: firebase-dataconnect/demo/build/reports/ - if-no-files-found: warn - compression-level: 9 - - spotlessCheck: - continue-on-error: false - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - sparse-checkout: firebase-dataconnect/demo - - - name: Create Cache Key Files - run: echo "h99ee4egfd" >github_actions_demo_spotless_cache_key.txt - - - uses: actions/setup-java@v4 - with: - java-version: ${{ env.FDC_JAVA_VERSION }} - distribution: temurin - cache: gradle - cache-dependency-path: | - firebase-dataconnect/demo/build.gradle.kts - firebase-dataconnect/demo/gradle.properties - firebase-dataconnect/demo/gradle/wrapper/gradle-wrapper.properties - firebase-dataconnect/demo/github_actions_demo_spotless_cache_key.txt - - - name: tool versions - continue-on-error: true - run: | - set +e -v - which java - java -version - which javac - javac -version - ./gradlew --version - - - name: ./gradlew spotlessCheck - run: | - set -x - ./gradlew \ - --no-daemon \ - ${{ (inputs.gradleInfoLog && '--info') || '' }} \ - spotlessCheck diff --git a/.github/workflows/diff-javadoc.yml b/.github/workflows/diff-javadoc.yml deleted file mode 100644 index c780e07c714..00000000000 --- a/.github/workflows/diff-javadoc.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: Diff Javadoc - -on: - pull_request: - -jobs: - build: - runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: - - name: Make diff directory - run: mkdir ~/diff - - - name: Checkout PR branch - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 2 - submodules: true - - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - - name: Generate docs for PR branch - run: ./gradlew kotlindoc - - - name: Move branch docs to diff directory - run: mv build ~/diff/modified - - - name: Checkout main - uses: actions/checkout@v4.1.1 - with: - ref: ${{ github.base_ref }} - - - name: Generate docs for main - run: ./gradlew kotlindoc - - - name: Move main docs to diff directory - run: mv build ~/diff/original - - - name: Get diff between main and Branch docs - run: > - `# Recursively diff directories, including new files, git style, with 3 lines of context` - diff -wEburN ~/diff/original ~/diff/modified - `# Remove the first line and new file signifier of the output` - | tail -n +2 - `# Replace the diff new file signifier with the end and start of a new codeblock` - | sed "s/^diff.*$/\`\`\`\\n\`\`\`diff/g" - `# Add a collapsable block, summary, and start the first code block on the first line` - | sed "1s/^/
\\nJavadoc Changes:<\/summary>\\n\\n\`\`\`diff\\n/" - `# Close the final code block and close the collapsable on the final line` - | sed "$ s/$/\\n\`\`\`\\n<\/details>/" - `# Write to diff.md for later` - > diff.md - - - name: Add comment - continue-on-error: true - uses: mshick/add-pr-comment@a65df5f64fc741e91c59b8359a4bc56e57aaf5b1 - with: - message-path: diff.md diff --git a/.github/workflows/fireci.yml b/.github/workflows/fireci.yml deleted file mode 100644 index b375d6bb93d..00000000000 --- a/.github/workflows/fireci.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Run fireci tests - -on: - pull_request: - paths: - - 'ci/**' - - '.github/workflows/fireci.yml' - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - fireci: - name: "fireci tests" - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4.1.1 - - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 - with: - python-version: '3.8' - - run: | - pip install -e "ci/fireci[test]" - - run: | - pytest ci/fireci - - run: | - mypy --config-file ci/fireci/setup.cfg ci/fireci/ diff --git a/.github/workflows/fireperf-e2e.yml b/.github/workflows/fireperf-e2e.yml deleted file mode 100644 index 9299ba57000..00000000000 --- a/.github/workflows/fireperf-e2e.yml +++ /dev/null @@ -1,107 +0,0 @@ -name: FirePerf E2E Tests - -on: - schedule: - - cron: 4 */4 * * * # every 4 hours at 04 minutes past the hour - workflow_dispatch: # allow triggering the workflow manually - -concurrency: - group: ${{ github.workflow }} - -env: - PERF_E2E_GOOGLE_SERVICES: ${{ secrets.PERF_E2E_GOOGLE_SERVICES }} - FTL_RESULTS_BUCKET: fireescape - -jobs: - test: - runs-on: ubuntu-latest - strategy: - matrix: - environment: [ prod, autopush ] - steps: - - name: Checkout firebase-android-sdk - uses: actions/checkout@v4.1.1 - - name: Checkout firebase-android-buildtools - uses: actions/checkout@v4.1.1 - with: - repository: FirebasePrivate/firebase-android-buildtools - token: ${{ secrets.GOOGLE_OSS_BOT_TOKEN }} - path: firebase-android-buildtools - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - name: Set up Python 3.10 - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 - with: - python-version: '3.10' - - name: Set up fireci - run: pip3 install -e ci/fireci - - uses: google-github-actions/auth@v2 - with: - credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} - - uses: google-github-actions/setup-gcloud@v2 - - name: Add google-services.json - run: echo $PERF_E2E_GOOGLE_SERVICES | base64 -d > google-services.json - - name: Run fireperf end-to-end tests - run: | - fireci fireperf_e2e_test \ - --plugin_repo_dir=firebase-android-buildtools \ - --target_environment=${{ matrix.environment }} - - name: Notify developers upon failures - if: ${{ failure() }} - uses: actions/github-script@v6 - with: - script: | - const owner = context.repo.owner; - const repo = context.repo.repo; - const commit = context.sha; - const run = context.runId; - const url = `https://github.com/${owner}/${repo}/actions/runs/${run}`; - - const datetime = (new Date()).toLocaleString('en-US', { - timeZone: 'America/Los_Angeles', - dateStyle: 'medium', - timeStyle: 'long', - }); - - const text = - `Failed on commit ${commit} at ${datetime}. - - ${url}`; - - const { data: issues } = await github.rest.issues.listForRepo({ - owner: owner, - repo: repo, - state: 'open', - labels: 'fireperf-e2e-tests' - }); - - if (issues.length) { - github.rest.issues.createComment({ - owner: owner, - repo: repo, - issue_number: issues[0].number, - body: text, - }); - } else { - github.rest.issues.create({ - owner: owner, - repo: repo, - title: 'FirePerf E2E Test Failures', - body: text, - labels: ['fireperf-e2e-tests'], - assignees: ['raymondlam', 'visumickey'] - }); - } - - name: Upload test artifacts - if: always() - uses: actions/upload-artifact@v4.3.3 - with: - name: test-artifacts (${{ matrix.environment }}) - path: | - ~/.m2/repository/com/google/firebase/perf-plugin - **/build/reports - **/build/test-results diff --git a/.github/workflows/firestore_ci_tests.yml b/.github/workflows/firestore_ci_tests.yml deleted file mode 100644 index 00ce91b4e92..00000000000 --- a/.github/workflows/firestore_ci_tests.yml +++ /dev/null @@ -1,261 +0,0 @@ -name: Firestore CI Tests -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true -on: - pull_request: - push: - branches: - - main - -jobs: - determine_changed: - name: "Determine changed modules" - runs-on: ubuntu-latest - if: (github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || github.event_name == 'pull_request' - outputs: - modules: ${{ steps.changed-modules.outputs.modules }} - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 2 - submodules: true - - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - - id: changed-modules - run: | - git diff --name-only HEAD~1 | xargs printf -- '--changed-git-paths %s\n' | xargs ./gradlew writeChangedProjects --output-file-path=modules.json - echo modules=$(cat modules.json) >> $GITHUB_OUTPUT - - integ_tests: - name: "System Tests" - # only run on post submit or PRs not originating from forks. - if: ((github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)) && contains(fromJSON(needs.determine_changed.outputs.modules), ':firebase-firestore') - runs-on: ubuntu-latest - needs: - - determine_changed - strategy: - fail-fast: false - - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 2 - submodules: true - - - name: Enable KVM - run: | - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules - sudo udevadm control --reload-rules - sudo udevadm trigger --name-match=kvm - - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - - name: Add google-services.json - env: - INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.INTEG_TESTS_GOOGLE_SERVICES }} - run: | - echo $INTEG_TESTS_GOOGLE_SERVICES | base64 -d > google-services.json - - uses: google-github-actions/auth@v2 - with: - credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} - - uses: google-github-actions/setup-gcloud@v2 - - name: firebase-firestore Integ Tests - uses: reactivecircus/android-emulator-runner@v2 - env: - FIREBASE_CI: 1 - FTL_RESULTS_BUCKET: android-ci - FTL_RESULTS_DIR: ${{ github.event_name == 'pull_request' && format('pr-logs/pull/{0}/{1}/{2}/{3}_{4}/artifacts/', github.repository, github.event.pull_request.number, github.job, github.run_id, github.run_attempt) || format('logs/{0}/{1}_{2}/artifacts/', github.workflow, github.run_id, github.run_attempt)}} - FIREBASE_APP_CHECK_DEBUG_SECRET: ${{ secrets.FIREBASE_APP_CHECK_DEBUG_SECRET }} - with: - api-level: 31 - arch: x86_64 - ram-size: 4096M - heap-size: 4096M - script: | - adb logcat -v time > logcat.txt & - ./gradlew firebase-firestore:connectedCheck withErrorProne -PtargetBackend="prod" - - name: Upload logs - if: failure() - uses: actions/upload-artifact@v4.3.3 - with: - name: logcat.txt - path: logcat.txt - retention-days: 7 - if-no-files-found: ignore - - - named_integ_tests: - name: "System Tests With Named DB" - runs-on: ubuntu-latest - needs: - - determine_changed - # only run on post submit or PRs not originating from forks. - if: ((github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)) && contains(fromJSON(needs.determine_changed.outputs.modules), ':firebase-firestore') - strategy: - fail-fast: false - - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 2 - submodules: true - - - name: Enable KVM - run: | - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules - sudo udevadm control --reload-rules - sudo udevadm trigger --name-match=kvm - - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - - name: Add google-services.json - env: - INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.INTEG_TESTS_GOOGLE_SERVICES }} - run: | - echo $INTEG_TESTS_GOOGLE_SERVICES | base64 -d > google-services.json - - uses: google-github-actions/auth@v2 - with: - credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} - - uses: google-github-actions/setup-gcloud@v2 - - # create composite indexes with Terraform - - name: Setup Terraform - uses: hashicorp/setup-terraform@v2 - - name: Terraform Init - run: | - cd firebase-firestore - terraform init - continue-on-error: true - - name: Terraform Apply - if: github.event_name == 'pull_request' - run: | - cd firebase-firestore - - # Define a temporary file, redirect both stdout and stderr to the file - output_file=$(mktemp) - if ! terraform apply -var-file=../google-services.json -auto-approve > "$output_file" 2>&1 ; then - cat "$output_file" - if cat "$output_file" | grep -q "index already exists"; then - echo "===================================================================================" - echo -e "\e[93m\e[1mTerraform apply failed due to index already exists; We can safely ignore this error.\e[0m" - echo "===================================================================================" - fi - exit 1 - fi - rm -f "$output_file" - continue-on-error: true - - - name: Firestore Named DB Integ Tests - timeout-minutes: 20 - uses: reactivecircus/android-emulator-runner@v2 - env: - FIREBASE_CI: 1 - FTL_RESULTS_BUCKET: android-ci - FTL_RESULTS_DIR: ${{ github.event_name == 'pull_request' && format('pr-logs/pull/{0}/{1}/{2}/{3}_{4}/artifacts/', github.repository, github.event.pull_request.number, github.job, github.run_id, github.run_attempt) || format('logs/{0}/{1}_{2}/artifacts/', github.workflow, github.run_id, github.run_attempt)}} - FIREBASE_APP_CHECK_DEBUG_SECRET: ${{ secrets.FIREBASE_APP_CHECK_DEBUG_SECRET }} - with: - api-level: 31 - arch: x86_64 - ram-size: 4096M - heap-size: 4096M - script: | - adb logcat -v time > logcat.txt & - ./gradlew firebase-firestore:connectedCheck withErrorProne -PtargetBackend="prod" - - name: Upload logs - if: failure() - uses: actions/upload-artifact@v4.3.3 - with: - name: named-db-logcat.txt - path: logcat.txt - retention-days: 7 - if-no-files-found: ignore - - firestore_nightly_integ_tests: - name: "System Tests Against Nightly" - runs-on: ubuntu-latest - needs: - - determine_changed - # only run on post submit or PRs not originating from forks. - if: ((github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)) && contains(fromJSON(needs.determine_changed.outputs.modules), ':firebase-firestore') - strategy: - fail-fast: false - - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 2 - submodules: true - - - name: Enable KVM - run: | - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules - sudo udevadm control --reload-rules - sudo udevadm trigger --name-match=kvm - - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - - name: Add google-services.json - env: - INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.NIGHTLY_INTEG_TESTS_GOOGLE_SERVICES }} - run: | - echo $INTEG_TESTS_GOOGLE_SERVICES > google-services.json - - uses: google-github-actions/auth@v2 - with: - credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} - - uses: google-github-actions/setup-gcloud@v2 - - - name: Firestore Nightly Integ Tests - uses: reactivecircus/android-emulator-runner@v2 - env: - FIREBASE_CI: 1 - FTL_RESULTS_BUCKET: android-ci - FTL_RESULTS_DIR: ${{ github.event_name == 'pull_request' && format('pr-logs/pull/{0}/{1}/{2}/{3}_{4}/artifacts/', github.repository, github.event.pull_request.number, github.job, github.run_id, github.run_attempt) || format('logs/{0}/{1}_{2}/artifacts/', github.workflow, github.run_id, github.run_attempt)}} - FIREBASE_APP_CHECK_DEBUG_SECRET: ${{ secrets.FIREBASE_APP_CHECK_DEBUG_SECRET }} - with: - api-level: 31 - arch: x86_64 - ram-size: 4096M - heap-size: 4096M - script: | - adb logcat -v time > logcat.txt & - ./gradlew firebase-firestore:connectedCheck withErrorProne -PtargetBackend="nightly" - - name: Upload logs - if: failure() - uses: actions/upload-artifact@v4.3.3 - with: - name: nightly-logcat.txt - path: logcat.txt - retention-days: 7 - if-no-files-found: ignore - - check-required-tests: - runs-on: ubuntu-latest - if: always() - name: Check all required Firestore tests results - needs: [integ_tests, named_integ_tests] - steps: - - name: Check test matrix - if: needs.integ_tests.result == 'failure' || needs.named_integ_tests.result == 'failure' - run: exit 1 diff --git a/.github/workflows/health-metrics.yml b/.github/workflows/health-metrics.yml deleted file mode 100644 index 0b20dcd1078..00000000000 --- a/.github/workflows/health-metrics.yml +++ /dev/null @@ -1,134 +0,0 @@ -name: Health Metrics - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} - cancel-in-progress: true - -on: - pull_request: - push: - branches: - - main - # add other feature branches here - # TODO(yifany): support workflow_dispatch for metric tests (or only for startup time test) - -env: - GITHUB_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} - -jobs: - coverage: - name: Coverage - if: | - (github.event_name == 'push' && github.repository == 'firebase/firebase-android-sdk') - || (github.event_name == 'pull_request' - && github.event.pull_request.head.repo.full_name == github.repository) - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 2 - submodules: true - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - name: Set up Python 3.10 - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 - with: - python-version: '3.10' - - uses: google-github-actions/auth@v2 - with: - credentials_json: '${{ secrets.GCP_SERVICE_ACCOUNT }}' - - uses: google-github-actions/setup-gcloud@v2 - - name: Set up fireci - run: pip3 install -e ci/fireci - - name: Run coverage tests (presubmit) - if: ${{ github.event_name == 'pull_request' }} - run: fireci coverage --pull-request - - name: Run coverage tests (post-submit) - if: ${{ github.event_name == 'push' }} - run: fireci coverage - - size: - name: Size - if: | - (github.event_name == 'push' && github.repository == 'firebase/firebase-android-sdk') - || (github.event_name == 'pull_request' - && github.event.pull_request.head.repo.full_name == github.repository) - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 2 - submodules: true - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - name: Set up Python 3.10 - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 - with: - python-version: '3.10' - - uses: google-github-actions/auth@v2 - with: - credentials_json: '${{ secrets.GCP_SERVICE_ACCOUNT }}' - - uses: google-github-actions/setup-gcloud@v2 - - name: Set up fireci - run: pip3 install -e ci/fireci - - name: Run size tests (presubmit) - if: ${{ github.event_name == 'pull_request' }} - run: fireci binary_size --pull-request - - name: Run size tests (post-submit) - if: ${{ github.event_name == 'push' }} - run: fireci binary_size - - startup_time: - name: Startup Time - if: | - (github.event_name == 'push' && github.repository == 'firebase/firebase-android-sdk') - || (github.event_name == 'pull_request' - && github.event.pull_request.head.repo.full_name == github.repository - && github.event.pull_request.base.ref == 'main') - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 2 - submodules: true - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - name: Set up Python 3.10 - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 - with: - python-version: '3.10' - - uses: google-github-actions/auth@v2 - with: - credentials_json: '${{ secrets.GCP_SERVICE_ACCOUNT }}' - - uses: google-github-actions/setup-gcloud@v2 - - name: Set up fireci - run: pip3 install -e ci/fireci - - name: Add google-services.json - env: - INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.INTEG_TESTS_GOOGLE_SERVICES }} - BENCHMARK_APP_LOCATION: health-metrics/benchmark/template/app/google-services.json - run: | - echo $INTEG_TESTS_GOOGLE_SERVICES | base64 -d > $BENCHMARK_APP_LOCATION - - name: Run startup-time tests (presubmit) - if: ${{ github.event_name == 'pull_request' }} - run: | - git diff --name-only HEAD~1 | \ - xargs printf -- '--changed-git-paths %s\n' | \ - xargs ./gradlew writeChangedProjects --output-file-path=modules.json - fireci macrobenchmark ci --pull-request --changed-modules-file modules.json - - name: Run startup-time tests (post-submit) - if: ${{ github.event_name == 'push' }} - run: | - fireci macrobenchmark ci --push diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml deleted file mode 100644 index c1683b58de8..00000000000 --- a/.github/workflows/jekyll-gh-pages.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Jekyll with GitHub Pages - -on: - # Runs on pushes targeting the default branch - push: - branches: ["main"] - paths: - - '.github/workflows/jekyll-gh-pages.yml' - - 'contributor-docs/**' - pull_request: - paths: - - '.github/workflows/jekyll-gh-pages.yml' - - 'contributor-docs/**' - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Allow one concurrent deployment -concurrency: - group: "pages" - cancel-in-progress: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 - - name: Setup Pages - uses: actions/configure-pages@v2 - - name: Build with Jekyll - uses: actions/jekyll-build-pages@v1 - with: - source: ./contributor-docs - destination: ./_site - - name: Upload artifact - uses: actions/upload-pages-artifact@v1 - - deploy: - if: ${{ github.event_name == 'push' && github.repository == 'firebase/firebase-android-sdk' }} - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: build - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v1 diff --git a/.github/workflows/make-bom.yml b/.github/workflows/make-bom.yml deleted file mode 100644 index 0ad2ecf4add..00000000000 --- a/.github/workflows/make-bom.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Make BoM - -on: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Set up Python 3.10 - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 - with: - python-version: '3.10' - - uses: actions/checkout@v4.1.1 - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - - name: Build - run: | - ./ci/run.sh \ - --artifact-target-dir=./logs/artifacts \ - --artifact-patterns=bom.zip \ - --artifact-patterns=bomReleaseNotes.md \ - --artifact-patterns=recipeVersionUpdate.txt \ - gradle \ - -- \ - --build-cache \ - buildBomZip - - - name: Upload generated artifacts - uses: actions/upload-artifact@v4.3.3 - with: - name: artifacts - path: ./logs/artifacts/ - retention-days: 5 diff --git a/.github/workflows/merge-to-main.yml b/.github/workflows/merge-to-main.yml deleted file mode 100644 index 4df37c57891..00000000000 --- a/.github/workflows/merge-to-main.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Merge to main - -on: - pull_request: - branches: - - main - types: - - opened - - labeled - - unlabeled - -jobs: - pr-message: - runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: - - uses: mshick/add-pr-comment@a65df5f64fc741e91c59b8359a4bc56e57aaf5b1 - with: - message: > - ### 📝 PRs merging into main branch - - **Our main branch should always be in a releasable state**. - If you are working on a larger change, or if you don't want - this change to see the light of the day just yet, consider - using a feature branch first, and only merge into the main - branch when the code complete and ready to be released. - - - name: Success - run: exit 0 diff --git a/.github/workflows/plugins-check.yml b/.github/workflows/plugins-check.yml deleted file mode 100644 index fa482c36d35..00000000000 --- a/.github/workflows/plugins-check.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Check plugins - -on: - pull_request: - paths: - - 'plugins/**' - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - plugins-check: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4.1.1 - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - name: plugins tests - env: - FIREBASE_CI: 1 - run: | - ./gradlew plugins:check - - name: Publish Test Results - uses: EnricoMi/publish-unit-test-result-action@82082dac68ad6a19d980f8ce817e108b9f496c2a - with: - files: "**/build/test-results/**/*.xml" - check_name: "plugins test results" diff --git a/.github/workflows/post_release_cleanup.yml b/.github/workflows/post_release_cleanup.yml deleted file mode 100644 index 8206b735a11..00000000000 --- a/.github/workflows/post_release_cleanup.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Post release cleanup - -on: - workflow_dispatch: - inputs: - name: - description: 'Release name' - required: true - type: string - -jobs: - create-pull-request: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 0 - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - name: Run post release cleanup task - run: | - ./gradlew postReleaseCleanup - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 - with: - token: ${{ secrets.GOOGLE_OSS_BOT_TOKEN }} - committer: google-oss-bot - assignees: ${{ github.actor }} - base: 'main' - branch: 'releases/${{ inputs.name }}.mergeback' - add-paths: | - **/CHANGELOG.md - **/gradle.properties - **/*.gradle - **/*.gradle.kts - title: '${{ inputs.name}} mergeback' - body: | - Auto-generated PR for cleaning up release ${{ inputs.name}} - - NO_RELEASE_CHANGE - commit-message: 'Post release cleanup for ${{ inputs.name }}' diff --git a/.github/workflows/private-mirror-sync.yml b/.github/workflows/private-mirror-sync.yml deleted file mode 100644 index 324993eb791..00000000000 --- a/.github/workflows/private-mirror-sync.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Private Mirror Sync - -on: - workflow_dispatch: - schedule: - - cron: '0 2 * * *' - -jobs: - sync: - if: github.repository == 'FirebasePrivate/firebase-android-sdk' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.1 - with: - repository: firebase/firebase-android-sdk - ref: main - fetch-depth: 0 - submodules: true - - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 0 - submodules: true - token: ${{ secrets.GOOGLE_OSS_BOT_TOKEN }} - - name: Force push HEAD to private repo main branch - run: | - git config --local user.name google-oss-bot - git config --local user.email firebase-oss-bot@google.com - git remote add mirror https://github.com/FirebasePrivate/firebase-android-sdk.git - git push mirror HEAD:main --force --verbose diff --git a/.github/workflows/release-note-changes.yml b/.github/workflows/release-note-changes.yml deleted file mode 100644 index 06d42153ea4..00000000000 --- a/.github/workflows/release-note-changes.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Release note changes - -on: - pull_request: - branches: - - 'main' - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 0 - - - name: Create output file - run: touch changelog_comment.md - - - name: Get changed changelog files - id: changed-files - uses: tj-actions/changed-files@v41.0.0 - with: - files_ignore: | - plugins/** - files: | - **/CHANGELOG.md - - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - - name: Set up Python 3.10 - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 - if: ${{ steps.changed-files.outputs.any_changed == 'true' }} - with: - python-version: '3.10' - - - name: Set up fireci - id: install-fireci - if: ${{ steps.changed-files.outputs.any_changed == 'true' }} - run: pip3 install -e ci/fireci - - - name: Generate comment - id: generate-comment - if: ${{ steps.install-fireci.outcome == 'success' }} - run: | - fireci changelog_comment -c "${{ steps.changed-files.outputs.all_changed_files }}" -o ./changelog_comment.md - - - name: Add PR Comment - uses: mshick/add-pr-comment@v2.8.1 - continue-on-error: true - with: - status: ${{ steps.generate-comment.outcome }} - message-path: ./changelog_comment.md - message-skipped: | - ## Release note changes - No release note changes were detected. If you made changes that should be - present in the next release, ensure you've added an entry in the appropriate - `CHANGELOG.md` file(s). - message-failure: | - ## Release note changes - A `CHANGELOG.md` file seems to not match the expected format. - Please ensure your changelog files are following the format as - defined in [our documentation](#). diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml deleted file mode 100644 index 22bd7f8e3c2..00000000000 --- a/.github/workflows/scorecards.yml +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright 2023 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. - -# Workflow for the OSSF Scorecards Action -# https://github.com/ossf/scorecard-action#installation - -name: Scorecard supply-chain security -on: - # For Branch-Protection check. Only the default branch is supported. See - # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection - branch_protection_rule: - # To guarantee Maintained check is occasionally updated. See - # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained - schedule: - - cron: '35 10 * * 4' - push: - branches: - - main - -# Declare default permissions as read only. -permissions: read-all - -jobs: - analysis: - name: OpenSSF Scorecard analysis - runs-on: ubuntu-latest - permissions: - # Needed to upload the results to code-scanning dashboard. - security-events: write - # Needed to publish results and get a badge (see publish_results below). - id-token: write - # Uncomment the permissions below if installing in a private repository. - # contents: read - # actions: read - - steps: - - name: Checkout code - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 - with: - persist-credentials: false - - - name: Run analysis - uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 - with: - results_file: results.sarif - results_format: sarif - # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: - # - you want to enable the Branch-Protection check on a *public* repository, or - # - you are installing Scorecard on a *private* repository - # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. - # repo_token: ${{ secrets.SCORECARD_TOKEN }} - - # Public repositories: - # - Publish results to OpenSSF REST API for easy access by consumers - # - Allows the repository to include the Scorecard badge. - # - See https://github.com/ossf/scorecard-action#publishing-results. - # For private repositories: - # - `publish_results` will always be set to `false`, regardless - # of the value entered here. - publish_results: true - - # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF - # format to the repository Actions tab. - - name: Upload artifact - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 - with: - name: SARIF file - path: results.sarif - retention-days: 5 - - # Upload the results to GitHub's code scanning dashboard. - - name: Upload to code-scanning - uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9 - with: - sarif_file: results.sarif diff --git a/.github/workflows/semver-check.yml b/.github/workflows/semver-check.yml deleted file mode 100644 index 2fc7eb38843..00000000000 --- a/.github/workflows/semver-check.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Semver Check - -on: - workflow_dispatch: - pull_request: - branches: - - 'releases/**' - -jobs: - semver-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.1 - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - name: Perform gradle build - run: | - ./gradlew semverCheckForRelease diff --git a/.github/workflows/sessions-e2e.yml b/.github/workflows/sessions-e2e.yml deleted file mode 100644 index 048cd92eee9..00000000000 --- a/.github/workflows/sessions-e2e.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Firebase Sessions E2E Tests - -on: - schedule: - - cron: 24 */4 * * * # every 4 hours at 24 minutes past the hour - workflow_dispatch: # allow triggering the workflow manually - -concurrency: - group: ${{ github.workflow }} - -env: - SESSIONS_E2E_GOOGLE_SERVICES: ${{ secrets.SESSIONS_E2E_GOOGLE_SERVICES }} - -jobs: - test: - - runs-on: ubuntu-latest - - steps: - - name: Checkout firebase-sessions - uses: actions/checkout@v4.1.1 - - - name: set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: '11' - distribution: 'temurin' - cache: gradle - - - name: Add google-services.json - run: | - echo $SESSIONS_E2E_GOOGLE_SERVICES | base64 -d > google-services.json - - - uses: google-github-actions/auth@v2 - with: - credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} - - uses: google-github-actions/setup-gcloud@v2 - - name: Run sessions end-to-end tests - env: - FTL_RESULTS_BUCKET: fireescape - run: | - ./gradlew :firebase-sessions:test-app:deviceCheck withErrorProne -PtargetBackend="prod" -PtriggerCrashes diff --git a/.github/workflows/smoke-tests.yml b/.github/workflows/smoke-tests.yml deleted file mode 100644 index 07ab7dbeeb2..00000000000 --- a/.github/workflows/smoke-tests.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Smoke Tests - -on: [ pull_request ] - -jobs: - smoke-tests: - if: github.event.pull_request.head.repo.full_name == github.repository - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 2 - submodules: true - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - uses: google-github-actions/auth@v2 - with: - credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} - - uses: google-github-actions/setup-gcloud@v2 - - # TODO(yifany): make it a fireci plugin and remove the separately distributed jar file - - name: Download smoke tests runner - run: | - SMOKE_TESTS_RUNNER_URL="https://storage.googleapis.com/android-ci/smoke-tests-runner.jar" - curl ${SMOKE_TESTS_RUNNER_URL} --output runner.jar - - # TODO(yifany): remove hardcoded reference to /smoke-tests-google-services from the runner - - name: Add google-services.json - env: - SMOKE_TESTS_GOOGLE_SERVICES: ${{ secrets.SMOKE_TESTS_GOOGLE_SERVICES }} - run: | - echo $SMOKE_TESTS_GOOGLE_SERVICES | base64 -d > google-services.json - sudo mkdir /smoke-tests-google-services - sudo mv google-services.json /smoke-tests-google-services - - # TODO(yifany): remove hardcoded reference to Prow environment variables from the runner - - name: Run smoke tests - env: - FIREBASE_CI: 1 - REPO_OWNER: ${{ github.repository_owner }} - REPO_NAME: firebase-android-sdk - PULL_NUMBER: ${{ github.event.pull_request.number }} - JOB_NAME: smoke-tests - BUILD_ID: ${{ github.run_id }} - ARTIFACTS: ${{ runner.temp }} - run: java -jar runner.jar smoke-tests/runner.config - - - name: Upload test artifacts - if: always() - uses: actions/upload-artifact@v4.3.3 - with: - name: smoke-tests-artifacts - path: | - ${{ runner.temp }}/**/*.apk - ${{ runner.temp }}/**/changed-artifacts.json - ${{ runner.temp }}/**/smoke-test-dependencies.log diff --git a/.github/workflows/update-cpp-sdk-on-release.yml b/.github/workflows/update-cpp-sdk-on-release.yml deleted file mode 100644 index 60ffbc47285..00000000000 --- a/.github/workflows/update-cpp-sdk-on-release.yml +++ /dev/null @@ -1,75 +0,0 @@ -# Whenever a new Firebase Android SDK is released, this workflow triggers -# *another* workflow on the Firebase C++ SDK, which will check for the Android -# version update and create a PR updating its dependencies if any version -# numbers changed. -name: Update C++ SDKs on release -on: - push: - branches: - # Change the below line if the main branch is renamed. - - 'main' - paths: - # Only run this if a gradle.properties file is touched. - - '**/gradle.properties' - -jobs: - check_if_version_changed: - name: Check if released version changed - # This step checks several things, and sets released_version_changed=1 only if all are true: - # - The push must target the main branch. - # - The push must modify a gradle.properties file. - # - The push must change a "latestReleasedVersion=" line in a gradle.properties file. - runs-on: ubuntu-latest - outputs: - released_version_changed: ${{ steps.check_version.outputs.released_version_changed }} - steps: - - uses: actions/checkout@v4.1.1 - with: - # Check out the actual head commit, not any merge commit. - ref: ${{ github.sha }} - # Specify fetch-depth so we can query the log, the default is a shallow clone. - fetch-depth: 0 - - name: Check if version was updated in git history - id: check_version - run: | - # Query the git history for all gradle.properties files changed by this push. - # Then, check the diff to see if any "latestReleasedVersion=" lines changed. - if (git diff '${{ github.event.before }}' -- '**/gradle.properties' | grep -q '^[-+]latestReleasedVersion='); then - echo "released_version_changed=1" >> $GITHUB_OUTPUT - else - echo "No change to latestReleasedVersion detected since ${{ github.event.before }}" - fi - - trigger_cpp_sdk_update: - name: Trigger C++ SDK update - # If the previous step set the released_version_changed output param to 1, then - # we should trigger the C++ SDK to update its Android dependencies. - needs: check_if_version_changed - if: ${{ needs.check_if_version_changed.outputs.released_version_changed }} - # Fetch an authentication token for firebase-workflow-trigger, then use that - # token to trigger the update-dependencies workflow in firebase-cpp-sdk. - runs-on: ubuntu-latest - steps: - - name: Setup python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 - with: - python-version: 3.7 - - - name: Check out firebase-cpp-sdk - uses: actions/checkout@v4.1.1 - with: - repository: firebase/firebase-cpp-sdk - ref: main - - - name: Get firebase-workflow-trigger token - uses: tibdex/github-app-token@021a2405c7f990db57f5eae5397423dcc554159c - id: generate-token - with: - app_id: ${{ secrets.CPP_WORKFLOW_TRIGGER_APP_ID }} - private_key: ${{ secrets.CPP_WORKFLOW_TRIGGER_APP_PRIVATE_KEY }} - repository: firebase/firebase-cpp-sdk - - - name: Trigger firebase-cpp-sdk update - run: | - pip install -r scripts/gha/python_requirements.txt - python scripts/gha/trigger_workflow.py -t ${{ steps.generate-token.outputs.token }} -w update-dependencies.yml -p updateAndroid 1 -p updateiOS 0 -p comment "[Triggered]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID) by [firebase-android-sdk $(date '+%b %d') release]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/${{ github.sha }})." -s 10 -A diff --git a/.github/workflows/validate-dependencies.yml b/.github/workflows/validate-dependencies.yml deleted file mode 100644 index c91ad8aee0c..00000000000 --- a/.github/workflows/validate-dependencies.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Validate Artifact Dependencies - -on: - workflow_dispatch: - pull_request: - branches: - - 'releases/**' - -jobs: - build-artifacts: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.1 - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - name: Perform gradle build - run: | - ./gradlew validatePomForRelease diff --git a/.github/workflows/version-check.yml b/.github/workflows/version-check.yml deleted file mode 100644 index f5f285e29a0..00000000000 --- a/.github/workflows/version-check.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Version Check - -on: - workflow_dispatch: - pull_request: - branches: - - 'releases/**' - -jobs: - version-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.1 - - name: Set up JDK 17 - uses: actions/setup-java@v4.1.0 - with: - java-version: 17 - distribution: temurin - cache: gradle - - name: Build - run: | - ./gradlew gmavenVersionCheck From 71c88275d005a89699d5026e4705d2d75d4acfe4 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Tue, 21 Jan 2025 04:48:38 +0000 Subject: [PATCH 02/31] dataconnect.yml added --- .github/workflows/dataconnect.yml | 124 ++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 .github/workflows/dataconnect.yml diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml new file mode 100644 index 00000000000..baedfbefd3e --- /dev/null +++ b/.github/workflows/dataconnect.yml @@ -0,0 +1,124 @@ +name: Data Connect Integration Tests + +on: + workflow_dispatch: + inputs: + javaVersion: + androidEmulatorApiLevel: + gradleInfoLog: + type: boolean + pull_request: + paths: + - buildSrc/** + - firebase-common/** + - firebase-dataconnect/** + - .github/workflows/dataconnect.yml + schedule: + - cron: '0 11 * * *' # Run nightly at 11am UTC (3am Pacific, 6am Eastern) + +env: + FST_JAVA_VERSION: ${{ inputs.javaVersion || '17' }} + FST_ANDROID_EMULATOR_API_LEVEL: ${{ inputs.androidEmulatorApiLevel || '34' }} + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + integration-test: + continue-on-error: false + runs-on: ubuntu-latest + + services: + postgres: + image: postgres + env: + POSTGRES_PASSWORD: password + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-java@v4 + with: + java-version: ${{ env.FST_JAVA_VERSION }} + distribution: temurin + + - name: tool versions + continue-on-error: true + run: | + set +e -v + uname -a + which java + java -version + which javac + javac -version + ./gradlew --version + + - name: Enable KVM group permissions for Android Emulator + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ + | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + + - name: AVD cache + uses: actions/cache@v4 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-cache-zhdsn586je-api${{ env.FST_ANDROID_EMULATOR_API_LEVEL }}-ref${{ github.ref_name }} + restore-keys: | + avd-cache-zhdsn586je-api${{ env.FST_ANDROID_EMULATOR_API_LEVEL }}-ref${{ github.ref_name }} + avd-cache-zhdsn586je-api${{ env.FST_ANDROID_EMULATOR_API_LEVEL }}- + + - name: Create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ env.FST_ANDROID_EMULATOR_API_LEVEL }} + arch: x86_64 + force-avd-creation: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: false + script: echo "Generated AVD snapshot for caching." + + - name: Data Connect Emulator + run: | + set -x + + echo "emulator.postgresConnectionUrl=postgresql://postgres:password@127.0.0.1:5432?sslmode=disable" > firebase-dataconnect/dataconnect.local.properties + + ./gradlew \ + --no-daemon \ + ${{ (inputs.gradleInfoLog && '--info') || '' }} \ + :firebase-dataconnect:connectors:runDebugDataConnectEmulator \ + 2>&1 >dataconnect.emulator.log & + + sleep 5s + + - name: Gradle connectedCheck + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ env.FST_ANDROID_EMULATOR_API_LEVEL }} + arch: x86_64 + force-avd-creation: false + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: true + script: | + set -x && ./gradlew --no-daemon ${{ (inputs.gradleInfoLog && '--info') || '' }} --profile :firebase-dataconnect:connectedCheck :firebase-dataconnect:connectors:connectedCheck' + + - uses: actions/upload-artifact@v4 + with: + name: logs + path: **/*.log + if-no-files-found: warn + compression-level: 9 From 76884b5538abf9faff5d2bd078f215277f0c82d0 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Tue, 21 Jan 2025 05:22:59 +0000 Subject: [PATCH 03/31] dataconnect.yml: compile before doing all the avd stuff --- .github/workflows/dataconnect.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index d3c44ed3551..c0c8d0a6e33 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -44,6 +44,7 @@ jobs: steps: - uses: actions/checkout@v3 + show-progress: false - uses: actions/setup-java@v4 with: @@ -61,6 +62,12 @@ jobs: javac -version ./gradlew --version + - name: Gradle assembleDebugAndroidTest + set -v + ./gradlew \ + ${{ (inputs.gradleInfoLog && '--info') || '' }} \ + :firebase-dataconnect:assembleDebugAndroidTest + - name: Enable KVM group permissions for Android Emulator run: | echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ @@ -98,7 +105,6 @@ jobs: echo "emulator.postgresConnectionUrl=postgresql://postgres:password@127.0.0.1:5432?sslmode=disable" > firebase-dataconnect/dataconnect.local.properties ./gradlew \ - --no-daemon \ ${{ (inputs.gradleInfoLog && '--info') || '' }} \ :firebase-dataconnect:connectors:runDebugDataConnectEmulator \ 2>&1 >dataconnect.emulator.log & From c4b7334a04261e9ccb9f8e98e7acbfc9ab43a055 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Tue, 21 Jan 2025 05:24:30 +0000 Subject: [PATCH 04/31] dataconnect.yml: disable firebase-crashlytics-ndk --- .github/workflows/dataconnect.yml | 6 ++++++ subprojects.cfg | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index c0c8d0a6e33..fcc36af1961 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -63,7 +63,13 @@ jobs: ./gradlew --version - name: Gradle assembleDebugAndroidTest + run: | set -v + + # Disable firebase-crashlytics-ndk because it requires setting up an NDK, + # which isn't needed for anything else. + sed -i -e '/firebase-crashlytics-ndk/d' subprojects.cfg + ./gradlew \ ${{ (inputs.gradleInfoLog && '--info') || '' }} \ :firebase-dataconnect:assembleDebugAndroidTest diff --git a/subprojects.cfg b/subprojects.cfg index 3be81de81a1..1b77f55e0a0 100644 --- a/subprojects.cfg +++ b/subprojects.cfg @@ -23,7 +23,6 @@ firebase-config:test-app firebase-config-interop firebase-crashlytics firebase-crashlytics:ktx -firebase-crashlytics-ndk firebase-database firebase-database:ktx firebase-database-collection From f6ab119bfb3fdccf4f97db57f7cbc6ea1929b5f8 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Tue, 21 Jan 2025 05:29:30 +0000 Subject: [PATCH 05/31] dataconnect.yml: use actions/checkout@v3v4 --- .github/workflows/dataconnect.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index fcc36af1961..d924af7f08c 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -43,7 +43,7 @@ jobs: - 5432:5432 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 show-progress: false - uses: actions/setup-java@v4 From f8e31ddf45a2635b46294d6b96a5ec55d2b2f2a2 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Tue, 21 Jan 2025 05:32:35 +0000 Subject: [PATCH 06/31] dataconnect.yml: specify show-progress correctly within a "with" block --- .github/workflows/dataconnect.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index d924af7f08c..8978180c622 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -44,7 +44,8 @@ jobs: steps: - uses: actions/checkout@v4 - show-progress: false + with: + show-progress: false - uses: actions/setup-java@v4 with: From c97526011be1fa795da562dc70172b5a9e24c723 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Tue, 21 Jan 2025 05:40:44 +0000 Subject: [PATCH 07/31] dataconnect.yml: remove superfluous repetition of full cache key --- .github/workflows/dataconnect.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index 8978180c622..fa26a11adae 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -91,7 +91,6 @@ jobs: ~/.android/adb* key: avd-cache-zhdsn586je-api${{ env.FST_ANDROID_EMULATOR_API_LEVEL }}-ref${{ github.ref_name }} restore-keys: | - avd-cache-zhdsn586je-api${{ env.FST_ANDROID_EMULATOR_API_LEVEL }}-ref${{ github.ref_name }} avd-cache-zhdsn586je-api${{ env.FST_ANDROID_EMULATOR_API_LEVEL }}- - name: Create AVD and generate snapshot for caching From acb85865fe3fdcb4c63682203c606018c31131e2 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Tue, 21 Jan 2025 05:53:50 +0000 Subject: [PATCH 08/31] dataconnect.yml: setup auth emulator --- .github/workflows/dataconnect.yml | 42 +++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index fa26a11adae..5d8b0efa370 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -5,6 +5,8 @@ on: inputs: javaVersion: androidEmulatorApiLevel: + nodeJsVersion: + firebaseToolsVersion: gradleInfoLog: type: boolean pull_request: @@ -17,8 +19,12 @@ on: - cron: '0 11 * * *' # Run nightly at 11am UTC (3am Pacific, 6am Eastern) env: - FST_JAVA_VERSION: ${{ inputs.javaVersion || '17' }} - FST_ANDROID_EMULATOR_API_LEVEL: ${{ inputs.androidEmulatorApiLevel || '34' }} + FDC_JAVA_VERSION: ${{ inputs.javaVersion || '17' }} + FDC_ANDROID_EMULATOR_API_LEVEL: ${{ inputs.androidEmulatorApiLevel || '34' }} + FDC_NODEJS_VERSION: ${{ inputs.nodeJsVersion || '20' }} + FDC_FIREBASE_TOOLS_VERSION: ${{ inputs.firebaseToolsVersion || '13.29.1' }} + FDC_FIREBASE_TOOLS_DIR: ${{ github.workspace }}/firebase-tools + FDC_FIREBASE_COMMAND: ${{ github.workspace }}/firebase-tools/node_modules/.bin/firebase concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -49,9 +55,21 @@ jobs: - uses: actions/setup-java@v4 with: - java-version: ${{ env.FST_JAVA_VERSION }} + java-version: ${{ env.FDC_JAVA_VERSION }} distribution: temurin + - uses: actions/setup-node@v3 + with: + node-version: ${{ env.FST_NODEJS_VERSION }} + + - name: install firebase-tools + run: | + set -v + mkdir -p ${{ env.FDC_FIREBASE_TOOLS_DIR }} + cd ${{ env.FDC_FIREBASE_TOOLS_DIR }} + echo '{}' > package.json + npm install --fund=false --audit=false --save --save-exact firebase-tools@${{ env.FST_FIREBASE_TOOLS_VERSION }} + - name: tool versions continue-on-error: true run: | @@ -62,6 +80,10 @@ jobs: which javac javac -version ./gradlew --version + which node + node --version + ${{ env.FST_FIREBASE_COMMAND }} --version + ./gradlew --version - name: Gradle assembleDebugAndroidTest run: | @@ -89,15 +111,15 @@ jobs: path: | ~/.android/avd/* ~/.android/adb* - key: avd-cache-zhdsn586je-api${{ env.FST_ANDROID_EMULATOR_API_LEVEL }}-ref${{ github.ref_name }} + key: avd-cache-zhdsn586je-api${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}-ref${{ github.ref_name }} restore-keys: | - avd-cache-zhdsn586je-api${{ env.FST_ANDROID_EMULATOR_API_LEVEL }}- + avd-cache-zhdsn586je-api${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}- - name: Create AVD and generate snapshot for caching if: steps.avd-cache.outputs.cache-hit != 'true' uses: reactivecircus/android-emulator-runner@v2 with: - api-level: ${{ env.FST_ANDROID_EMULATOR_API_LEVEL }} + api-level: ${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }} arch: x86_64 force-avd-creation: false emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none @@ -115,12 +137,16 @@ jobs: :firebase-dataconnect:connectors:runDebugDataConnectEmulator \ 2>&1 >dataconnect.emulator.log & - sleep 5s + - name: Firebase Auth Emulator + run: | + set -x + cd firebase-dataconnect/emulator + ${{ env.FST_FIREBASE_COMMAND }} emulators:start --only=auth & - name: Gradle connectedCheck uses: reactivecircus/android-emulator-runner@v2 with: - api-level: ${{ env.FST_ANDROID_EMULATOR_API_LEVEL }} + api-level: ${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }} arch: x86_64 force-avd-creation: false emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none From bee5612f67a72882532fabe3668aa13e68551f08 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Tue, 21 Jan 2025 05:56:31 +0000 Subject: [PATCH 09/31] dataconnect.yml: FST -> FDC --- .github/workflows/dataconnect.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index 5d8b0efa370..a81faf4ee6f 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -82,7 +82,7 @@ jobs: ./gradlew --version which node node --version - ${{ env.FST_FIREBASE_COMMAND }} --version + ${{ env.FDC_FIREBASE_COMMAND }} --version ./gradlew --version - name: Gradle assembleDebugAndroidTest @@ -141,7 +141,7 @@ jobs: run: | set -x cd firebase-dataconnect/emulator - ${{ env.FST_FIREBASE_COMMAND }} emulators:start --only=auth & + ${{ env.FDC_FIREBASE_COMMAND }} emulators:start --only=auth & - name: Gradle connectedCheck uses: reactivecircus/android-emulator-runner@v2 From 120d46bea5f357c4014d9837210efaa3effa935b Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Tue, 21 Jan 2025 21:21:50 +0000 Subject: [PATCH 10/31] fix tests due to slower github actions runners --- .../google/firebase/dataconnect/QueryRefIntegrationTest.kt | 4 ++-- .../firebase/dataconnect/QuerySubscriptionIntegrationTest.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/firebase-dataconnect/src/androidTest/kotlin/com/google/firebase/dataconnect/QueryRefIntegrationTest.kt b/firebase-dataconnect/src/androidTest/kotlin/com/google/firebase/dataconnect/QueryRefIntegrationTest.kt index efcd75d2aab..5e0527a6082 100644 --- a/firebase-dataconnect/src/androidTest/kotlin/com/google/firebase/dataconnect/QueryRefIntegrationTest.kt +++ b/firebase-dataconnect/src/androidTest/kotlin/com/google/firebase/dataconnect/QueryRefIntegrationTest.kt @@ -31,7 +31,7 @@ import io.kotest.matchers.shouldBe import io.kotest.matchers.types.shouldBeInstanceOf import io.kotest.property.Arb import io.kotest.property.arbitrary.next -import kotlin.time.Duration.Companion.seconds +import kotlin.time.Duration.Companion.minutes import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.async import kotlinx.coroutines.test.runTest @@ -388,7 +388,7 @@ class QueryRefIntegrationTest : DataConnectIntegrationTestBase() { @Test fun executeShouldSupportMassiveConcurrency() = - runTest(timeout = 60.seconds) { + runTest(timeout = 5.minutes) { val latch = SuspendingCountDownLatch(25_000) val query = personSchema.getPerson(id = "foo") diff --git a/firebase-dataconnect/src/androidTest/kotlin/com/google/firebase/dataconnect/QuerySubscriptionIntegrationTest.kt b/firebase-dataconnect/src/androidTest/kotlin/com/google/firebase/dataconnect/QuerySubscriptionIntegrationTest.kt index 908382ccdcc..6b0f0c4ff47 100644 --- a/firebase-dataconnect/src/androidTest/kotlin/com/google/firebase/dataconnect/QuerySubscriptionIntegrationTest.kt +++ b/firebase-dataconnect/src/androidTest/kotlin/com/google/firebase/dataconnect/QuerySubscriptionIntegrationTest.kt @@ -303,7 +303,7 @@ class QuerySubscriptionIntegrationTest : DataConnectIntegrationTestBase() { .toList() assertSoftly { - withClue("results.size") { results.size shouldBeInRange 1..2000 } + withClue("results.size") { results.size shouldBeInRange 1..5000 } results.forEachIndexed { i, result -> withClue("results[$i]") { result.shouldHavePersonWithName("NewName") } } From c8fec6873e1af78b796475d0352b284cd4f27667 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Tue, 21 Jan 2025 21:27:29 +0000 Subject: [PATCH 11/31] dataconnect.yml: more FST -> FDC --- .github/workflows/dataconnect.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index a81faf4ee6f..7fae6ecc8e0 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -60,7 +60,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: ${{ env.FST_NODEJS_VERSION }} + node-version: ${{ env.FDC_NODEJS_VERSION }} - name: install firebase-tools run: | @@ -68,7 +68,7 @@ jobs: mkdir -p ${{ env.FDC_FIREBASE_TOOLS_DIR }} cd ${{ env.FDC_FIREBASE_TOOLS_DIR }} echo '{}' > package.json - npm install --fund=false --audit=false --save --save-exact firebase-tools@${{ env.FST_FIREBASE_TOOLS_VERSION }} + npm install --fund=false --audit=false --save --save-exact firebase-tools@${{ env.FDC_FIREBASE_TOOLS_VERSION }} - name: tool versions continue-on-error: true From c4eb174efb92df0315688796979e069b6689e2a2 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Tue, 21 Jan 2025 21:47:02 +0000 Subject: [PATCH 12/31] dataconnect.yml: set org.gradle.configureondemand=true --- .github/workflows/dataconnect.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index 7fae6ecc8e0..e96ac511048 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -89,10 +89,10 @@ jobs: run: | set -v - # Disable firebase-crashlytics-ndk because it requires setting up an NDK, - # which isn't needed for anything else. - sed -i -e '/firebase-crashlytics-ndk/d' subprojects.cfg - + # Speed up build times and also avoid configuring firebase-crashlytics-ndk + # which is finicky integrating with the Android NDK. + echo "org.gradle.configureondemand=true" >> gradle.properties + ./gradlew \ ${{ (inputs.gradleInfoLog && '--info') || '' }} \ :firebase-dataconnect:assembleDebugAndroidTest From 0170dc81eb6cfd4f875ae758a25c82ad60c31962 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 04:26:59 +0000 Subject: [PATCH 13/31] dataconnect.yml: echo a newline into gradle.properties since it does not already end with a newline --- .github/workflows/dataconnect.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index e96ac511048..07b4b7e9613 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -91,6 +91,7 @@ jobs: # Speed up build times and also avoid configuring firebase-crashlytics-ndk # which is finicky integrating with the Android NDK. + echo >> gradle.properties echo "org.gradle.configureondemand=true" >> gradle.properties ./gradlew \ From 4cdbd58263e86560aecb5945f31edead872305d5 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 19:48:46 +0000 Subject: [PATCH 14/31] dataconnect.yml: refactor, especially to have cache only saved on scheduled runs --- .github/workflows/dataconnect.yml | 68 +++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 16 deletions(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index 07b4b7e9613..25c865ed402 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -11,10 +11,12 @@ on: type: boolean pull_request: paths: - - buildSrc/** - - firebase-common/** - - firebase-dataconnect/** - .github/workflows/dataconnect.yml + - 'firebase-dataconnect/**' + - '!firebase-dataconnect/demo/**' + - '!firebase-dataconnect/scripts/**' + - '!firebase-dataconnect/**/*.md' + - '!firebase-dataconnect/**/*.txt' schedule: - cron: '0 11 * * *' # Run nightly at 11am UTC (3am Pacific, 6am Eastern) @@ -23,8 +25,8 @@ env: FDC_ANDROID_EMULATOR_API_LEVEL: ${{ inputs.androidEmulatorApiLevel || '34' }} FDC_NODEJS_VERSION: ${{ inputs.nodeJsVersion || '20' }} FDC_FIREBASE_TOOLS_VERSION: ${{ inputs.firebaseToolsVersion || '13.29.1' }} - FDC_FIREBASE_TOOLS_DIR: ${{ github.workspace }}/firebase-tools - FDC_FIREBASE_COMMAND: ${{ github.workspace }}/firebase-tools/node_modules/.bin/firebase + FDC_FIREBASE_TOOLS_DIR: ${{ runner.temp }}/firebase-tools + FDC_FIREBASE_COMMAND: ${{ runner.temp }}/firebase-tools/node_modules/.bin/firebase concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -85,6 +87,15 @@ jobs: ${{ env.FDC_FIREBASE_COMMAND }} --version ./gradlew --version + - name: Restore Gradle cache + uses: actions/cache/restore@v4 + if: github.event_name != 'schedule' + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-cache-jqnvfzw6w7 + - name: Gradle assembleDebugAndroidTest run: | set -v @@ -98,6 +109,15 @@ jobs: ${{ (inputs.gradleInfoLog && '--info') || '' }} \ :firebase-dataconnect:assembleDebugAndroidTest + - name: Save Gradle cache + uses: actions/cache/save@v4 + if: github.event_name == 'schedule' + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-cache-jqnvfzw6w7 + - name: Enable KVM group permissions for Android Emulator run: | echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ @@ -105,19 +125,18 @@ jobs: sudo udevadm control --reload-rules sudo udevadm trigger --name-match=kvm - - name: AVD cache - uses: actions/cache@v4 + - name: Restore AVD cache + uses: actions/cache/restore@v4 + if: github.event_name != 'schedule' id: avd-cache with: path: | ~/.android/avd/* ~/.android/adb* - key: avd-cache-zhdsn586je-api${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}-ref${{ github.ref_name }} - restore-keys: | - avd-cache-zhdsn586je-api${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }}- + key: avd-cache-zhdsn586je-api${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }} - - name: Create AVD and generate snapshot for caching - if: steps.avd-cache.outputs.cache-hit != 'true' + - name: Create AVD + if: github.event_name == 'schedule' || steps.avd-cache.outputs.cache-hit != 'true' uses: reactivecircus/android-emulator-runner@v2 with: api-level: ${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }} @@ -127,22 +146,32 @@ jobs: disable-animations: false script: echo "Generated AVD snapshot for caching." + - name: Save AVD cache + uses: actions/cache/save@v4 + if: github.event_name == 'schedule' + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-cache-zhdsn586je-api${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }} + - name: Data Connect Emulator run: | set -x - echo "emulator.postgresConnectionUrl=postgresql://postgres:password@127.0.0.1:5432?sslmode=disable" > firebase-dataconnect/dataconnect.local.properties + echo 'emulator.postgresConnectionUrl=postgresql://postgres:password@127.0.0.1:5432?sslmode=disable' > firebase-dataconnect/dataconnect.local.properties ./gradlew \ ${{ (inputs.gradleInfoLog && '--info') || '' }} \ :firebase-dataconnect:connectors:runDebugDataConnectEmulator \ - 2>&1 >dataconnect.emulator.log & + 2>&1 >firebase.emulator.dataconnect.log & - name: Firebase Auth Emulator run: | set -x cd firebase-dataconnect/emulator - ${{ env.FDC_FIREBASE_COMMAND }} emulators:start --only=auth & + ${{ env.FDC_FIREBASE_COMMAND }} emulators:start --only=auth 2>&1 >firebase.emulator.auth.log & - name: Gradle connectedCheck uses: reactivecircus/android-emulator-runner@v2 @@ -152,9 +181,16 @@ jobs: force-avd-creation: false emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true - script: set -x && ./gradlew --no-daemon ${{ (inputs.gradleInfoLog && '--info') || '' }} --profile :firebase-dataconnect:connectedCheck :firebase-dataconnect:connectors:connectedCheck + script: | + set -euox pipefail + ./gradlew \ + ${{ (inputs.gradleInfoLog && '--info') || '' }} \ + --profile \ + :firebase-dataconnect:connectedCheck \ + :firebase-dataconnect:connectors:connectedCheck - uses: actions/upload-artifact@v4 + if: true with: name: logs path: "**/*.log" From 9721a18c29d391ee189a5a7e779a7b0c07a43f2d Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 21:00:32 +0000 Subject: [PATCH 15/31] dataconnect.yml: use /tmp instead of runner.temp because the latter is not available at the top level "env" scope --- .github/workflows/dataconnect.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index 25c865ed402..c6f3538b672 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -25,8 +25,8 @@ env: FDC_ANDROID_EMULATOR_API_LEVEL: ${{ inputs.androidEmulatorApiLevel || '34' }} FDC_NODEJS_VERSION: ${{ inputs.nodeJsVersion || '20' }} FDC_FIREBASE_TOOLS_VERSION: ${{ inputs.firebaseToolsVersion || '13.29.1' }} - FDC_FIREBASE_TOOLS_DIR: ${{ runner.temp }}/firebase-tools - FDC_FIREBASE_COMMAND: ${{ runner.temp }}/firebase-tools/node_modules/.bin/firebase + FDC_FIREBASE_TOOLS_DIR: /tmp/firebase-tools + FDC_FIREBASE_COMMAND: /tmp/firebase-tools/node_modules/.bin/firebase concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} From 6eef3fa5d6422fef372aa01c61748e3f721ff584 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 21:24:46 +0000 Subject: [PATCH 16/31] dataconnect.yaml: add actionlint and fix actionlint errors --- .github/workflows/dataconnect.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index c6f3538b672..9ad4b791391 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -60,7 +60,7 @@ jobs: java-version: ${{ env.FDC_JAVA_VERSION }} distribution: temurin - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: ${{ env.FDC_NODEJS_VERSION }} @@ -165,13 +165,13 @@ jobs: ./gradlew \ ${{ (inputs.gradleInfoLog && '--info') || '' }} \ :firebase-dataconnect:connectors:runDebugDataConnectEmulator \ - 2>&1 >firebase.emulator.dataconnect.log & + >firebase.emulator.dataconnect.log 2>&1 & - name: Firebase Auth Emulator run: | set -x cd firebase-dataconnect/emulator - ${{ env.FDC_FIREBASE_COMMAND }} emulators:start --only=auth 2>&1 >firebase.emulator.auth.log & + ${{ env.FDC_FIREBASE_COMMAND }} emulators:start --only=auth >firebase.emulator.auth.log 2>&1 & - name: Gradle connectedCheck uses: reactivecircus/android-emulator-runner@v2 @@ -196,3 +196,10 @@ jobs: path: "**/*.log" if-no-files-found: warn compression-level: 9 + + actionlint_dataconnect_yml: + continue-on-error: false + runs-on: ubuntu-latest + steps: + - run: brew install actionlint + - run: actionlint .github/workflows/dataconnect.yml From b5682ffc1d0ea8b0ed998c13594d85790bf0abab Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 21:24:46 +0000 Subject: [PATCH 17/31] dataconnect.yaml: remove extra "avd-cache" id --- .github/workflows/dataconnect.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index 9ad4b791391..2575839d217 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -149,7 +149,6 @@ jobs: - name: Save AVD cache uses: actions/cache/save@v4 if: github.event_name == 'schedule' - id: avd-cache with: path: | ~/.android/avd/* From d4d60dc469828b61da3c1dd604a0b2bc5292c5a5 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 21:42:44 +0000 Subject: [PATCH 18/31] dataconnect.yml: use actionlint image --- .github/workflows/dataconnect.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index 2575839d217..21b75754854 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -200,5 +200,6 @@ jobs: continue-on-error: false runs-on: ubuntu-latest steps: - - run: brew install actionlint - - run: actionlint .github/workflows/dataconnect.yml + - uses: docker://rhysd/actionlint:1.7.7 + with: + args: -color From f0e401be6e2d75365c113dc48296bdcc9b103419 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 21:48:52 +0000 Subject: [PATCH 19/31] dataconnect.yml: forgot to actually check out the code for actionlint --- .github/workflows/dataconnect.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index 21b75754854..8af7636622e 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -199,7 +199,9 @@ jobs: actionlint_dataconnect_yml: continue-on-error: false runs-on: ubuntu-latest - steps: + - uses: actions/checkout@v4 + with: + show-progress: false - uses: docker://rhysd/actionlint:1.7.7 with: args: -color From 201a788d2746b6944a4f831f861dac3361230ace Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 21:50:22 +0000 Subject: [PATCH 20/31] dataconnect.yml: accidentally deleted the "steps" part :facepalm: --- .github/workflows/dataconnect.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index 8af7636622e..4891dee983f 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -199,6 +199,7 @@ jobs: actionlint_dataconnect_yml: continue-on-error: false runs-on: ubuntu-latest + steps: - uses: actions/checkout@v4 with: show-progress: false From 6849212f0f8ebf036be768c9e8ab8d3d8709345d Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 21:54:39 +0000 Subject: [PATCH 21/31] dataconnect.yml: specify path to yml file --- .github/workflows/dataconnect.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index 4891dee983f..0969a481910 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -205,4 +205,4 @@ jobs: show-progress: false - uses: docker://rhysd/actionlint:1.7.7 with: - args: -color + args: -color /github/workspace/.github/workflows/dataconnect.yml From e8ab2354c3f58366eac32746272b7d39eaad5bf4 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 21:57:27 +0000 Subject: [PATCH 22/31] dataconnect.yml: put an error in that actionlint should find --- .github/workflows/dataconnect.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index 0969a481910..64e383f0769 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -164,7 +164,7 @@ jobs: ./gradlew \ ${{ (inputs.gradleInfoLog && '--info') || '' }} \ :firebase-dataconnect:connectors:runDebugDataConnectEmulator \ - >firebase.emulator.dataconnect.log 2>&1 & + 2>&1 >firebase.emulator.dataconnect.log & - name: Firebase Auth Emulator run: | From 341e144355173442b38a186bf687188a3c273e61 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 21:59:28 +0000 Subject: [PATCH 23/31] Back out "dataconnect.yml: put an error in that actionlint should find" This backs out commit e8ab2354c3f58366eac32746272b7d39eaad5bf4. --- .github/workflows/dataconnect.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index 64e383f0769..0969a481910 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -164,7 +164,7 @@ jobs: ./gradlew \ ${{ (inputs.gradleInfoLog && '--info') || '' }} \ :firebase-dataconnect:connectors:runDebugDataConnectEmulator \ - 2>&1 >firebase.emulator.dataconnect.log & + >firebase.emulator.dataconnect.log 2>&1 & - name: Firebase Auth Emulator run: | From ee88ce0504b054e07f221d34c018c42befc53d03 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 22:02:09 +0000 Subject: [PATCH 24/31] dataconnect.yml: use dashes instead of underscores in job name --- .github/workflows/dataconnect.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index 0969a481910..7789aef936b 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -196,7 +196,7 @@ jobs: if-no-files-found: warn compression-level: 9 - actionlint_dataconnect_yml: + actionlint-dataconnect-yml: continue-on-error: false runs-on: ubuntu-latest steps: From ebd9c52bf447d2f593c0a94b8f6a050af600f6b0 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 22:06:24 +0000 Subject: [PATCH 25/31] dataconnect.yml: add a comment about running actionlint locally --- .github/workflows/dataconnect.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index 7789aef936b..9c27cb83379 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -196,6 +196,9 @@ jobs: if-no-files-found: warn compression-level: 9 + # Check this yml file with "actionlint": https://github.com/rhysd/actionlint + # To run actionlint yourself, run `brew install actionlint` followed by + # `actionlint .github/workflows/dataconnect.yml` actionlint-dataconnect-yml: continue-on-error: false runs-on: ubuntu-latest From f4f6d9f4c491f352ed5415b2790869c4509ba909 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 22:08:25 +0000 Subject: [PATCH 26/31] Back out "(revert me) delete existing workflows for convenience while developing" This backs out commit 07110320804214bf57bc33aa4befe8820f81c5e2. --- .github/workflows/api-information.yml | 31 +++ .github/workflows/build-release-artifacts.yml | 47 ++++ .github/workflows/changelog.yml | 29 ++ .github/workflows/check-head-dependencies.yml | 22 ++ .../workflows/check-vertexai-responses.yml | 40 +++ .github/workflows/check_format.yml | 73 +++++ .github/workflows/ci_tests.yml | 177 ++++++++++++ .github/workflows/config-e2e.yml | 42 +++ .github/workflows/copyright-check.yml | 27 ++ .github/workflows/create_releases.yml | 50 ++++ .github/workflows/dataconnect_demo_app.yml | 164 +++++++++++ .github/workflows/diff-javadoc.yml | 64 +++++ .github/workflows/fireci.yml | 27 ++ .github/workflows/fireperf-e2e.yml | 107 +++++++ .github/workflows/firestore_ci_tests.yml | 261 ++++++++++++++++++ .github/workflows/health-metrics.yml | 134 +++++++++ .github/workflows/jekyll-gh-pages.yml | 55 ++++ .github/workflows/make-bom.yml | 39 +++ .github/workflows/merge-to-main.yml | 30 ++ .github/workflows/plugins-check.yml | 32 +++ .github/workflows/post_release_cleanup.yml | 46 +++ .github/workflows/private-mirror-sync.yml | 30 ++ .github/workflows/release-note-changes.yml | 67 +++++ .github/workflows/scorecards.yml | 86 ++++++ .github/workflows/semver-check.yml | 22 ++ .github/workflows/sessions-e2e.yml | 42 +++ .github/workflows/smoke-tests.yml | 60 ++++ .../workflows/update-cpp-sdk-on-release.yml | 75 +++++ .github/workflows/validate-dependencies.yml | 22 ++ .github/workflows/version-check.yml | 22 ++ 30 files changed, 1923 insertions(+) create mode 100644 .github/workflows/api-information.yml create mode 100644 .github/workflows/build-release-artifacts.yml create mode 100644 .github/workflows/changelog.yml create mode 100644 .github/workflows/check-head-dependencies.yml create mode 100644 .github/workflows/check-vertexai-responses.yml create mode 100644 .github/workflows/check_format.yml create mode 100644 .github/workflows/ci_tests.yml create mode 100644 .github/workflows/config-e2e.yml create mode 100644 .github/workflows/copyright-check.yml create mode 100644 .github/workflows/create_releases.yml create mode 100644 .github/workflows/dataconnect_demo_app.yml create mode 100644 .github/workflows/diff-javadoc.yml create mode 100644 .github/workflows/fireci.yml create mode 100644 .github/workflows/fireperf-e2e.yml create mode 100644 .github/workflows/firestore_ci_tests.yml create mode 100644 .github/workflows/health-metrics.yml create mode 100644 .github/workflows/jekyll-gh-pages.yml create mode 100644 .github/workflows/make-bom.yml create mode 100644 .github/workflows/merge-to-main.yml create mode 100644 .github/workflows/plugins-check.yml create mode 100644 .github/workflows/post_release_cleanup.yml create mode 100644 .github/workflows/private-mirror-sync.yml create mode 100644 .github/workflows/release-note-changes.yml create mode 100644 .github/workflows/scorecards.yml create mode 100644 .github/workflows/semver-check.yml create mode 100644 .github/workflows/sessions-e2e.yml create mode 100644 .github/workflows/smoke-tests.yml create mode 100644 .github/workflows/update-cpp-sdk-on-release.yml create mode 100644 .github/workflows/validate-dependencies.yml create mode 100644 .github/workflows/version-check.yml diff --git a/.github/workflows/api-information.yml b/.github/workflows/api-information.yml new file mode 100644 index 00000000000..f0f1c57d650 --- /dev/null +++ b/.github/workflows/api-information.yml @@ -0,0 +1,31 @@ +name: API Information + +on: [ pull_request ] + +jobs: + api-information-check: + if: github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 2 + submodules: true + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + - name: Set up Python 3.10 + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 + with: + python-version: '3.10' + - name: Set up fireci + run: pip3 install -e ci/fireci + - name: Run api-information check + run: | + fireci api_information \ + --issue_number=${{ github.event.pull_request.number }} \ + --repo_name=${{ github.repository }} \ + --auth_token=${{ secrets.GOOGLE_OSS_BOT_TOKEN }} diff --git a/.github/workflows/build-release-artifacts.yml b/.github/workflows/build-release-artifacts.yml new file mode 100644 index 00000000000..313226dce97 --- /dev/null +++ b/.github/workflows/build-release-artifacts.yml @@ -0,0 +1,47 @@ +name: Build Release Artifacts + +on: + workflow_dispatch: + pull_request: + branches: + - 'releases/**' + +jobs: + build-artifacts: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v4.1.1 + + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + + - name: Perform gradle build + run: | + ./gradlew firebasePublish + + - name: Upload m2 repo + uses: actions/upload-artifact@v4.3.3 + with: + name: m2repository + path: build/m2repository/ + retention-days: 15 + + - name: Upload release notes + uses: actions/upload-artifact@v4.3.3 + with: + name: release_notes + path: build/release-notes/ + retention-days: 15 + + - name: Upload kotlindocs + uses: actions/upload-artifact@v4.3.3 + with: + name: kotlindocs + path: build/firebase-kotlindoc/ + retention-days: 15 diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 00000000000..7937f67acd5 --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,29 @@ +name: Verify changelog update + +on: + pull_request + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + changelog-check: + runs-on: ubuntu-22.04 + env: + BUNDLE_GEMFILE: ./ci/danger/Gemfile + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 100 + submodules: true + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + - name: Setup Bundler + run: ./ci/danger/setup_bundler.sh + - name: Danger CHANGELOG verifier + env: + DANGER_GITHUB_API_TOKEN: ${{ secrets.GOOGLE_OSS_BOT_TOKEN }} + run: + '[ ! -z $DANGER_GITHUB_API_TOKEN ] && bundle exec danger --dangerfile=./ci/danger/Dangerfile || echo "Skipping Danger for External Contributor"' diff --git a/.github/workflows/check-head-dependencies.yml b/.github/workflows/check-head-dependencies.yml new file mode 100644 index 00000000000..088724bf1d4 --- /dev/null +++ b/.github/workflows/check-head-dependencies.yml @@ -0,0 +1,22 @@ +name: Check Head Dependencies + +on: + workflow_dispatch: + pull_request: + branches: + - 'releases/**' + +jobs: + check-head-dependencies: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + - name: Perform gradle build + run: | + ./gradlew checkHeadDependencies diff --git a/.github/workflows/check-vertexai-responses.yml b/.github/workflows/check-vertexai-responses.yml new file mode 100644 index 00000000000..482254c553d --- /dev/null +++ b/.github/workflows/check-vertexai-responses.yml @@ -0,0 +1,40 @@ +name: Check Vertex AI Responses + +on: pull_request + +jobs: + check-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Clone mock responses + run: firebase-vertexai/update_responses.sh + - name: Find cloned and latest versions + run: | + CLONED=$(git describe --tags) + LATEST=$(git tag --sort=v:refname | tail -n1) + echo "cloned_tag=$CLONED" >> $GITHUB_ENV + echo "latest_tag=$LATEST" >> $GITHUB_ENV + working-directory: firebase-vertexai/src/test/resources/vertexai-sdk-test-data + - name: Find comment from previous run if exists + uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e + id: fc + with: + issue-number: ${{github.event.number}} + body-includes: Vertex AI Mock Responses Check + - name: Comment on PR if newer version is available + if: ${{env.cloned_tag != env.latest_tag && !steps.fc.outputs.comment-id}} + uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 + with: + issue-number: ${{github.event.number}} + body: > + ### Vertex AI Mock Responses Check :warning: + + A newer major version of the mock responses for Vertex AI unit tests is available. + [update_responses.sh](https://github.com/firebase/firebase-android-sdk/blob/main/firebase-vertexai/update_responses.sh) + should be updated to clone the latest version of the responses: `${{env.latest_tag}}` + - name: Delete comment when version gets updated + if: ${{env.cloned_tag == env.latest_tag && steps.fc.outputs.comment-id}} + uses: detomarco/delete-comment@850734dd44d8b15fef55b45252613b903ceb06f0 + with: + comment-id: ${{ steps.fc.outputs.comment-id }} diff --git a/.github/workflows/check_format.yml b/.github/workflows/check_format.yml new file mode 100644 index 00000000000..6bdfb0ea4d1 --- /dev/null +++ b/.github/workflows/check_format.yml @@ -0,0 +1,73 @@ +name: Check Format +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +on: + pull_request: + push: + branches: + - main + +jobs: + determine_changed: + name: "Determine changed modules" + runs-on: ubuntu-22.04 + if: (github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || github.event_name == 'pull_request' + outputs: + modules: ${{ steps.changed-modules.outputs.modules }} + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 2 + submodules: true + + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + + - id: changed-modules + run: | + git diff --name-only HEAD~1 | xargs printf -- '--changed-git-paths %s\n' | xargs ./gradlew writeChangedProjects --output-file-path=modules.json + echo modules=$(cat modules.json) >> $GITHUB_OUTPUT + + check_format: + name: "Check Format" + runs-on: ubuntu-22.04 + needs: + - determine_changed + strategy: + fail-fast: false + matrix: + module: ${{ fromJSON(needs.determine_changed.outputs.modules) }} + + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 2 + submodules: true + + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + + - name: ${{ matrix.module }} Check Format + run: | + ./gradlew ${{matrix.module}}:spotlessCheck + + # A job that fails if any job in the check_format matrix fails, + # to be used as a required check for merging. + check_all: + runs-on: ubuntu-22.04 + if: always() + name: Check Format (matrix) + needs: check_format + steps: + - name: Check matrix + if: needs.check_format.result != 'success' + run: exit 1 diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml new file mode 100644 index 00000000000..52c45abc18b --- /dev/null +++ b/.github/workflows/ci_tests.yml @@ -0,0 +1,177 @@ +name: CI Tests +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +on: + pull_request: + push: + branches: + - main + +jobs: + determine_changed: + name: "Determine changed modules" + runs-on: ubuntu-22.04 + if: (github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || github.event_name == 'pull_request' + outputs: + modules: ${{ steps.changed-modules.outputs.modules }} + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 2 + submodules: true + + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + + - id: changed-modules + run: | + git diff --name-only HEAD~1 | xargs printf -- '--changed-git-paths %s\n' | xargs ./gradlew writeChangedProjects --output-file-path=modules.json + echo modules=$(cat modules.json) >> $GITHUB_OUTPUT + + unit_tests: + name: "Unit Tests" + runs-on: ubuntu-22.04 + needs: + - determine_changed + strategy: + fail-fast: false + matrix: + module: ${{ fromJSON(needs.determine_changed.outputs.modules) }} + + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 2 + submodules: true + + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + + - name: Pull genai-common + if: matrix.module == ':firebase-vertexai' + run: | + git clone https://github.com/google-gemini/generative-ai-android.git + cd generative-ai-android + ./gradlew :common:updateVersion common:publishToMavenLocal + cd .. + + - name: Clone mock responses + if: matrix.module == ':firebase-vertexai' + run: | + firebase-vertexai/update_responses.sh + + - name: Add google-services.json + env: + INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.INTEG_TESTS_GOOGLE_SERVICES }} + run: | + echo $INTEG_TESTS_GOOGLE_SERVICES | base64 -d > google-services.json + + - name: ${{ matrix.module }} Unit Tests + env: + FIREBASE_CI: 1 + run: | + ./gradlew ${{matrix.module}}:check withErrorProne + - name: Compute upload file name + run: | + MODULE=${{matrix.module}} + echo "ARTIFACT_NAME=${MODULE//:/_}" >> $GITHUB_ENV + - name: Upload Test Results + uses: actions/upload-artifact@v4.3.3 + if: always() + with: + name: unit-test-result-${{env.ARTIFACT_NAME}} + path: "**/build/test-results/**/*.xml" + retention-days: 7 + if-no-files-found: ignore + + # A job that fails if any job in the unit_tests matrix fails, + # to be used as a required check for merging. + check_all: + runs-on: ubuntu-22.04 + if: always() + name: Unit Tests (matrix) + needs: unit_tests + steps: + - name: Check test matrix + if: needs.unit_tests.result != 'success' + run: exit 1 + + + integ_tests: + name: "Instrumentation Tests" + # only run on post submit or PRs not originating from forks. + if: (github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) + runs-on: ubuntu-22.04 + needs: + - determine_changed + strategy: + fail-fast: false + matrix: + module: ${{ fromJSON(needs.determine_changed.outputs.modules) }} + exclude: + - module: :firebase-firestore + + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 2 + submodules: true + + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + + - name: Add google-services.json + env: + INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.INTEG_TESTS_GOOGLE_SERVICES }} + run: | + echo $INTEG_TESTS_GOOGLE_SERVICES | base64 -d > google-services.json + - uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} + - uses: google-github-actions/setup-gcloud@v2 + - name: ${{ matrix.module }} Integ Tests + env: + FIREBASE_CI: 1 + FTL_RESULTS_BUCKET: android-ci + FTL_RESULTS_DIR: ${{ github.event_name == 'pull_request' && format('pr-logs/pull/{0}/{1}/{2}/{3}_{4}/artifacts/', github.repository, github.event.pull_request.number, github.job, github.run_id, github.run_attempt) || format('logs/{0}/{1}_{2}/artifacts/', github.workflow, github.run_id, github.run_attempt)}} + FIREBASE_APP_CHECK_DEBUG_SECRET: ${{ secrets.FIREBASE_APP_CHECK_DEBUG_SECRET }} + run: | + ./gradlew ${{matrix.module}}:deviceCheck withErrorProne -PtargetBackend="prod" + + publish-test-results: + name: "Publish Tests Results" + needs: + - unit_tests + runs-on: ubuntu-22.04 + + permissions: + checks: write + + # only needed unless run with comment_mode: off + pull-requests: write + + if: always() + + steps: + - name: Download Artifacts + uses: actions/download-artifact@v4.1.7 + with: + path: artifacts + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@82082dac68ad6a19d980f8ce817e108b9f496c2a + with: + files: "artifacts/**/*.xml" diff --git a/.github/workflows/config-e2e.yml b/.github/workflows/config-e2e.yml new file mode 100644 index 00000000000..604115b324d --- /dev/null +++ b/.github/workflows/config-e2e.yml @@ -0,0 +1,42 @@ +name: Firebase Remote Config E2E Tests + +on: + schedule: + - cron: 24 */4 * * * # every 4 hours @ 24 minutes past the hour + workflow_dispatch: # allow triggering the workflow manually + +concurrency: + group: ${{ github.workflow }} + +env: + REMOTE_CONFIG_E2E_GOOGLE_SERVICES: ${{ secrets.REMOTE_CONFIG_E2E_GOOGLE_SERVICES }} + +jobs: + test: + + runs-on: ubuntu-latest + + steps: + - name: Checkout firebase-config + uses: actions/checkout@v4.1.1 + + - name: set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: '17' + distribution: 'temurin' + cache: gradle + + - name: Add google-services.json + run: | + echo $REMOTE_CONFIG_E2E_GOOGLE_SERVICES | base64 -d > google-services.json + + - uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GCP_service_account }} + - uses: google-github-actions/setup-gcloud@v2 + - name: Run Remote Config end-to-end tests + env: + FTL_RESULTS_BUCKET: fireescape + run: | + ./gradlew :firebase-config:test-app:deviceCheck withErrorProne -PtargetBackend="prod" diff --git a/.github/workflows/copyright-check.yml b/.github/workflows/copyright-check.yml new file mode 100644 index 00000000000..b9e3aeba227 --- /dev/null +++ b/.github/workflows/copyright-check.yml @@ -0,0 +1,27 @@ +name: Copyright check + +on: pull_request + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + copyright-check: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4.1.1 + - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 + with: + python-version: '3.9' + - run: | + pip install -e "ci/fireci" + - run: | + fireci copyright_check \ + -e py \ + -e gradle \ + -e java \ + -e kt \ + -e groovy \ + -e sh \ + -e proto diff --git a/.github/workflows/create_releases.yml b/.github/workflows/create_releases.yml new file mode 100644 index 00000000000..8920ee50d09 --- /dev/null +++ b/.github/workflows/create_releases.yml @@ -0,0 +1,50 @@ +name: Create release + +on: + workflow_dispatch: + inputs: + name: + description: 'Release name' + required: true + type: string + past-name: + description: 'Past release name' + required: true + type: string + +jobs: + create-branches: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Create base branch + uses: peterjgrainger/action-create-branch@08259812c8ebdbf1973747f9297e332fa078d3c1 + with: + branch: 'releases/${{ inputs.name }}' + + create-pull-request: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 0 + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + - name: Create release configuration template + run: | + ./gradlew generateReleaseConfig -PcurrentRelease=${{ inputs.name }} -PpastRelease=${{ inputs.past-name }} -PprintOutput=true + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v4 + with: + base: 'releases/${{ inputs.name }}' + branch: 'releases/${{ inputs.name }}.release' + add-paths: release.json,release_report.md,release_report.json + title: '${{ inputs.name}} release' + body: 'Auto-generated PR for release ${{ inputs.name}}' + commit-message: 'Create release config for ${{ inputs.name }}' diff --git a/.github/workflows/dataconnect_demo_app.yml b/.github/workflows/dataconnect_demo_app.yml new file mode 100644 index 00000000000..7ce51814b4d --- /dev/null +++ b/.github/workflows/dataconnect_demo_app.yml @@ -0,0 +1,164 @@ +name: Data Connect Demo App + +on: + workflow_dispatch: + inputs: + nodeVersion: + firebaseToolsVersion: + javaVersion: + gradleInfoLog: + type: boolean + pull_request: + paths: + - firebase-dataconnect/demo/** + - .github/workflows/dataconnect_demo_app.yml + schedule: + - cron: '0 11 * * *' # Run nightly at 11am UTC (3am Pacific, 6am Eastern) + +env: + FDC_NODE_VERSION: ${{ inputs.nodeVersion || '20' }} + FDC_FIREBASE_TOOLS_VERSION: ${{ inputs.firebaseToolsVersion || '13.28.0' }} + FDC_JAVA_VERSION: ${{ inputs.javaVersion || '17' }} + FDC_FIREBASE_TOOLS_DIR: ${{ github.workspace }}/firebase-tools + FDC_FIREBASE_COMMAND: ${{ github.workspace }}/firebase-tools/node_modules/.bin/firebase + +defaults: + run: + shell: bash + working-directory: firebase-dataconnect/demo + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test: + continue-on-error: false + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + sparse-checkout: firebase-dataconnect/demo + + - name: Create Cache Key Files + run: | + echo "gmagjr2b9d" >github_actions_demo_test_cache_key.txt + echo "${{ env.FDC_FIREBASE_TOOLS_VERSION }}" >github_actions_demo_assemble_firebase_tools_version.txt + + - uses: actions/setup-node@v3 + with: + node-version: ${{ env.FDC_NODE_VERSION }} + cache: 'npm' + cache-dependency-path: | + firebase-dataconnect/demo/github_actions_demo_test_cache_key.txt + firebase-dataconnect/demo/github_actions_demo_assemble_firebase_tools_version.txt + + - name: cache package-lock.json + id: package_json_lock + uses: actions/cache@v4 + with: + path: ${{ env.FDC_FIREBASE_TOOLS_DIR }}/package*.json + key: firebase_tools_package_json-${{ env.FDC_FIREBASE_TOOLS_VERSION }} + + - name: install firebase-tools from scratch + if: steps.package_json_lock.outputs.cache-hit != 'true' + run: | + set -v + mkdir -p ${{ env.FDC_FIREBASE_TOOLS_DIR }} + cd ${{ env.FDC_FIREBASE_TOOLS_DIR }} + echo '{}' > package.json + npm install --fund=false --audit=false --save --save-exact firebase-tools@${{ env.FDC_FIREBASE_TOOLS_VERSION }} + + - name: install firebase-tools from package-lock.json + if: steps.package_json_lock.outputs.cache-hit == 'true' + run: | + cd ${{ env.FDC_FIREBASE_TOOLS_DIR }} + npm ci --fund=false --audit=false + + - uses: actions/setup-java@v4 + with: + java-version: ${{ env.FDC_JAVA_VERSION }} + distribution: temurin + cache: gradle + cache-dependency-path: | + firebase-dataconnect/demo/build.gradle.kts + firebase-dataconnect/demo/gradle.properties + firebase-dataconnect/demo/gradle/wrapper/gradle-wrapper.properties + firebase-dataconnect/demo/github_actions_demo_test_cache_key.txt + + - name: tool versions + continue-on-error: true + run: | + set +e -v + which java + java -version + which javac + javac -version + which node + node --version + ${{ env.FDC_FIREBASE_COMMAND }} --version + ./gradlew --version + + - name: ./gradlew assemble test + run: | + set -x + ./gradlew \ + --no-daemon \ + ${{ (inputs.gradleInfoLog && '--info') || '' }} \ + --profile \ + -PdataConnect.minimalApp.firebaseCommand=${{ env.FDC_FIREBASE_COMMAND }} \ + assemble test + + - uses: actions/upload-artifact@v4 + with: + name: apks + path: firebase-dataconnect/demo/build/**/*.apk + if-no-files-found: warn + compression-level: 0 + + - uses: actions/upload-artifact@v4 + with: + name: gradle_build_reports + path: firebase-dataconnect/demo/build/reports/ + if-no-files-found: warn + compression-level: 9 + + spotlessCheck: + continue-on-error: false + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + sparse-checkout: firebase-dataconnect/demo + + - name: Create Cache Key Files + run: echo "h99ee4egfd" >github_actions_demo_spotless_cache_key.txt + + - uses: actions/setup-java@v4 + with: + java-version: ${{ env.FDC_JAVA_VERSION }} + distribution: temurin + cache: gradle + cache-dependency-path: | + firebase-dataconnect/demo/build.gradle.kts + firebase-dataconnect/demo/gradle.properties + firebase-dataconnect/demo/gradle/wrapper/gradle-wrapper.properties + firebase-dataconnect/demo/github_actions_demo_spotless_cache_key.txt + + - name: tool versions + continue-on-error: true + run: | + set +e -v + which java + java -version + which javac + javac -version + ./gradlew --version + + - name: ./gradlew spotlessCheck + run: | + set -x + ./gradlew \ + --no-daemon \ + ${{ (inputs.gradleInfoLog && '--info') || '' }} \ + spotlessCheck diff --git a/.github/workflows/diff-javadoc.yml b/.github/workflows/diff-javadoc.yml new file mode 100644 index 00000000000..c780e07c714 --- /dev/null +++ b/.github/workflows/diff-javadoc.yml @@ -0,0 +1,64 @@ +name: Diff Javadoc + +on: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: Make diff directory + run: mkdir ~/diff + + - name: Checkout PR branch + uses: actions/checkout@v4.1.1 + with: + fetch-depth: 2 + submodules: true + + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + + - name: Generate docs for PR branch + run: ./gradlew kotlindoc + + - name: Move branch docs to diff directory + run: mv build ~/diff/modified + + - name: Checkout main + uses: actions/checkout@v4.1.1 + with: + ref: ${{ github.base_ref }} + + - name: Generate docs for main + run: ./gradlew kotlindoc + + - name: Move main docs to diff directory + run: mv build ~/diff/original + + - name: Get diff between main and Branch docs + run: > + `# Recursively diff directories, including new files, git style, with 3 lines of context` + diff -wEburN ~/diff/original ~/diff/modified + `# Remove the first line and new file signifier of the output` + | tail -n +2 + `# Replace the diff new file signifier with the end and start of a new codeblock` + | sed "s/^diff.*$/\`\`\`\\n\`\`\`diff/g" + `# Add a collapsable block, summary, and start the first code block on the first line` + | sed "1s/^/
\\nJavadoc Changes:<\/summary>\\n\\n\`\`\`diff\\n/" + `# Close the final code block and close the collapsable on the final line` + | sed "$ s/$/\\n\`\`\`\\n<\/details>/" + `# Write to diff.md for later` + > diff.md + + - name: Add comment + continue-on-error: true + uses: mshick/add-pr-comment@a65df5f64fc741e91c59b8359a4bc56e57aaf5b1 + with: + message-path: diff.md diff --git a/.github/workflows/fireci.yml b/.github/workflows/fireci.yml new file mode 100644 index 00000000000..b375d6bb93d --- /dev/null +++ b/.github/workflows/fireci.yml @@ -0,0 +1,27 @@ +name: Run fireci tests + +on: + pull_request: + paths: + - 'ci/**' + - '.github/workflows/fireci.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + fireci: + name: "fireci tests" + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4.1.1 + - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 + with: + python-version: '3.8' + - run: | + pip install -e "ci/fireci[test]" + - run: | + pytest ci/fireci + - run: | + mypy --config-file ci/fireci/setup.cfg ci/fireci/ diff --git a/.github/workflows/fireperf-e2e.yml b/.github/workflows/fireperf-e2e.yml new file mode 100644 index 00000000000..9299ba57000 --- /dev/null +++ b/.github/workflows/fireperf-e2e.yml @@ -0,0 +1,107 @@ +name: FirePerf E2E Tests + +on: + schedule: + - cron: 4 */4 * * * # every 4 hours at 04 minutes past the hour + workflow_dispatch: # allow triggering the workflow manually + +concurrency: + group: ${{ github.workflow }} + +env: + PERF_E2E_GOOGLE_SERVICES: ${{ secrets.PERF_E2E_GOOGLE_SERVICES }} + FTL_RESULTS_BUCKET: fireescape + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + environment: [ prod, autopush ] + steps: + - name: Checkout firebase-android-sdk + uses: actions/checkout@v4.1.1 + - name: Checkout firebase-android-buildtools + uses: actions/checkout@v4.1.1 + with: + repository: FirebasePrivate/firebase-android-buildtools + token: ${{ secrets.GOOGLE_OSS_BOT_TOKEN }} + path: firebase-android-buildtools + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + - name: Set up Python 3.10 + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 + with: + python-version: '3.10' + - name: Set up fireci + run: pip3 install -e ci/fireci + - uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} + - uses: google-github-actions/setup-gcloud@v2 + - name: Add google-services.json + run: echo $PERF_E2E_GOOGLE_SERVICES | base64 -d > google-services.json + - name: Run fireperf end-to-end tests + run: | + fireci fireperf_e2e_test \ + --plugin_repo_dir=firebase-android-buildtools \ + --target_environment=${{ matrix.environment }} + - name: Notify developers upon failures + if: ${{ failure() }} + uses: actions/github-script@v6 + with: + script: | + const owner = context.repo.owner; + const repo = context.repo.repo; + const commit = context.sha; + const run = context.runId; + const url = `https://github.com/${owner}/${repo}/actions/runs/${run}`; + + const datetime = (new Date()).toLocaleString('en-US', { + timeZone: 'America/Los_Angeles', + dateStyle: 'medium', + timeStyle: 'long', + }); + + const text = + `Failed on commit ${commit} at ${datetime}. + + ${url}`; + + const { data: issues } = await github.rest.issues.listForRepo({ + owner: owner, + repo: repo, + state: 'open', + labels: 'fireperf-e2e-tests' + }); + + if (issues.length) { + github.rest.issues.createComment({ + owner: owner, + repo: repo, + issue_number: issues[0].number, + body: text, + }); + } else { + github.rest.issues.create({ + owner: owner, + repo: repo, + title: 'FirePerf E2E Test Failures', + body: text, + labels: ['fireperf-e2e-tests'], + assignees: ['raymondlam', 'visumickey'] + }); + } + - name: Upload test artifacts + if: always() + uses: actions/upload-artifact@v4.3.3 + with: + name: test-artifacts (${{ matrix.environment }}) + path: | + ~/.m2/repository/com/google/firebase/perf-plugin + **/build/reports + **/build/test-results diff --git a/.github/workflows/firestore_ci_tests.yml b/.github/workflows/firestore_ci_tests.yml new file mode 100644 index 00000000000..00ce91b4e92 --- /dev/null +++ b/.github/workflows/firestore_ci_tests.yml @@ -0,0 +1,261 @@ +name: Firestore CI Tests +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +on: + pull_request: + push: + branches: + - main + +jobs: + determine_changed: + name: "Determine changed modules" + runs-on: ubuntu-latest + if: (github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || github.event_name == 'pull_request' + outputs: + modules: ${{ steps.changed-modules.outputs.modules }} + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 2 + submodules: true + + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + + - id: changed-modules + run: | + git diff --name-only HEAD~1 | xargs printf -- '--changed-git-paths %s\n' | xargs ./gradlew writeChangedProjects --output-file-path=modules.json + echo modules=$(cat modules.json) >> $GITHUB_OUTPUT + + integ_tests: + name: "System Tests" + # only run on post submit or PRs not originating from forks. + if: ((github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)) && contains(fromJSON(needs.determine_changed.outputs.modules), ':firebase-firestore') + runs-on: ubuntu-latest + needs: + - determine_changed + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 2 + submodules: true + + - name: Enable KVM + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + + - name: Add google-services.json + env: + INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.INTEG_TESTS_GOOGLE_SERVICES }} + run: | + echo $INTEG_TESTS_GOOGLE_SERVICES | base64 -d > google-services.json + - uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} + - uses: google-github-actions/setup-gcloud@v2 + - name: firebase-firestore Integ Tests + uses: reactivecircus/android-emulator-runner@v2 + env: + FIREBASE_CI: 1 + FTL_RESULTS_BUCKET: android-ci + FTL_RESULTS_DIR: ${{ github.event_name == 'pull_request' && format('pr-logs/pull/{0}/{1}/{2}/{3}_{4}/artifacts/', github.repository, github.event.pull_request.number, github.job, github.run_id, github.run_attempt) || format('logs/{0}/{1}_{2}/artifacts/', github.workflow, github.run_id, github.run_attempt)}} + FIREBASE_APP_CHECK_DEBUG_SECRET: ${{ secrets.FIREBASE_APP_CHECK_DEBUG_SECRET }} + with: + api-level: 31 + arch: x86_64 + ram-size: 4096M + heap-size: 4096M + script: | + adb logcat -v time > logcat.txt & + ./gradlew firebase-firestore:connectedCheck withErrorProne -PtargetBackend="prod" + - name: Upload logs + if: failure() + uses: actions/upload-artifact@v4.3.3 + with: + name: logcat.txt + path: logcat.txt + retention-days: 7 + if-no-files-found: ignore + + + named_integ_tests: + name: "System Tests With Named DB" + runs-on: ubuntu-latest + needs: + - determine_changed + # only run on post submit or PRs not originating from forks. + if: ((github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)) && contains(fromJSON(needs.determine_changed.outputs.modules), ':firebase-firestore') + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 2 + submodules: true + + - name: Enable KVM + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + + - name: Add google-services.json + env: + INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.INTEG_TESTS_GOOGLE_SERVICES }} + run: | + echo $INTEG_TESTS_GOOGLE_SERVICES | base64 -d > google-services.json + - uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} + - uses: google-github-actions/setup-gcloud@v2 + + # create composite indexes with Terraform + - name: Setup Terraform + uses: hashicorp/setup-terraform@v2 + - name: Terraform Init + run: | + cd firebase-firestore + terraform init + continue-on-error: true + - name: Terraform Apply + if: github.event_name == 'pull_request' + run: | + cd firebase-firestore + + # Define a temporary file, redirect both stdout and stderr to the file + output_file=$(mktemp) + if ! terraform apply -var-file=../google-services.json -auto-approve > "$output_file" 2>&1 ; then + cat "$output_file" + if cat "$output_file" | grep -q "index already exists"; then + echo "===================================================================================" + echo -e "\e[93m\e[1mTerraform apply failed due to index already exists; We can safely ignore this error.\e[0m" + echo "===================================================================================" + fi + exit 1 + fi + rm -f "$output_file" + continue-on-error: true + + - name: Firestore Named DB Integ Tests + timeout-minutes: 20 + uses: reactivecircus/android-emulator-runner@v2 + env: + FIREBASE_CI: 1 + FTL_RESULTS_BUCKET: android-ci + FTL_RESULTS_DIR: ${{ github.event_name == 'pull_request' && format('pr-logs/pull/{0}/{1}/{2}/{3}_{4}/artifacts/', github.repository, github.event.pull_request.number, github.job, github.run_id, github.run_attempt) || format('logs/{0}/{1}_{2}/artifacts/', github.workflow, github.run_id, github.run_attempt)}} + FIREBASE_APP_CHECK_DEBUG_SECRET: ${{ secrets.FIREBASE_APP_CHECK_DEBUG_SECRET }} + with: + api-level: 31 + arch: x86_64 + ram-size: 4096M + heap-size: 4096M + script: | + adb logcat -v time > logcat.txt & + ./gradlew firebase-firestore:connectedCheck withErrorProne -PtargetBackend="prod" + - name: Upload logs + if: failure() + uses: actions/upload-artifact@v4.3.3 + with: + name: named-db-logcat.txt + path: logcat.txt + retention-days: 7 + if-no-files-found: ignore + + firestore_nightly_integ_tests: + name: "System Tests Against Nightly" + runs-on: ubuntu-latest + needs: + - determine_changed + # only run on post submit or PRs not originating from forks. + if: ((github.repository == 'Firebase/firebase-android-sdk' && github.event_name == 'push') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)) && contains(fromJSON(needs.determine_changed.outputs.modules), ':firebase-firestore') + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 2 + submodules: true + + - name: Enable KVM + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + + - name: Add google-services.json + env: + INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.NIGHTLY_INTEG_TESTS_GOOGLE_SERVICES }} + run: | + echo $INTEG_TESTS_GOOGLE_SERVICES > google-services.json + - uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} + - uses: google-github-actions/setup-gcloud@v2 + + - name: Firestore Nightly Integ Tests + uses: reactivecircus/android-emulator-runner@v2 + env: + FIREBASE_CI: 1 + FTL_RESULTS_BUCKET: android-ci + FTL_RESULTS_DIR: ${{ github.event_name == 'pull_request' && format('pr-logs/pull/{0}/{1}/{2}/{3}_{4}/artifacts/', github.repository, github.event.pull_request.number, github.job, github.run_id, github.run_attempt) || format('logs/{0}/{1}_{2}/artifacts/', github.workflow, github.run_id, github.run_attempt)}} + FIREBASE_APP_CHECK_DEBUG_SECRET: ${{ secrets.FIREBASE_APP_CHECK_DEBUG_SECRET }} + with: + api-level: 31 + arch: x86_64 + ram-size: 4096M + heap-size: 4096M + script: | + adb logcat -v time > logcat.txt & + ./gradlew firebase-firestore:connectedCheck withErrorProne -PtargetBackend="nightly" + - name: Upload logs + if: failure() + uses: actions/upload-artifact@v4.3.3 + with: + name: nightly-logcat.txt + path: logcat.txt + retention-days: 7 + if-no-files-found: ignore + + check-required-tests: + runs-on: ubuntu-latest + if: always() + name: Check all required Firestore tests results + needs: [integ_tests, named_integ_tests] + steps: + - name: Check test matrix + if: needs.integ_tests.result == 'failure' || needs.named_integ_tests.result == 'failure' + run: exit 1 diff --git a/.github/workflows/health-metrics.yml b/.github/workflows/health-metrics.yml new file mode 100644 index 00000000000..0b20dcd1078 --- /dev/null +++ b/.github/workflows/health-metrics.yml @@ -0,0 +1,134 @@ +name: Health Metrics + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + +on: + pull_request: + push: + branches: + - main + # add other feature branches here + # TODO(yifany): support workflow_dispatch for metric tests (or only for startup time test) + +env: + GITHUB_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} + +jobs: + coverage: + name: Coverage + if: | + (github.event_name == 'push' && github.repository == 'firebase/firebase-android-sdk') + || (github.event_name == 'pull_request' + && github.event.pull_request.head.repo.full_name == github.repository) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 2 + submodules: true + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + - name: Set up Python 3.10 + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 + with: + python-version: '3.10' + - uses: google-github-actions/auth@v2 + with: + credentials_json: '${{ secrets.GCP_SERVICE_ACCOUNT }}' + - uses: google-github-actions/setup-gcloud@v2 + - name: Set up fireci + run: pip3 install -e ci/fireci + - name: Run coverage tests (presubmit) + if: ${{ github.event_name == 'pull_request' }} + run: fireci coverage --pull-request + - name: Run coverage tests (post-submit) + if: ${{ github.event_name == 'push' }} + run: fireci coverage + + size: + name: Size + if: | + (github.event_name == 'push' && github.repository == 'firebase/firebase-android-sdk') + || (github.event_name == 'pull_request' + && github.event.pull_request.head.repo.full_name == github.repository) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 2 + submodules: true + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + - name: Set up Python 3.10 + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 + with: + python-version: '3.10' + - uses: google-github-actions/auth@v2 + with: + credentials_json: '${{ secrets.GCP_SERVICE_ACCOUNT }}' + - uses: google-github-actions/setup-gcloud@v2 + - name: Set up fireci + run: pip3 install -e ci/fireci + - name: Run size tests (presubmit) + if: ${{ github.event_name == 'pull_request' }} + run: fireci binary_size --pull-request + - name: Run size tests (post-submit) + if: ${{ github.event_name == 'push' }} + run: fireci binary_size + + startup_time: + name: Startup Time + if: | + (github.event_name == 'push' && github.repository == 'firebase/firebase-android-sdk') + || (github.event_name == 'pull_request' + && github.event.pull_request.head.repo.full_name == github.repository + && github.event.pull_request.base.ref == 'main') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 2 + submodules: true + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + - name: Set up Python 3.10 + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 + with: + python-version: '3.10' + - uses: google-github-actions/auth@v2 + with: + credentials_json: '${{ secrets.GCP_SERVICE_ACCOUNT }}' + - uses: google-github-actions/setup-gcloud@v2 + - name: Set up fireci + run: pip3 install -e ci/fireci + - name: Add google-services.json + env: + INTEG_TESTS_GOOGLE_SERVICES: ${{ secrets.INTEG_TESTS_GOOGLE_SERVICES }} + BENCHMARK_APP_LOCATION: health-metrics/benchmark/template/app/google-services.json + run: | + echo $INTEG_TESTS_GOOGLE_SERVICES | base64 -d > $BENCHMARK_APP_LOCATION + - name: Run startup-time tests (presubmit) + if: ${{ github.event_name == 'pull_request' }} + run: | + git diff --name-only HEAD~1 | \ + xargs printf -- '--changed-git-paths %s\n' | \ + xargs ./gradlew writeChangedProjects --output-file-path=modules.json + fireci macrobenchmark ci --pull-request --changed-modules-file modules.json + - name: Run startup-time tests (post-submit) + if: ${{ github.event_name == 'push' }} + run: | + fireci macrobenchmark ci --push diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml new file mode 100644 index 00000000000..c1683b58de8 --- /dev/null +++ b/.github/workflows/jekyll-gh-pages.yml @@ -0,0 +1,55 @@ +name: Jekyll with GitHub Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] + paths: + - '.github/workflows/jekyll-gh-pages.yml' + - 'contributor-docs/**' + pull_request: + paths: + - '.github/workflows/jekyll-gh-pages.yml' + - 'contributor-docs/**' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4.1.1 + - name: Setup Pages + uses: actions/configure-pages@v2 + - name: Build with Jekyll + uses: actions/jekyll-build-pages@v1 + with: + source: ./contributor-docs + destination: ./_site + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + + deploy: + if: ${{ github.event_name == 'push' && github.repository == 'firebase/firebase-android-sdk' }} + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 diff --git a/.github/workflows/make-bom.yml b/.github/workflows/make-bom.yml new file mode 100644 index 00000000000..0ad2ecf4add --- /dev/null +++ b/.github/workflows/make-bom.yml @@ -0,0 +1,39 @@ +name: Make BoM + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Set up Python 3.10 + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 + with: + python-version: '3.10' + - uses: actions/checkout@v4.1.1 + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + + - name: Build + run: | + ./ci/run.sh \ + --artifact-target-dir=./logs/artifacts \ + --artifact-patterns=bom.zip \ + --artifact-patterns=bomReleaseNotes.md \ + --artifact-patterns=recipeVersionUpdate.txt \ + gradle \ + -- \ + --build-cache \ + buildBomZip + + - name: Upload generated artifacts + uses: actions/upload-artifact@v4.3.3 + with: + name: artifacts + path: ./logs/artifacts/ + retention-days: 5 diff --git a/.github/workflows/merge-to-main.yml b/.github/workflows/merge-to-main.yml new file mode 100644 index 00000000000..4df37c57891 --- /dev/null +++ b/.github/workflows/merge-to-main.yml @@ -0,0 +1,30 @@ +name: Merge to main + +on: + pull_request: + branches: + - main + types: + - opened + - labeled + - unlabeled + +jobs: + pr-message: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: mshick/add-pr-comment@a65df5f64fc741e91c59b8359a4bc56e57aaf5b1 + with: + message: > + ### 📝 PRs merging into main branch + + **Our main branch should always be in a releasable state**. + If you are working on a larger change, or if you don't want + this change to see the light of the day just yet, consider + using a feature branch first, and only merge into the main + branch when the code complete and ready to be released. + + - name: Success + run: exit 0 diff --git a/.github/workflows/plugins-check.yml b/.github/workflows/plugins-check.yml new file mode 100644 index 00000000000..fa482c36d35 --- /dev/null +++ b/.github/workflows/plugins-check.yml @@ -0,0 +1,32 @@ +name: Check plugins + +on: + pull_request: + paths: + - 'plugins/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + plugins-check: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4.1.1 + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + - name: plugins tests + env: + FIREBASE_CI: 1 + run: | + ./gradlew plugins:check + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@82082dac68ad6a19d980f8ce817e108b9f496c2a + with: + files: "**/build/test-results/**/*.xml" + check_name: "plugins test results" diff --git a/.github/workflows/post_release_cleanup.yml b/.github/workflows/post_release_cleanup.yml new file mode 100644 index 00000000000..8206b735a11 --- /dev/null +++ b/.github/workflows/post_release_cleanup.yml @@ -0,0 +1,46 @@ +name: Post release cleanup + +on: + workflow_dispatch: + inputs: + name: + description: 'Release name' + required: true + type: string + +jobs: + create-pull-request: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 0 + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + - name: Run post release cleanup task + run: | + ./gradlew postReleaseCleanup + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v4 + with: + token: ${{ secrets.GOOGLE_OSS_BOT_TOKEN }} + committer: google-oss-bot + assignees: ${{ github.actor }} + base: 'main' + branch: 'releases/${{ inputs.name }}.mergeback' + add-paths: | + **/CHANGELOG.md + **/gradle.properties + **/*.gradle + **/*.gradle.kts + title: '${{ inputs.name}} mergeback' + body: | + Auto-generated PR for cleaning up release ${{ inputs.name}} + + NO_RELEASE_CHANGE + commit-message: 'Post release cleanup for ${{ inputs.name }}' diff --git a/.github/workflows/private-mirror-sync.yml b/.github/workflows/private-mirror-sync.yml new file mode 100644 index 00000000000..324993eb791 --- /dev/null +++ b/.github/workflows/private-mirror-sync.yml @@ -0,0 +1,30 @@ +name: Private Mirror Sync + +on: + workflow_dispatch: + schedule: + - cron: '0 2 * * *' + +jobs: + sync: + if: github.repository == 'FirebasePrivate/firebase-android-sdk' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + with: + repository: firebase/firebase-android-sdk + ref: main + fetch-depth: 0 + submodules: true + + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 0 + submodules: true + token: ${{ secrets.GOOGLE_OSS_BOT_TOKEN }} + - name: Force push HEAD to private repo main branch + run: | + git config --local user.name google-oss-bot + git config --local user.email firebase-oss-bot@google.com + git remote add mirror https://github.com/FirebasePrivate/firebase-android-sdk.git + git push mirror HEAD:main --force --verbose diff --git a/.github/workflows/release-note-changes.yml b/.github/workflows/release-note-changes.yml new file mode 100644 index 00000000000..06d42153ea4 --- /dev/null +++ b/.github/workflows/release-note-changes.yml @@ -0,0 +1,67 @@ +name: Release note changes + +on: + pull_request: + branches: + - 'main' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 0 + + - name: Create output file + run: touch changelog_comment.md + + - name: Get changed changelog files + id: changed-files + uses: tj-actions/changed-files@v41.0.0 + with: + files_ignore: | + plugins/** + files: | + **/CHANGELOG.md + + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + + - name: Set up Python 3.10 + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 + if: ${{ steps.changed-files.outputs.any_changed == 'true' }} + with: + python-version: '3.10' + + - name: Set up fireci + id: install-fireci + if: ${{ steps.changed-files.outputs.any_changed == 'true' }} + run: pip3 install -e ci/fireci + + - name: Generate comment + id: generate-comment + if: ${{ steps.install-fireci.outcome == 'success' }} + run: | + fireci changelog_comment -c "${{ steps.changed-files.outputs.all_changed_files }}" -o ./changelog_comment.md + + - name: Add PR Comment + uses: mshick/add-pr-comment@v2.8.1 + continue-on-error: true + with: + status: ${{ steps.generate-comment.outcome }} + message-path: ./changelog_comment.md + message-skipped: | + ## Release note changes + No release note changes were detected. If you made changes that should be + present in the next release, ensure you've added an entry in the appropriate + `CHANGELOG.md` file(s). + message-failure: | + ## Release note changes + A `CHANGELOG.md` file seems to not match the expected format. + Please ensure your changelog files are following the format as + defined in [our documentation](#). diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml new file mode 100644 index 00000000000..22bd7f8e3c2 --- /dev/null +++ b/.github/workflows/scorecards.yml @@ -0,0 +1,86 @@ +# Copyright 2023 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. + +# Workflow for the OSSF Scorecards Action +# https://github.com/ossf/scorecard-action#installation + +name: Scorecard supply-chain security +on: + # For Branch-Protection check. Only the default branch is supported. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection + branch_protection_rule: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained + schedule: + - cron: '35 10 * * 4' + push: + branches: + - main + +# Declare default permissions as read only. +permissions: read-all + +jobs: + analysis: + name: OpenSSF Scorecard analysis + runs-on: ubuntu-latest + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + # Needed to publish results and get a badge (see publish_results below). + id-token: write + # Uncomment the permissions below if installing in a private repository. + # contents: read + # actions: read + + steps: + - name: Checkout code + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + with: + persist-credentials: false + + - name: Run analysis + uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 + with: + results_file: results.sarif + results_format: sarif + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecard on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. + # repo_token: ${{ secrets.SCORECARD_TOKEN }} + + # Public repositories: + # - Publish results to OpenSSF REST API for easy access by consumers + # - Allows the repository to include the Scorecard badge. + # - See https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories: + # - `publish_results` will always be set to `false`, regardless + # of the value entered here. + publish_results: true + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. + - name: Upload artifact + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard. + - name: Upload to code-scanning + uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9 + with: + sarif_file: results.sarif diff --git a/.github/workflows/semver-check.yml b/.github/workflows/semver-check.yml new file mode 100644 index 00000000000..2fc7eb38843 --- /dev/null +++ b/.github/workflows/semver-check.yml @@ -0,0 +1,22 @@ +name: Semver Check + +on: + workflow_dispatch: + pull_request: + branches: + - 'releases/**' + +jobs: + semver-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + - name: Perform gradle build + run: | + ./gradlew semverCheckForRelease diff --git a/.github/workflows/sessions-e2e.yml b/.github/workflows/sessions-e2e.yml new file mode 100644 index 00000000000..048cd92eee9 --- /dev/null +++ b/.github/workflows/sessions-e2e.yml @@ -0,0 +1,42 @@ +name: Firebase Sessions E2E Tests + +on: + schedule: + - cron: 24 */4 * * * # every 4 hours at 24 minutes past the hour + workflow_dispatch: # allow triggering the workflow manually + +concurrency: + group: ${{ github.workflow }} + +env: + SESSIONS_E2E_GOOGLE_SERVICES: ${{ secrets.SESSIONS_E2E_GOOGLE_SERVICES }} + +jobs: + test: + + runs-on: ubuntu-latest + + steps: + - name: Checkout firebase-sessions + uses: actions/checkout@v4.1.1 + + - name: set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: '11' + distribution: 'temurin' + cache: gradle + + - name: Add google-services.json + run: | + echo $SESSIONS_E2E_GOOGLE_SERVICES | base64 -d > google-services.json + + - uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} + - uses: google-github-actions/setup-gcloud@v2 + - name: Run sessions end-to-end tests + env: + FTL_RESULTS_BUCKET: fireescape + run: | + ./gradlew :firebase-sessions:test-app:deviceCheck withErrorProne -PtargetBackend="prod" -PtriggerCrashes diff --git a/.github/workflows/smoke-tests.yml b/.github/workflows/smoke-tests.yml new file mode 100644 index 00000000000..07ab7dbeeb2 --- /dev/null +++ b/.github/workflows/smoke-tests.yml @@ -0,0 +1,60 @@ +name: Smoke Tests + +on: [ pull_request ] + +jobs: + smoke-tests: + if: github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 2 + submodules: true + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + - uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT }} + - uses: google-github-actions/setup-gcloud@v2 + + # TODO(yifany): make it a fireci plugin and remove the separately distributed jar file + - name: Download smoke tests runner + run: | + SMOKE_TESTS_RUNNER_URL="https://storage.googleapis.com/android-ci/smoke-tests-runner.jar" + curl ${SMOKE_TESTS_RUNNER_URL} --output runner.jar + + # TODO(yifany): remove hardcoded reference to /smoke-tests-google-services from the runner + - name: Add google-services.json + env: + SMOKE_TESTS_GOOGLE_SERVICES: ${{ secrets.SMOKE_TESTS_GOOGLE_SERVICES }} + run: | + echo $SMOKE_TESTS_GOOGLE_SERVICES | base64 -d > google-services.json + sudo mkdir /smoke-tests-google-services + sudo mv google-services.json /smoke-tests-google-services + + # TODO(yifany): remove hardcoded reference to Prow environment variables from the runner + - name: Run smoke tests + env: + FIREBASE_CI: 1 + REPO_OWNER: ${{ github.repository_owner }} + REPO_NAME: firebase-android-sdk + PULL_NUMBER: ${{ github.event.pull_request.number }} + JOB_NAME: smoke-tests + BUILD_ID: ${{ github.run_id }} + ARTIFACTS: ${{ runner.temp }} + run: java -jar runner.jar smoke-tests/runner.config + + - name: Upload test artifacts + if: always() + uses: actions/upload-artifact@v4.3.3 + with: + name: smoke-tests-artifacts + path: | + ${{ runner.temp }}/**/*.apk + ${{ runner.temp }}/**/changed-artifacts.json + ${{ runner.temp }}/**/smoke-test-dependencies.log diff --git a/.github/workflows/update-cpp-sdk-on-release.yml b/.github/workflows/update-cpp-sdk-on-release.yml new file mode 100644 index 00000000000..60ffbc47285 --- /dev/null +++ b/.github/workflows/update-cpp-sdk-on-release.yml @@ -0,0 +1,75 @@ +# Whenever a new Firebase Android SDK is released, this workflow triggers +# *another* workflow on the Firebase C++ SDK, which will check for the Android +# version update and create a PR updating its dependencies if any version +# numbers changed. +name: Update C++ SDKs on release +on: + push: + branches: + # Change the below line if the main branch is renamed. + - 'main' + paths: + # Only run this if a gradle.properties file is touched. + - '**/gradle.properties' + +jobs: + check_if_version_changed: + name: Check if released version changed + # This step checks several things, and sets released_version_changed=1 only if all are true: + # - The push must target the main branch. + # - The push must modify a gradle.properties file. + # - The push must change a "latestReleasedVersion=" line in a gradle.properties file. + runs-on: ubuntu-latest + outputs: + released_version_changed: ${{ steps.check_version.outputs.released_version_changed }} + steps: + - uses: actions/checkout@v4.1.1 + with: + # Check out the actual head commit, not any merge commit. + ref: ${{ github.sha }} + # Specify fetch-depth so we can query the log, the default is a shallow clone. + fetch-depth: 0 + - name: Check if version was updated in git history + id: check_version + run: | + # Query the git history for all gradle.properties files changed by this push. + # Then, check the diff to see if any "latestReleasedVersion=" lines changed. + if (git diff '${{ github.event.before }}' -- '**/gradle.properties' | grep -q '^[-+]latestReleasedVersion='); then + echo "released_version_changed=1" >> $GITHUB_OUTPUT + else + echo "No change to latestReleasedVersion detected since ${{ github.event.before }}" + fi + + trigger_cpp_sdk_update: + name: Trigger C++ SDK update + # If the previous step set the released_version_changed output param to 1, then + # we should trigger the C++ SDK to update its Android dependencies. + needs: check_if_version_changed + if: ${{ needs.check_if_version_changed.outputs.released_version_changed }} + # Fetch an authentication token for firebase-workflow-trigger, then use that + # token to trigger the update-dependencies workflow in firebase-cpp-sdk. + runs-on: ubuntu-latest + steps: + - name: Setup python + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 + with: + python-version: 3.7 + + - name: Check out firebase-cpp-sdk + uses: actions/checkout@v4.1.1 + with: + repository: firebase/firebase-cpp-sdk + ref: main + + - name: Get firebase-workflow-trigger token + uses: tibdex/github-app-token@021a2405c7f990db57f5eae5397423dcc554159c + id: generate-token + with: + app_id: ${{ secrets.CPP_WORKFLOW_TRIGGER_APP_ID }} + private_key: ${{ secrets.CPP_WORKFLOW_TRIGGER_APP_PRIVATE_KEY }} + repository: firebase/firebase-cpp-sdk + + - name: Trigger firebase-cpp-sdk update + run: | + pip install -r scripts/gha/python_requirements.txt + python scripts/gha/trigger_workflow.py -t ${{ steps.generate-token.outputs.token }} -w update-dependencies.yml -p updateAndroid 1 -p updateiOS 0 -p comment "[Triggered]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID) by [firebase-android-sdk $(date '+%b %d') release]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/${{ github.sha }})." -s 10 -A diff --git a/.github/workflows/validate-dependencies.yml b/.github/workflows/validate-dependencies.yml new file mode 100644 index 00000000000..c91ad8aee0c --- /dev/null +++ b/.github/workflows/validate-dependencies.yml @@ -0,0 +1,22 @@ +name: Validate Artifact Dependencies + +on: + workflow_dispatch: + pull_request: + branches: + - 'releases/**' + +jobs: + build-artifacts: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + - name: Perform gradle build + run: | + ./gradlew validatePomForRelease diff --git a/.github/workflows/version-check.yml b/.github/workflows/version-check.yml new file mode 100644 index 00000000000..f5f285e29a0 --- /dev/null +++ b/.github/workflows/version-check.yml @@ -0,0 +1,22 @@ +name: Version Check + +on: + workflow_dispatch: + pull_request: + branches: + - 'releases/**' + +jobs: + version-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + - name: Set up JDK 17 + uses: actions/setup-java@v4.1.0 + with: + java-version: 17 + distribution: temurin + cache: gradle + - name: Build + run: | + ./gradlew gmavenVersionCheck From 98da38d541d512105c934a6e214cfe8084c702f8 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 22:10:35 +0000 Subject: [PATCH 27/31] subprojects.cfg: add back firebase-crashlytics-ndk, which was accidentally removed --- subprojects.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/subprojects.cfg b/subprojects.cfg index 1b77f55e0a0..3be81de81a1 100644 --- a/subprojects.cfg +++ b/subprojects.cfg @@ -23,6 +23,7 @@ firebase-config:test-app firebase-config-interop firebase-crashlytics firebase-crashlytics:ktx +firebase-crashlytics-ndk firebase-database firebase-database:ktx firebase-database-collection From de2daa33089180928a462fb8f28d400da669142a Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 22:15:50 +0000 Subject: [PATCH 28/31] dataconnect.yml: get gradle cache before printing tool versions --- .github/workflows/dataconnect.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index 9c27cb83379..b0d01edfa4b 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -72,30 +72,34 @@ jobs: echo '{}' > package.json npm install --fund=false --audit=false --save --save-exact firebase-tools@${{ env.FDC_FIREBASE_TOOLS_VERSION }} + - name: Restore Gradle cache + uses: actions/cache/restore@v4 + if: github.event_name != 'schedule' + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-cache-jqnvfzw6w7 + - name: tool versions continue-on-error: true run: | set +e -v + echo '-----------------' uname -a + echo '-----------------' which java java -version which javac javac -version - ./gradlew --version + echo '-----------------' which node node --version + echo '-----------------' ${{ env.FDC_FIREBASE_COMMAND }} --version + echo '-----------------' ./gradlew --version - - name: Restore Gradle cache - uses: actions/cache/restore@v4 - if: github.event_name != 'schedule' - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: gradle-cache-jqnvfzw6w7 - - name: Gradle assembleDebugAndroidTest run: | set -v From 1913001cd4cedf445a1eee4755638b04d83fa04c Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 22:19:16 +0000 Subject: [PATCH 29/31] dataconnect.yml: remove annoying echos --- .github/workflows/dataconnect.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index b0d01edfa4b..049676ca50e 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -85,19 +85,14 @@ jobs: continue-on-error: true run: | set +e -v - echo '-----------------' uname -a - echo '-----------------' which java java -version which javac javac -version - echo '-----------------' which node node --version - echo '-----------------' ${{ env.FDC_FIREBASE_COMMAND }} --version - echo '-----------------' ./gradlew --version - name: Gradle assembleDebugAndroidTest From 1a535cb6eb895d594a2d1a3ec9be6db431ec1fe4 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 22:33:07 +0000 Subject: [PATCH 30/31] dataconnect.yml: minor improvements --- .github/workflows/dataconnect.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index 049676ca50e..b19bad238f9 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -105,6 +105,7 @@ jobs: echo "org.gradle.configureondemand=true" >> gradle.properties ./gradlew \ + --profile \ ${{ (inputs.gradleInfoLog && '--info') || '' }} \ :firebase-dataconnect:assembleDebugAndroidTest @@ -180,10 +181,9 @@ jobs: emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true script: | - set -euox pipefail + set -eux ./gradlew \ ${{ (inputs.gradleInfoLog && '--info') || '' }} \ - --profile \ :firebase-dataconnect:connectedCheck \ :firebase-dataconnect:connectors:connectedCheck @@ -195,6 +195,13 @@ jobs: if-no-files-found: warn compression-level: 9 + - uses: actions/upload-artifact@v4 + with: + name: gradle_build_reports + path: firebase-dataconnect/**/build/reports/ + if-no-files-found: warn + compression-level: 9 + # Check this yml file with "actionlint": https://github.com/rhysd/actionlint # To run actionlint yourself, run `brew install actionlint` followed by # `actionlint .github/workflows/dataconnect.yml` From af9f38408bd3a629becd792ac91ac43c72252676 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 22 Jan 2025 23:26:36 +0000 Subject: [PATCH 31/31] dataconnect.yml: fix multiline --- .github/workflows/dataconnect.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dataconnect.yml b/.github/workflows/dataconnect.yml index b19bad238f9..1049d031209 100644 --- a/.github/workflows/dataconnect.yml +++ b/.github/workflows/dataconnect.yml @@ -135,6 +135,8 @@ jobs: ~/.android/adb* key: avd-cache-zhdsn586je-api${{ env.FDC_ANDROID_EMULATOR_API_LEVEL }} + - run: echo "github.event_name == '${{ github.event_name }}' steps.avd-cache.outputs.cache-hit == '${{ steps.avd-cache.outputs.cache-hit }}'" + - name: Create AVD if: github.event_name == 'schedule' || steps.avd-cache.outputs.cache-hit != 'true' uses: reactivecircus/android-emulator-runner@v2 @@ -181,11 +183,7 @@ jobs: emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true script: | - set -eux - ./gradlew \ - ${{ (inputs.gradleInfoLog && '--info') || '' }} \ - :firebase-dataconnect:connectedCheck \ - :firebase-dataconnect:connectors:connectedCheck + set -eux && ./gradlew ${{ (inputs.gradleInfoLog && '--info') || '' }} :firebase-dataconnect:connectedCheck :firebase-dataconnect:connectors:connectedCheck - uses: actions/upload-artifact@v4 if: true