- CI: Improve build log capture in case of errors

This commit is contained in:
Magesh K
2025-02-22 17:12:12 +05:30
parent 5323fdadcf
commit ca8c394ae0
5 changed files with 122 additions and 61 deletions

View File

@@ -17,7 +17,7 @@ jobs:
bundle_id: "com.SideStore.SideStore" bundle_id: "com.SideStore.SideStore"
# bundle_id_suffix: ".Alpha" # bundle_id_suffix: ".Alpha"
is_beta: true is_beta: true
publish: true publish: ${{ vars.PUBLISH_ALPHA_UPDATES == 'true' }}
is_shared_build_num: false is_shared_build_num: false
release_tag: "alpha" release_tag: "alpha"
release_name: "Alpha" release_name: "Alpha"

View File

@@ -70,7 +70,7 @@ jobs:
bundle_id: "com.SideStore.SideStore" bundle_id: "com.SideStore.SideStore"
# bundle_id_suffix: ".Nightly" # bundle_id_suffix: ".Nightly"
is_beta: true is_beta: true
publish: true publish: ${{ vars.PUBLISH_NIGHTLY_UPDATES == 'true' }}
is_shared_build_num: false is_shared_build_num: false
release_tag: "nightly" release_tag: "nightly"
release_name: "Nightly" release_name: "Nightly"

View File

@@ -201,7 +201,14 @@ jobs:
./AltStore.xcworkspace/ ./AltStore.xcworkspace/
key: pods-cache-${{ hashFiles('Podfile') }} 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 - name: List Files and derived data
if: always()
run: | run: |
echo ">>>>>>>>> Workdir <<<<<<<<<<" echo ">>>>>>>>> Workdir <<<<<<<<<<"
ls -la . ls -la .
@@ -223,30 +230,62 @@ jobs:
ls -la ~/Library/Developer/Xcode/DerivedData || true # List contents if directory exists ls -la ~/Library/Developer/Xcode/DerivedData || true # List contents if directory exists
echo "" echo ""
- name: Set BundleID Suffix for Sidestore build - name: Set BundleID Suffix for Sidestore build
run: | run: |
echo "BUNDLE_ID_SUFFIX=${{ inputs.bundle_id_suffix }}" >> $GITHUB_ENV 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 # using 'tee' to intercept stdout and log for detailed build-log
run: | 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]} NSUnbufferedIO=YES make -B build 2>&1 | tee -a build/logs/build.log | xcbeautify --renderer github-actions && 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
- name: Fakesign app - name: Fakesign app
run: make fakesign | tee -a build.log run: make fakesign | tee -a build/logs/build.log
- name: Convert to IPA - 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 </dev/null > 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: | run: |
DEFAULT_BUILD_LOG_PASSWORD=12345 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}'." echo "Warning: BUILD_LOG_ZIP_PASSWORD is not set. Defaulting to '${DEFAULT_BUILD_LOG_PASSWORD}'."
fi fi
if [ ! -f build.log ]; then pushd build/logs && zip -e -P "$BUILD_LOG_ZIP_PASSWORD" ../../encrypted-build-logs.zip * || popd
echo "Warning: build.log is missing, creating a dummy log..." echo "::set-output name=encrypted::true"
echo "Error: build.log was missing, This is a dummy placeholder file..." > build.log
- 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 fi
zip -e -P "$BUILD_LOG_ZIP_PASSWORD" encrypted-build_log.zip build.log - name: Check for test-recording.mp4 presence
id: check-recording
- name: List Files after SideStore build if: ${{ always() && env.RECORD_PID != '' }}
run: | run: |
echo ">>>>>>>>> Workdir <<<<<<<<<<" if [ -f test-recording.mp4 ]; then
ls -la . echo "::set-output name=found::true"
echo "" 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 - name: Get current date
id: date id: date
run: echo "date=$(date -u +'%c')" >> $GITHUB_OUTPUT run: echo "date=$(date -u +'%c')" >> $GITHUB_OUTPUT
@@ -288,7 +375,7 @@ jobs:
release: ${{ inputs.release_name }} release: ${{ inputs.release_name }}
tag: ${{ inputs.release_tag }} tag: ${{ inputs.release_tag }}
prerelease: ${{ inputs.is_beta }} 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: | body: |
This is an ⚠️ **EXPERIMENTAL** ⚠️ ${{ inputs.release_name }} build for commit [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}). 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 git push --verbose
popd 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 - name: Get formatted date
run: | run: |
FORMATTED_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") FORMATTED_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")

4
.gitignore vendored
View File

@@ -64,7 +64,3 @@ SideStore/.skip-prebuilt-fetch-em_proxy
# coz SPM then resolves packages using the stale entries in this file # coz SPM then resolves packages using the stale entries in this file
*.xcodeproj/**/Package.resolved *.xcodeproj/**/Package.resolved
*.xcworkspace/**/Package.resolved *.xcworkspace/**/Package.resolved
# build/test artifacts
build.log
report.html

View File

@@ -201,9 +201,17 @@ boot-sim:
else \ else \
echo "Booting simulator 'iPhone 16 Pro'..."; \ echo "Booting simulator 'iPhone 16 Pro'..."; \
xcrun simctl boot "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 fi
build-and-test: build-and-test:
@rm -rf build/tests/test-results.xcresult
@echo ">>>>>>>>> BUILD_CONFIG is set to '$(BUILD_CONFIG)', Building for $(BUILD_CONFIG) mode! <<<<<<<<<<" @echo ">>>>>>>>> BUILD_CONFIG is set to '$(BUILD_CONFIG)', Building for $(BUILD_CONFIG) mode! <<<<<<<<<<"
@echo "" @echo ""
@echo "Performing a build and running tests..." @echo "Performing a build and running tests..."
@@ -342,7 +350,7 @@ ipa-altbackup: checkPaths copy-altbackup
@mkdir -p "$(ALT_APP_PAYLOAD_DST)/$(TARGET_NAME)" @mkdir -p "$(ALT_APP_PAYLOAD_DST)/$(TARGET_NAME)"
@echo " Copying from $(ALT_APP_SRC) into $(ALT_APP_PAYLOAD_DST)" @echo " Copying from $(ALT_APP_SRC) into $(ALT_APP_PAYLOAD_DST)"
@cp -R -f "$(ALT_APP_SRC)/." "$(ALT_APP_PAYLOAD_DST)/$(TARGET_NAME)" @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 @cp -f "$(ALT_APP_IPA_DST)" AltStore/Resources
@echo " IPA created: AltStore/Resources/AltBackup.ipa" @echo " IPA created: AltStore/Resources/AltBackup.ipa"
@@ -351,11 +359,8 @@ clean-altbackup:
@echo "====> Cleaning up AltBackup related artifacts <====" @echo "====> Cleaning up AltBackup related artifacts <===="
@rm -rf build/altbackup.xcarchive/ @rm -rf build/altbackup.xcarchive/
@rm -f build/AltBackup.ipa @rm -f build/AltBackup.ipa
@rm -f AltStore/Resources/AltBackup.ipa #@rm -f AltStore/Resources/AltBackup.ipa
clean: clean-altbackup clean: clean-altbackup
@rm -rf *.xcarchive/
@rm -rf *.dSYM/
@rm -rf SideStore.ipa @rm -rf SideStore.ipa
@rm -rf build/ @rm -rf build/
@rm -rf Payload/