-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/OWASP/owasp-mastg into ad…
…d-demo-binary-links
- Loading branch information
Showing
2 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
name: Build All iOS Demos | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- 'demos/**' | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- 'demos/**' | ||
jobs: | ||
generate-matrix: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Generate matrix | ||
id: set-matrix | ||
run: | | ||
demos=$(find demos/ios -type d -name "MASTG-DEMO-*") | ||
matrix="{\"demo\":[" | ||
for demo in $demos; do | ||
matrix="${matrix}\"$demo\"," | ||
done | ||
matrix="${matrix%,}]}" | ||
echo "matrix=$matrix" >> $GITHUB_ENV | ||
echo "matrix=$matrix" >> $GITHUB_OUTPUT | ||
- name: Print matrix | ||
run: echo "${{ steps.set-matrix.outputs.matrix }}" | ||
|
||
build: | ||
needs: generate-matrix | ||
runs-on: macos-latest | ||
timeout-minutes: 60 | ||
strategy: | ||
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} | ||
max-parallel: 3 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Clone MASTestApp-iOS repository | ||
run: git clone https://github.com/cpholguera/MASTestApp-iOS.git | ||
|
||
- name: Debug repository contents | ||
run: ls -R | ||
|
||
- name: Install dependencies | ||
run: | | ||
brew install ldid cocoapods | ||
cd MASTestApp-iOS || exit | ||
pod install --repo-update || true | ||
- name: Replace files and prepare build | ||
run: | | ||
demo="${{ matrix.demo }}" | ||
if [ -d "$demo" ]; then | ||
echo "Processing $demo" | ||
[ -f "$demo/MastgTest.swift" ] && cp -f "$demo/MastgTest.swift" MASTestApp-iOS/MASTestApp/MastgTest.swift && echo "Copied MastgTest.swift for $demo" || echo "No MastgTest.swift found for $demo" | ||
[ -f "$demo/Info.plist" ] && cp -f "$demo/Info.plist" MASTestApp-iOS/MASTestApp/Info.plist && echo "Copied Info.plist for $demo" || echo "No Info.plist found for $demo" | ||
else | ||
echo "Demo directory not found: $demo" | ||
exit 1 | ||
fi | ||
- name: Set iOS Deployment Target to 14.4 | ||
run: | | ||
/usr/libexec/PlistBuddy -c "Set :objects:CBFA8C102BDE94720047F3A3:buildSettings:IPHONEOS_DEPLOYMENT_TARGET 14.4" "MASTestApp-iOS/MASTestApp.xcodeproj/project.pbxproj" | ||
/usr/libexec/PlistBuddy -c "Set :objects:CBFA8C112BDE94720047F3A3:buildSettings:IPHONEOS_DEPLOYMENT_TARGET 14.4" "MASTestApp-iOS/MASTestApp.xcodeproj/project.pbxproj" | ||
/usr/libexec/PlistBuddy -c "Set :objects:CBFA8C132BDE94720047F3A3:buildSettings:IPHONEOS_DEPLOYMENT_TARGET 14.4" "MASTestApp-iOS/MASTestApp.xcodeproj/project.pbxproj" | ||
/usr/libexec/PlistBuddy -c "Set :objects:CBFA8C142BDE94720047F3A3:buildSettings:IPHONEOS_DEPLOYMENT_TARGET 14.4" "MASTestApp-iOS/MASTestApp.xcodeproj/project.pbxproj" | ||
echo "iOS Deployment Target successfully updated to 14.4" | ||
- name: Set Default Scheme | ||
run: | | ||
cd MASTestApp-iOS || exit | ||
scheme_list=$(xcodebuild -list -json | tr -d "\n") | ||
default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]") | ||
echo "DEFAULT_SCHEME=$default" >> "$GITHUB_ENV" | ||
echo "Using default scheme: $default" | ||
- name: Build the app (unsigned) | ||
run: | | ||
cd MASTestApp-iOS || exit | ||
xcodebuild archive \ | ||
-project "MASTestApp.xcodeproj" \ | ||
-scheme "$DEFAULT_SCHEME" \ | ||
-archivePath "$GITHUB_WORKSPACE/build/MASTestApp.xcarchive" \ | ||
-configuration Release \ | ||
CODE_SIGN_IDENTITY="" \ | ||
CODE_SIGNING_REQUIRED=NO \ | ||
CODE_SIGNING_ALLOWED=NO | ||
- name: Add Entitlements | ||
run: | | ||
ldid -SMASTestApp-iOS/entitlements.plist "$GITHUB_WORKSPACE/build/MASTestApp.xcarchive/Products/Applications/MASTestApp.app/MASTestApp" | ||
- name: Create IPA manually | ||
run: | | ||
cd "$GITHUB_WORKSPACE/build/MASTestApp.xcarchive/Products" || exit | ||
mv Applications Payload | ||
zip -r9q MASTestApp.zip Payload | ||
mv MASTestApp.zip MASTestApp.ipa | ||
mkdir -p "$GITHUB_WORKSPACE/output" | ||
mv MASTestApp.ipa "$GITHUB_WORKSPACE/output/$(basename "${{ matrix.demo }}").ipa" | ||
- name: Set IPA name variable | ||
id: set_ipa_name | ||
run: echo "IPA_NAME=$(basename "${{ matrix.demo }}").ipa" >> $GITHUB_ENV | ||
|
||
- name: List generated IPA | ||
run: | | ||
echo "Listing generated IPA in output directory:" | ||
ls -l output/ | ||
- name: Debug IPA Path Before Upload | ||
run: | | ||
if [ -f "output/${{ env.IPA_NAME }}" ]; then | ||
echo "IPA file exists and ready for upload: output/${{ env.IPA_NAME }}" | ||
else | ||
echo "ERROR: IPA file not found at output/${{ env.IPA_NAME }}" | ||
exit 1 | ||
fi | ||
- name: Upload IPA | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: "${{ env.IPA_NAME }}" | ||
path: "output/${{ env.IPA_NAME }}" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.