-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Only run APK/IPA builds on changes demos in PRs only #3205
Only run APK/IPA builds on changes demos in PRs only #3205
Conversation
…uests in Android and iOS builds and restrict them to only changes in the PR.
…N.SDK_INT for OS version check
…to include specific MASTG-DEMO patterns
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.
Looks great as it is. Check if it makes sense to do the refactor mentioned before.
|
||
- name: Generate matrix | ||
id: set-matrix | ||
run: | | ||
matrix="$(echo demos/android/*/MASTG-DEMO-* | sed 's/ /","/g')" | ||
echo "matrix={\"demo\":[\"$matrix\"]}" >> $GITHUB_OUTPUT | ||
if [ "${{ github.event_name }}" = "pull_request" ]; then |
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.
Great idea! The script is good as it is, I don't think it's necessary to improve it.
I am thinking in extracting the script into a separate file, because it is very similar between iOS and Android. For example:
.github/workflows/matrix-demos-json.sh
#!/bin/bash
set -eu
event_name="$1" # check for "pull_request"
pr_commit_hash="$2"
demo_path="$3" # demos/android or demos/ios
...
The idea is to shorten the step to something like this:
- name: Generate matrix
id: set-matrix
run: |
event_name="${{ github.event_name }}"
pr_hash="${{ github.event.pull_request.base.sha }}"
.github/workflows/matrix-demos-json.sh "$event_name" "$pr_hash" demos/android >> $GITHUB_OUTPUT
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.
That'd be really nice, let's do that on a separate PR. Thanks a lot!
This PR closes #3204
This PR optimizes the GitHub Action for building Android and iOS demos by modifying its behavior based on the event type:
demos/android/**
ordemos/ios/**
have changed, reducing unnecessary builds. This is achieved by usinggit diff
to detect modified files and updating the matrix accordingly.This improves CI efficiency by avoiding redundant builds when no relevant changes are made.
Additional changes: Demo download buttons
This PR also updated the script that ensures that the last successful run of the GitHub Action was on the master branch.
docs/hooks/github_api.py
docs/hooks/maswe-beta-banner.py
in theget_android_demo_buttons
andget_android_demo_buttons
methods.Previously, the script fetched the most recent successful run without checking the branch, which could lead to using artifacts from non-master branches. Now, it explicitly filters for successful runs on master, ensuring that only stable and merged builds are considered.