Skip to content
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

Refactor build workflows for Android and iOS demos #3213

Merged
merged 3 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions .github/workflows/build-android-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
echo "$changed_files"

# Extract unique demo directories
matrix=$(echo "$changed_files" | grep -oE 'demos/android/[^/]*/MASTG-DEMO-[^/]+' | sort -u | sed 's/ /","/g')
matrix=$(echo "$changed_files" | grep -oE 'demos/android/[^/]*/MASTG-DEMO-[^/]+' | sort -u | head -c -1 | tr '\n' ' ' | sed 's/ /","/g')

# If no changes, set empty matrix
if [ -z "$matrix" ]; then
Expand All @@ -50,7 +50,7 @@ jobs:
matrix=$(echo demos/android/*/MASTG-DEMO-* | sed 's/ /","/g')
echo "matrix={\"demo\":[\"$matrix\"]}" >> $GITHUB_OUTPUT
fi

echo "Print matrix: $matrix"
- name: Print matrix
run: echo "${{ steps.set-matrix.outputs.matrix }}"

Expand Down Expand Up @@ -152,12 +152,11 @@ jobs:
)

echo "Processing $demo"
cp -f "$demo/MastgTest.kt" MASTestApp-Android/app/src/main/java/org/owasp/mastestapp/MastgTest.kt 2>/dev/null \
&& echo "Copied MastgTest.kt for $demo" \
|| echo "No MastgTest.kt found for $demo"
cp -f "$demo/AndroidManifest.xml" MASTestApp-Android/app/src/main/AndroidManifest.xml 2>/dev/null \
&& echo "Copied AndroidManifest.xml for $demo" \
|| echo "No AndroidManifest.xml found for $demo"
for file in MastgTest.kt AndroidManifest.xml filepaths.xml network_security_config.xml backup_rules.xml data_extraction_rules.xml; do
cp -f "$demo/$file" "MASTestApp-Android/app/src/main/${file%/*}/$file" 2>/dev/null \
&& echo "Copied $file for $demo" \
|| echo "No $file found for $demo"
done
Comment on lines +155 to +159
Copy link
Collaborator Author

@cpholguera cpholguera Mar 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. Fixed in #3214


echo "Building APK for $demo"
cd MASTestApp-Android
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build-ios-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
echo "$changed_files"

# Extract unique demo directories
matrix=$(echo "$changed_files" | grep -oE 'demos/ios/[^/]*/MASTG-DEMO-[^/]+' | sort -u | sed 's/ /","/g')
matrix=$(echo "$changed_files" | grep -oE 'demos/ios/[^/]*/MASTG-DEMO-[^/]+' | sort -u | head -c -1 | tr '\n' ' ' | sed 's/ /","/g')

# If no changes, set empty matrix
if [ -z "$matrix" ]; then
Expand All @@ -49,6 +49,7 @@ jobs:
matrix=$(echo demos/ios/*/MASTG-DEMO-* | sed 's/ /","/g')
echo "matrix={\"demo\":[\"$matrix\"]}" >> $GITHUB_OUTPUT
fi
echo "Print matrix: $matrix"

build:
needs: generate-matrix
Expand Down