-
Notifications
You must be signed in to change notification settings - Fork 1
[Phase 8] Add E2E path filtering for Bitrise #417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: kieran-osgood/e2e-browserstack/phase-7-soft-launch
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Shared changed-file filters for workflows and pipelines that should ignore docs-only changes. | ||
| # Negative patterns need `predicate-quantifier: every` in dorny/paths-filter workflow steps. | ||
| android: | ||
| - 'platforms/android/**' | ||
| - &exclude-markdown '!**/*.md' | ||
| - &exclude-docs-directory '!**/docs/**' | ||
| swift: | ||
| - 'platforms/swift/**' | ||
| - *exclude-markdown | ||
| - *exclude-docs-directory | ||
| reactNative: | ||
| - 'platforms/react-native/**' | ||
| - *exclude-markdown | ||
| - *exclude-docs-directory | ||
| web: | ||
| - 'platforms/web/**' | ||
| - *exclude-markdown | ||
| - *exclude-docs-directory | ||
| protocol: | ||
| - 'protocol/**' | ||
| - *exclude-markdown | ||
| - *exclude-docs-directory | ||
| protocolTypescript: | ||
| - 'protocol/languages/typescript/**' | ||
| - *exclude-markdown | ||
| - *exclude-docs-directory | ||
| protocolSwift: | ||
| - 'protocol/languages/swift/**' | ||
| - *exclude-markdown | ||
| - *exclude-docs-directory | ||
| protocolKotlin: | ||
| - 'protocol/languages/kotlin/**' | ||
| - *exclude-markdown | ||
| - *exclude-docs-directory | ||
| packageSwift: | ||
| - 'Package.swift' | ||
| - 'Package.resolved' | ||
| e2e: | ||
| - 'e2e/**' | ||
| - *exclude-markdown | ||
| - *exclude-docs-directory | ||
| ciFilters: | ||
| - '.ci/changed-file-filters.yml' |
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -42,7 +42,13 @@ bitrise validate -c e2e/bitrise.yml | |||||
|
|
||||||
| ## PR trigger | ||||||
|
|
||||||
| `e2e/bitrise.yml` maps pull requests to the `e2e` pipeline with `trigger_map`. The GitHub checks are kept non-required while `E2E_STRICT=false`. | ||||||
| `e2e/bitrise.yml` maps pull requests to the `e2e` pipeline with `trigger_map`. The trigger uses Bitrise `changed_files.regex` as a coarse source-tree gate for Checkout Kit platform, protocol, shared filter, package, and E2E paths. Bitrise does not support the same named include/exclude filter objects as GitHub Actions, so app-level filtering is enforced by `e2e/config/matrix.yml` and `e2e/scripts/e2e_matrix_to_browserstack_run_plan` after the pipeline starts. | ||||||
|
|
||||||
| Shared changed-file filter groups live in `.ci/changed-file-filters.yml` and are consumed by both GitHub Actions and Bitrise E2E. Each application in `e2e/config/matrix.yml` declares `changed_files_filters` by shared group name. The run-plan producer fetches the PR file list from GitHub, applies those groups, emits only matching application rows into the BrowserStack run plan, and shares `E2E_BUILD_*` variables that gate downstream Bitrise build workflows with `run_if`. | ||||||
|
|
||||||
| Markdown and `docs/` changes are excluded by the app-level filters. A docs-only change under a coarse Bitrise trigger path can still start the lightweight run-plan workflow, but it will produce an empty run plan and skip app build, BrowserStack execution, and reporting workflows. | ||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| The GitHub checks are kept non-required while `E2E_STRICT=false`. | ||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ## Duplicate PR build cancellation | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,25 +21,35 @@ tools: | |
| trigger_map: | ||
| - pull_request_source_branch: "*" | ||
| draft_pull_request_enabled: false | ||
| changed_files: | ||
| regex: '^(platforms/(swift|android|react-native)|protocol|e2e|\.ci)/.*|^Package\.(swift|resolved)$' | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Debating whether we remove this and only rely on the run-plan platforms level filtering at runtime |
||
| pipeline: e2e | ||
|
|
||
| pipelines: | ||
| e2e: | ||
| workflows: | ||
| e2e-produce-browserstack-run-plan: {} | ||
| e2e-build-react-native-ios: | ||
| run_if: | ||
| expression: env "E2E_BUILD_REACT_NATIVE_IOS" | eq "true" | ||
| depends_on: | ||
| - e2e-produce-browserstack-run-plan | ||
| e2e-build-react-native-android: | ||
| run_if: | ||
| expression: env "E2E_BUILD_REACT_NATIVE_ANDROID" | eq "true" | ||
| depends_on: | ||
| - e2e-produce-browserstack-run-plan | ||
| e2e-execute-browserstack-run: | ||
| run_if: | ||
| expression: env "E2E_HAS_E2E_RUNS" | eq "true" | ||
| depends_on: | ||
| - e2e-produce-browserstack-run-plan | ||
| - e2e-build-react-native-ios | ||
| - e2e-build-react-native-android | ||
| parallel: $E2E_BROWSERSTACK_RUN_PLAN_COUNT | ||
| parallel: $E2E_BROWSERSTACK_RUN_PLAN_PARALLEL_COUNT | ||
| e2e-report: | ||
| run_if: | ||
| expression: env "E2E_HAS_E2E_RUNS" | eq "true" | ||
| depends_on: | ||
| - e2e-execute-browserstack-run | ||
| should_always_run: workflow | ||
|
|
@@ -111,19 +121,33 @@ workflows: | |
| - content: |- | ||
| set -euo pipefail | ||
| source e2e/scripts/bitrise_ci_helpers | ||
| ruby e2e/scripts/e2e_matrix_to_browserstack_run_plan validate | ||
| changed_files="$(e2e_deploy_dir)/changed-files.txt" | ||
| e2e_log "Fetching pull request changed files" | ||
| if [ -n "${BITRISE_PULL_REQUEST:-}" ]; then | ||
| ruby e2e/scripts/github_pr_changed_files > "$changed_files" | ||
| else | ||
| git diff --name-only "${BITRISE_GIT_BRANCH_DEST:-origin/main}...HEAD" > "$changed_files" | ||
| fi | ||
| ruby e2e/scripts/e2e_matrix_to_browserstack_run_plan validate --changed-files-file "$changed_files" | ||
| e2e_log "Producing BrowserStack run plan" | ||
| ruby e2e/scripts/e2e_matrix_to_browserstack_run_plan expand > "$BITRISE_DEPLOY_DIR/browserstack-run-plan.json" | ||
| e2e_log "Publishing BrowserStack run plan count" | ||
| envman add --key E2E_BROWSERSTACK_RUN_PLAN_COUNT --value "$(ruby e2e/scripts/e2e_matrix_to_browserstack_run_plan count)" | ||
| ruby e2e/scripts/e2e_matrix_to_browserstack_run_plan expand --changed-files-file "$changed_files" > "$BITRISE_DEPLOY_DIR/browserstack-run-plan.json" | ||
| e2e_log "Publishing BrowserStack run plan environment" | ||
| while IFS='=' read -r key value; do | ||
| envman add --key "$key" --value "$value" | ||
| done < <(ruby e2e/scripts/e2e_matrix_to_browserstack_run_plan bitrise-env --changed-files-file "$changed_files") | ||
| e2e_log "Zipping E2E tests" | ||
| tests_zip="$(e2e_deploy_dir)/e2e-tests.zip" | ||
| e2e/scripts/zip_e2e_tests --output "$tests_zip" | ||
| e2e_log "Publishing E2E tests zip path" | ||
| envman add --key E2E_TESTS_ZIP --value "$tests_zip" | ||
| - share-pipeline-variable@1: | ||
| inputs: | ||
| - variables: E2E_BROWSERSTACK_RUN_PLAN_COUNT | ||
| - variables: |- | ||
| E2E_BROWSERSTACK_RUN_PLAN_COUNT | ||
| E2E_BROWSERSTACK_RUN_PLAN_PARALLEL_COUNT | ||
| E2E_HAS_E2E_RUNS | ||
| E2E_BUILD_REACT_NATIVE_IOS | ||
| E2E_BUILD_REACT_NATIVE_ANDROID | ||
| - deploy-to-bitrise-io@2: | ||
| is_always_run: false | ||
| inputs: | ||
|
|
@@ -196,7 +220,7 @@ workflows: | |
| - git-clone@8: {} | ||
| - pull-intermediate-files@1: | ||
| inputs: | ||
| - artifact_sources: e2e-produce-browserstack-run-plan,e2e-build-react-native-.* | ||
| - artifact_sources: e2e-produce-browserstack-run-plan,e2e-build-.* | ||
| - script@1: | ||
| title: Execute BrowserStack run | ||
| timeout: 2700 | ||
|
|
@@ -215,8 +239,8 @@ workflows: | |
| : "${BROWSERSTACK_ACCESS_KEY:?BROWSERSTACK_ACCESS_KEY is required}" | ||
| : "${E2E_TESTS_ZIP:?E2E_TESTS_ZIP is required. Check e2e-execute-browserstack-run pull-intermediate-files artifact_sources.}" | ||
| : "${E2E_BROWSERSTACK_RUN_PLAN_JSON:?E2E_BROWSERSTACK_RUN_PLAN_JSON is required. Check e2e-execute-browserstack-run pull-intermediate-files artifact_sources.}" | ||
| : "${E2E_REACT_NATIVE_IOS_APP_PATH:?E2E_REACT_NATIVE_IOS_APP_PATH is required. Check e2e-execute-browserstack-run pull-intermediate-files artifact_sources.}" | ||
| : "${E2E_REACT_NATIVE_ANDROID_APP_PATH:?E2E_REACT_NATIVE_ANDROID_APP_PATH is required. Check e2e-execute-browserstack-run pull-intermediate-files artifact_sources.}" | ||
| run_artifact_env="$(ruby -rjson -e 'run_plan = JSON.parse(File.read(ARGV.fetch(0))); puts run_plan.fetch(Integer(ARGV.fetch(1))).fetch("artifact_env")' "$E2E_BROWSERSTACK_RUN_PLAN_JSON" "$run_index")" | ||
| : "${!run_artifact_env:?${run_artifact_env} is required. Check e2e-execute-browserstack-run pull-intermediate-files artifact_sources.}" | ||
| e2e_log "Executing BrowserStack run plan row ${run_index}" | ||
| E2E_STRICT="${E2E_STRICT:-false}" e2e/scripts/execute_browserstack_run \ | ||
| --index "$run_index" \ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.