Skip to content

Commit 64c1b07

Browse files
authored
Merge pull request #3213 from OWASP/fix-demos-matrix
Refactor build workflows for Android and iOS demos
2 parents 510bd48 + 8f6307d commit 64c1b07

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

.github/workflows/build-android-demos.yml

+7-8
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
echo "$changed_files"
3838
3939
# Extract unique demo directories
40-
matrix=$(echo "$changed_files" | grep -oE 'demos/android/[^/]*/MASTG-DEMO-[^/]+' | sort -u | sed 's/ /","/g')
40+
matrix=$(echo "$changed_files" | grep -oE 'demos/android/[^/]*/MASTG-DEMO-[^/]+' | sort -u | head -c -1 | tr '\n' ' ' | sed 's/ /","/g')
4141
4242
# If no changes, set empty matrix
4343
if [ -z "$matrix" ]; then
@@ -50,7 +50,7 @@ jobs:
5050
matrix=$(echo demos/android/*/MASTG-DEMO-* | sed 's/ /","/g')
5151
echo "matrix={\"demo\":[\"$matrix\"]}" >> $GITHUB_OUTPUT
5252
fi
53-
53+
echo "Print matrix: $matrix"
5454
- name: Print matrix
5555
run: echo "${{ steps.set-matrix.outputs.matrix }}"
5656

@@ -152,12 +152,11 @@ jobs:
152152
)
153153
154154
echo "Processing $demo"
155-
cp -f "$demo/MastgTest.kt" MASTestApp-Android/app/src/main/java/org/owasp/mastestapp/MastgTest.kt 2>/dev/null \
156-
&& echo "Copied MastgTest.kt for $demo" \
157-
|| echo "No MastgTest.kt found for $demo"
158-
cp -f "$demo/AndroidManifest.xml" MASTestApp-Android/app/src/main/AndroidManifest.xml 2>/dev/null \
159-
&& echo "Copied AndroidManifest.xml for $demo" \
160-
|| echo "No AndroidManifest.xml found for $demo"
155+
for file in MastgTest.kt AndroidManifest.xml filepaths.xml network_security_config.xml backup_rules.xml data_extraction_rules.xml; do
156+
cp -f "$demo/$file" "MASTestApp-Android/app/src/main/${file%/*}/$file" 2>/dev/null \
157+
&& echo "Copied $file for $demo" \
158+
|| echo "No $file found for $demo"
159+
done
161160
162161
echo "Building APK for $demo"
163162
cd MASTestApp-Android

.github/workflows/build-ios-demos.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
echo "$changed_files"
3737
3838
# Extract unique demo directories
39-
matrix=$(echo "$changed_files" | grep -oE 'demos/ios/[^/]*/MASTG-DEMO-[^/]+' | sort -u | sed 's/ /","/g')
39+
matrix=$(echo "$changed_files" | grep -oE 'demos/ios/[^/]*/MASTG-DEMO-[^/]+' | sort -u | head -c -1 | tr '\n' ' ' | sed 's/ /","/g')
4040
4141
# If no changes, set empty matrix
4242
if [ -z "$matrix" ]; then
@@ -49,6 +49,7 @@ jobs:
4949
matrix=$(echo demos/ios/*/MASTG-DEMO-* | sed 's/ /","/g')
5050
echo "matrix={\"demo\":[\"$matrix\"]}" >> $GITHUB_OUTPUT
5151
fi
52+
echo "Print matrix: $matrix"
5253
5354
build:
5455
needs: generate-matrix

0 commit comments

Comments
 (0)