From e0c330df75d72d6231cbc6ff655d086d516f2422 Mon Sep 17 00:00:00 2001 From: Jon Simantov Date: Wed, 19 Jul 2023 16:43:27 -0700 Subject: [PATCH 1/4] iOS: Remove Analytics dependency from GMA integration test (#1386) * Try using CoreOnly instead of Analytics cocoapod for tests. * Update readme. --- gma/integration_test/Podfile | 2 +- release_build_files/readme.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gma/integration_test/Podfile b/gma/integration_test/Podfile index bb8fc51273..3943eeadd6 100644 --- a/gma/integration_test/Podfile +++ b/gma/integration_test/Podfile @@ -4,7 +4,7 @@ platform :ios, '11.0' use_frameworks! :linkage => :static target 'integration_test' do - pod 'Firebase/Analytics', '10.12.0' + pod 'Firebase/CoreOnly', '10.12.0' pod 'Google-Mobile-Ads-SDK', '10.8.0' end diff --git a/release_build_files/readme.md b/release_build_files/readme.md index f4b86eae14..6264e109c0 100644 --- a/release_build_files/readme.md +++ b/release_build_files/readme.md @@ -250,7 +250,7 @@ Firebase Functions | firebase_functions.xcframework | | Firebase/Auth Cocoapod (10.12.0) Google Mobile Ads | firebase_gma.xcframework | | firebase.xcframework -| | Firebase/Analytics Cocoapod (10.12.0) +| | Firebase/CoreOnly Cocoapod (10.12.0) | | Google-Mobile-Ads-SDK Cocoapod (10.8.0) Firebase Installations | firebase_installations.xcframework | | firebase.xcframework @@ -312,7 +312,7 @@ Firebase Functions | libfirebase_functions.a | | Firebase/Auth Cocoapod (10.12.0) Google Mobile Ads | libfirebase_gma.a | | libfirebase_app.a -| | Firebase/Analytics Cocoapod (10.12.0) +| | Firebase/CoreOnly Cocoapod (10.12.0) | | Google-Mobile-Ads-SDK Cocoapod (10.8.0) Firebase Installations | libfirebase_installations.a | | libfirebase_app.a From 3cd0dcade439d4856e507aa736ad212bdfcb1027 Mon Sep 17 00:00:00 2001 From: Jon Simantov Date: Thu, 20 Jul 2023 13:44:33 -0700 Subject: [PATCH 2/4] Add stub workflow for updating feature branches. --- .github/workflows/update-feature-branches.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/workflows/update-feature-branches.yml diff --git a/.github/workflows/update-feature-branches.yml b/.github/workflows/update-feature-branches.yml new file mode 100644 index 0000000000..167696a9a7 --- /dev/null +++ b/.github/workflows/update-feature-branches.yml @@ -0,0 +1,12 @@ +name: Update Feature Branches +on: + workflow_dispatch: + inputs: + +jobs: + no_op: + name: no-op + runs-on: ubuntu-20.04 + steps: + - name: noop + run: true From 00eeac87f7728d8f67bc30128a1414e1601521d1 Mon Sep 17 00:00:00 2001 From: Jon Simantov Date: Sun, 23 Jul 2023 11:36:55 -0700 Subject: [PATCH 3/4] Add script to merge main into all active feature branches on a regular schedule. (#1394) * Add workflow for automatically updating feature branches weekly. * Corrected filename, and added inputs. * Remove trailing spaces. * Fix workflow. * Fix workflow name. * Fix syntax. * Fix syntax. * List remote branches instead. * Clean up script. * Untab. * Add branch list for debugging. * Untab. * Specify remote branches. * Skip second stage if no first. * Typo * Error. * List all branches. * Fix logic. * Fix spacing. * Fix output * Fix parameters. * Fix merge to use origin. * Remove debug echos. * Add git config. * Fix PR creation. * Fix PR creation. * Fix automatic push. --- .github/workflows/update-feature-branches.yml | 123 +++++++++++++++++- 1 file changed, 119 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update-feature-branches.yml b/.github/workflows/update-feature-branches.yml index 167696a9a7..5e180d2611 100644 --- a/.github/workflows/update-feature-branches.yml +++ b/.github/workflows/update-feature-branches.yml @@ -2,11 +2,126 @@ name: Update Feature Branches on: workflow_dispatch: inputs: + branch_patterns: + description: 'Space-separated list of feature branch patterns' + default: 'feature_branch/*' + required: true + main_branch: + description: 'Main branch to merge' + default: 'main' + required: true + schedule: + - cron: "0 16 * * 1" # Mondays, 4pm UTC = 9am PST / 10am PDT + +env: + defaultBranchPattern: "feature_branch/*" + defaultMainBranch: "main" + triggerTestsLabel: "tests-requested: quick" jobs: - no_op: - name: no-op + list_feature_branches: + name: list-feature-branches + runs-on: ubuntu-20.04 + outputs: + branch_list: ${{ steps.get-branches.outputs.branch_list }} + steps: + - name: Check out repo (if needed) + if: ${{ github.event.inputs.branch_list == '' }} + uses: actions/checkout@v3 + + - name: Get list of feature branches + id: get-branches + run: | + branch_pattern='origin/${{ env.defaultBranchPattern }}' + if [[ -n '${{ github.event.inputs.branch_patterns }}' ]]; then + branch_pattern=origin/$(echo '${{ github.event.inputs.branch_patterns }}' | sed 's| | origin/|g') + fi + git remote update + echo "Branch pattern: ${branch_pattern}" + branch_list=$(git branch --list --all "${branch_pattern}") + if [[ -n ${branch_list} ]]; then + # If there's at least one entry, process the list. + echo "Remote branch list: ${branch_list}" + # Remove remotes/origin/ from each branch. + branch_list=$(echo ${branch_list} | sed 's| remotes/origin/| |g' | sed 's|^remotes/origin/||') + # Change spaces to commas. + branch_list=$(echo ${branch_list} | sed 's/ /,/g') + # Add quotes around each branch name. + branch_list='"'$(echo ${branch_list} | sed 's/,/","/g')'"' + fi + echo "::warning ::Branch list: [${branch_list}]" + echo "branch_list=[${branch_list}]" >> $GITHUB_OUTPUT + + create_merge_prs: + name: create-merge-pr-${{ matrix.branch_name }} + needs: [ list_feature_branches ] runs-on: ubuntu-20.04 + if: ${{ needs.list_feature_branches.outputs.branch_list != '[]' }} + strategy: + fail-fast: false + matrix: + branch_name: ${{ fromJson(needs.list_feature_branches.outputs.branch_list) }} steps: - - name: noop - run: true + - name: Get token for firebase-workflow-trigger + uses: tibdex/github-app-token@v1 + id: generate-token + with: + app_id: ${{ secrets.WORKFLOW_TRIGGER_APP_ID }} + private_key: ${{ secrets.WORKFLOW_TRIGGER_APP_PRIVATE_KEY }} + + - name: Setup python + uses: actions/setup-python@v4 + with: + python-version: 3.7 + + - uses: actions/checkout@v3 + with: + ref: ${{ matrix.branch_name }} + fetch-depth: 0 + submodules: false + + - name: Install prerequisites + run: | + python scripts/gha/install_prereqs_desktop.py + python -m pip install requests + + - name: Create merge PR + id: create-pr + run: | + git config user.email "firebase-workflow-trigger-bot@google.com" + git config user.name "firebase-workflow-trigger-bot" + git config core.commentChar "%" # so we can use # in git commit messages + + main_branch='${{ env.defaultMainBranch }}' + if [[ -n '${{ github.event.inputs.main_branch }}' ]]; then + main_branch='${{ github.event.inputs.main_branch }}' + fi + # Attempt a merge, then check if any files changed. + git merge --no-commit --no-ff "origin/${main_branch}" || true + if git diff --quiet ${{ matrix.branch_name }}; then + # No merge necessary. + echo "::warning ::No merge needed for ${{ matrix.branch_name }}, won't create pull request." + echo "created_pr_number=0" >> $GITHUB_OUTPUT + exit 0 + fi + + # Undo the actual merge. Let the PR creation handle it. + git merge --abort + + date_str=$(date "+%b %d, %Y") + + pr_title="Automatic merge of ${main_branch} into ${{ matrix.branch_name }} - ${date_str}" + pr_body="Automatic merge of ${main_branch} into ${{ matrix.branch_name }}. + + > Created on ${date_str} by [${{github.workflow}} workflow]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID). + " + pr_number=$(python scripts/gha/create_pull_request.py --token ${{ steps.generate-token.outputs.token }} --base "${{ matrix.branch_name }}" --head "${main_branch}" --title "${pr_title}" --body "${pr_body}") + echo "created_pr_number=${pr_number}" >> $GITHUB_OUTPUT + + - name: Set test trigger label. + uses: actions-ecosystem/action-add-labels@v1 + if: ${{ steps.create-pr.outputs.created_pr_number }} + with: + github_token: ${{ steps.generate-token.outputs.token }} + number: ${{ steps.create-pr.outputs.created_pr_number }} + labels: "${{ env.triggerTestsLabel }}" From b5e5477d74117f94dbcf09aa6278f8ab70c57512 Mon Sep 17 00:00:00 2001 From: Jon Simantov Date: Mon, 24 Jul 2023 13:45:48 -0700 Subject: [PATCH 4/4] Increase retry. (#1402) --- scripts/gha/integration_testing/ftl_gha_validator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/gha/integration_testing/ftl_gha_validator.py b/scripts/gha/integration_testing/ftl_gha_validator.py index 4350738245..58119d2315 100644 --- a/scripts/gha/integration_testing/ftl_gha_validator.py +++ b/scripts/gha/integration_testing/ftl_gha_validator.py @@ -74,7 +74,7 @@ def _get_testapp_log_text_from_gcs(gcs_path): logging.error("Unexpected error reading GCS log:\n%s", e) return None -@retry(subprocess.CalledProcessError, tries=3, delay=10) +@retry(subprocess.CalledProcessError, tries=10, delay=5, backoff=1.5) def _gcs_list_dir(gcs_path): """Recursively returns a list of contents for a directory on GCS.""" args = [GSUTIL, "ls", "-r", gcs_path] @@ -83,7 +83,7 @@ def _gcs_list_dir(gcs_path): return result.stdout.splitlines() -@retry(subprocess.CalledProcessError, tries=3, delay=10) +@retry(subprocess.CalledProcessError, tries=10, delay=5, backoff=1.5) def _gcs_read_file(gcs_path): """Extracts the contents of a file on GCS.""" args = [GSUTIL, "cat", gcs_path]