diff --git a/.github/workflows/alpha.yml b/.github/workflows/alpha.yml index f1813baa..5955c824 100644 --- a/.github/workflows/alpha.yml +++ b/.github/workflows/alpha.yml @@ -17,7 +17,7 @@ jobs: bundle_id: "com.SideStore.SideStore" # bundle_id_suffix: ".Alpha" is_beta: true - publish: true + publish: ${{ vars.PUBLISH_ALPHA_UPDATES == 'true' }} is_shared_build_num: false release_tag: "alpha" release_name: "Alpha" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 967f6056..3f4c7952 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -70,7 +70,7 @@ jobs: bundle_id: "com.SideStore.SideStore" # bundle_id_suffix: ".Nightly" is_beta: true - publish: true + publish: ${{ vars.PUBLISH_NIGHTLY_UPDATES == 'true' }} is_shared_build_num: false release_tag: "nightly" release_name: "Nightly" diff --git a/.github/workflows/reusable-build-workflow.yml b/.github/workflows/reusable-build-workflow.yml index 6fcfaf0a..74fa6cb0 100644 --- a/.github/workflows/reusable-build-workflow.yml +++ b/.github/workflows/reusable-build-workflow.yml @@ -201,7 +201,14 @@ jobs: ./AltStore.xcworkspace/ key: pods-cache-${{ hashFiles('Podfile') }} + - name: Clean previous build artifacts + # using 'tee' to intercept stdout and log for detailed build-log + run: | + make clean + mkdir -p build/logs + - name: List Files and derived data + if: always() run: | echo ">>>>>>>>> Workdir <<<<<<<<<<" ls -la . @@ -223,30 +230,62 @@ jobs: ls -la ~/Library/Developer/Xcode/DerivedData || true # List contents if directory exists echo "" - - name: Set BundleID Suffix for Sidestore build run: | echo "BUNDLE_ID_SUFFIX=${{ inputs.bundle_id_suffix }}" >> $GITHUB_ENV - - name: Build and run SideStore Tests + + - name: Build SideStore.xcarchive # using 'tee' to intercept stdout and log for detailed build-log run: | - NSUnbufferedIO=YES make boot-sim build-and-test 2>&1 | tee build.log | xcpretty -r junit --output ./build/tests/test-results.xml && exit ${PIPESTATUS[0]} - echo "--------------------------------------------------------------------" >> build.log - - - name: Build SideStore archive - # using 'tee' to intercept stdout and log for detailed build-log - run: | - NSUnbufferedIO=YES make build 2>&1 | tee build.log | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} - echo "--------------------------------------------------------------------" >> build.log + NSUnbufferedIO=YES make -B build 2>&1 | tee -a build/logs/build.log | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} - name: Fakesign app - run: make fakesign | tee -a build.log + run: make fakesign | tee -a build/logs/build.log - name: Convert to IPA - run: make ipa | tee -a build.log + run: make ipa | tee -a build/logs/build.log - - name: Encrypt build.log generated from SideStore build for upload + - name: Boot Simulator for testing + run: make -B boot-sim | tee -a build/logs/test.log + + - name: Start Recording UI tests (if DEBUG_RECORD_TESTS is set to 1) + if: ${{ vars.DEBUG_RECORD_TESTS == '1' }} + run: | + nohup xcrun simctl io booted recordVideo test-recording.mp4 test-recording.log 2>&1 & + RECORD_PID=$! + echo "RECORD_PID=$RECORD_PID" >> $GITHUB_ENV + + # build will be up-to-date from previous step so here only test will be executed directly + - name: Run SideStore Tests + # using 'tee' to intercept stdout and log for detailed build-log + run: | + NSUnbufferedIO=YES make -B build-and-test 2>&1 | tee -a build/logs/test.log | xcbeautify --renderer github-actions && exit ${PIPESTATUS[0]} + # NSUnbufferedIO=YES make boot-sim build-and-test 2>&1 | tee build/logs/test.log | xcpretty -r junit --output ./build/tests/test-results.xml && exit ${PIPESTATUS[0]} + + - name: Stop Recording tests + if: ${{ always() && env.RECORD_PID != '' }} + run: | + kill -INT ${{ env.RECORD_PID }} + + - name: List Files and Build artifacts + if: always() + run: | + echo ">>>>>>>>> Workdir <<<<<<<<<<" + ls -la . + echo "" + + echo ">>>>>>>>> Build <<<<<<<<<<" + find build -maxdepth 3 -exec ls -ld {} + || true # List contents if directory exists + echo "" + + echo ">>>>>>>>> SideStore.xcarchive <<<<<<<<<<" + find SideStore.xcarchive -maxdepth 3 -exec ls -ld {} + || true # List contents if directory exists + echo "" + + - name: Encrypt build-logs for upload + id: encrypt-build-log + if: always() run: | DEFAULT_BUILD_LOG_PASSWORD=12345 @@ -257,19 +296,67 @@ jobs: echo "Warning: BUILD_LOG_ZIP_PASSWORD is not set. Defaulting to '${DEFAULT_BUILD_LOG_PASSWORD}'." fi - if [ ! -f build.log ]; then - echo "Warning: build.log is missing, creating a dummy log..." - echo "Error: build.log was missing, This is a dummy placeholder file..." > build.log + pushd build/logs && zip -e -P "$BUILD_LOG_ZIP_PASSWORD" ../../encrypted-build-logs.zip * || popd + echo "::set-output name=encrypted::true" + + - name: Upload encrypted-build-logs.zip + id: attach-encrypted-build-log + if: always() && steps.encrypt-build-log.outputs.encrypted == 'true' + uses: actions/upload-artifact@v4 + with: + name: encrypted-build-logs-${{ steps.version.outputs.version }}.zip + path: encrypted-build-logs.zip + + - name: Print test-recording.log contents (if exists) + if: ${{ always() && env.RECORD_PID != '' }} + run: | + if [ -f test-recording.log ]; then + echo "test-recording.log found. Its contents:" + cat test-recording.log + else + echo "test-recording.log not found." fi - zip -e -P "$BUILD_LOG_ZIP_PASSWORD" encrypted-build_log.zip build.log - - - name: List Files after SideStore build + - name: Check for test-recording.mp4 presence + id: check-recording + if: ${{ always() && env.RECORD_PID != '' }} run: | - echo ">>>>>>>>> Workdir <<<<<<<<<<" - ls -la . - echo "" + if [ -f test-recording.mp4 ]; then + echo "::set-output name=found::true" + echo "test-recording.mp4 found." + else + echo "test-recording.mp4 not found, skipping upload." + echo "::set-output name=found::false" + fi + + - name: Upload test-recording.mp4 + id: upload-recording + if: ${{ always() && steps.check-recording.outputs.found == 'true' }} + uses: actions/upload-artifact@v4 + with: + name: test-recording-${{ steps.version.outputs.version }}.mp4 + path: test-recording.mp4 + - name: Upload Test Artifacts + uses: actions/upload-artifact@v4 + with: + name: test-results-${{ steps.version.outputs.version }}.zip + path: ./build/tests/* + + - name: Upload SideStore.ipa Artifact + uses: actions/upload-artifact@v4 + with: + name: SideStore-${{ steps.version.outputs.version }}.ipa + path: SideStore.ipa + + - name: Upload *.dSYM Artifact + uses: actions/upload-artifact@v4 + with: + name: SideStore-${{ steps.version.outputs.version }}-dSYM + path: ./SideStore.xcarchive/dSYMs/* + + + - name: Get current date id: date run: echo "date=$(date -u +'%c')" >> $GITHUB_OUTPUT @@ -288,7 +375,7 @@ jobs: release: ${{ inputs.release_name }} tag: ${{ inputs.release_tag }} prerelease: ${{ inputs.is_beta }} - files: SideStore.ipa SideStore.dSYMs.zip encrypted-build_log.zip + files: SideStore.ipa SideStore.dSYMs.zip encrypted-build-logs.zip body: | This is an ⚠️ **EXPERIMENTAL** ⚠️ ${{ inputs.release_name }} build for commit [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}). @@ -323,33 +410,6 @@ jobs: git push --verbose popd - - name: Add version to IPA file name - run: cp SideStore.ipa SideStore-${{ steps.version.outputs.version }}.ipa - - - name: Upload SideStore.ipa Artifact - uses: actions/upload-artifact@v4 - with: - name: SideStore-${{ steps.version.outputs.version }}.ipa - path: SideStore-${{ steps.version.outputs.version }}.ipa - - - name: Upload *.dSYM Artifact - uses: actions/upload-artifact@v4 - with: - name: SideStore-${{ steps.version.outputs.version }}-dSYM - path: ./SideStore.xcarchive/dSYMs/* - - - name: Upload Test Artifact - uses: actions/upload-artifact@v4 - with: - name: test-results-${{ steps.version.outputs.version }}.zip - path: ./build/tests/* - - - name: Upload encrypted-build_log.zip - uses: actions/upload-artifact@v4 - with: - name: encrypted-build_log.zip - path: encrypted-build_log.zip - - name: Get formatted date run: | FORMATTED_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") diff --git a/.gitignore b/.gitignore index 0d7ee15c..d52ec450 100644 --- a/.gitignore +++ b/.gitignore @@ -64,7 +64,3 @@ SideStore/.skip-prebuilt-fetch-em_proxy # coz SPM then resolves packages using the stale entries in this file *.xcodeproj/**/Package.resolved *.xcworkspace/**/Package.resolved - -# build/test artifacts -build.log -report.html diff --git a/Makefile b/Makefile index 2bbf3f72..7a20d0ea 100755 --- a/Makefile +++ b/Makefile @@ -201,9 +201,17 @@ boot-sim: else \ echo "Booting simulator 'iPhone 16 Pro'..."; \ xcrun simctl boot "iPhone 16 Pro"; \ + \ + if xcrun simctl list devices "iPhone 16 Pro" | grep -q "Booted"; then \ + echo "Simulator 'iPhone 16 Pro' is now booted."; \ + else \ + echo "Simulator bootup failed..."; \ + exit 1; \ + fi \ fi build-and-test: + @rm -rf build/tests/test-results.xcresult @echo ">>>>>>>>> BUILD_CONFIG is set to '$(BUILD_CONFIG)', Building for $(BUILD_CONFIG) mode! <<<<<<<<<<" @echo "" @echo "Performing a build and running tests..." @@ -342,7 +350,7 @@ ipa-altbackup: checkPaths copy-altbackup @mkdir -p "$(ALT_APP_PAYLOAD_DST)/$(TARGET_NAME)" @echo " Copying from $(ALT_APP_SRC) into $(ALT_APP_PAYLOAD_DST)" @cp -R -f "$(ALT_APP_SRC)/." "$(ALT_APP_PAYLOAD_DST)/$(TARGET_NAME)" - @pushd "$(ALT_APP_DST_ARCHIVE)" && zip -r "../../$(ALT_APP_IPA_DST)" Payload && popd + @pushd "$(ALT_APP_DST_ARCHIVE)" && zip -r "../../$(ALT_APP_IPA_DST)" Payload || popd @cp -f "$(ALT_APP_IPA_DST)" AltStore/Resources @echo " IPA created: AltStore/Resources/AltBackup.ipa" @@ -351,11 +359,8 @@ clean-altbackup: @echo "====> Cleaning up AltBackup related artifacts <====" @rm -rf build/altbackup.xcarchive/ @rm -f build/AltBackup.ipa - @rm -f AltStore/Resources/AltBackup.ipa + #@rm -f AltStore/Resources/AltBackup.ipa clean: clean-altbackup - @rm -rf *.xcarchive/ - @rm -rf *.dSYM/ @rm -rf SideStore.ipa @rm -rf build/ - @rm -rf Payload/