- 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_suffix: ".Alpha"
is_beta: true
publish: true
publish: ${{ vars.PUBLISH_ALPHA_UPDATES == 'true' }}
is_shared_build_num: false
release_tag: "alpha"
release_name: "Alpha"

View File

@@ -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"

View File

@@ -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 </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: |
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")