-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved structure and cache handling
- Loading branch information
1 parent
8d3a18c
commit f0632a1
Showing
9 changed files
with
259 additions
and
268 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
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,43 @@ | ||
# .github/actions/build-xcframework/action.yml | ||
name: 'Build XCFramework' | ||
description: 'Build an XCFramework using the specified scheme' | ||
|
||
inputs: | ||
parent: | ||
description: 'The parent job to use for building the XCFramework' | ||
required: true | ||
scheme: | ||
description: 'The scheme to use for building the XCFramework' | ||
required: true | ||
match_password: | ||
description: 'The password for match' | ||
required: true | ||
appstore_api_key: | ||
description: 'The API key for App Store' | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
|
||
- name: Checkout repository | ||
uses: actions/[email protected] | ||
|
||
- name: Cache Ruby Gems | ||
uses: ./.github/actions/ruby-cache | ||
|
||
- name: Cache Xcode Derived Data | ||
uses: irgaly/xcode-cache@v1 | ||
with: | ||
key: xcode-15-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}-${{ inputs.scheme }} | ||
restore-keys: | | ||
xcode-15-cache-deriveddata-${{ github.workflow }}-${{ github.event.number }}"-${{ inputs.parent }} | ||
xcode-15-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}-${{ inputs.scheme }} | ||
deriveddata-directory: derived_data | ||
sourcepackages-directory: spm_cache | ||
|
||
- name: Build XCFramework | ||
run: bundle exec fastlane build_xcframeworks_concurrent scheme:"${{ inputs.scheme }}" | ||
env: | ||
MATCH_PASSWORD: ${{ inputs.match_password }} | ||
APPSTORE_API_KEY: ${{ inputs.appstore_api_key }} |
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,37 @@ | ||
# .github/actions/dynamic-xcode-cache/action.yml | ||
name: 'Dynamic Xcode Cache' | ||
description: 'Set cache key based on job dependencies and cache Xcode derived data' | ||
|
||
inputs: | ||
deriveddata-directory: | ||
description: 'Directory for derived data' | ||
required: true | ||
sourcepackages-directory: | ||
description: 'Directory for source packages' | ||
required: true | ||
parent: | ||
description: 'Optional input for job dependencies' | ||
required: false | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set Cache Key | ||
id: set-cache-key | ||
run: | | ||
if [ -n "${{ inputs.parent }}" ]; then | ||
echo "RESTORE_CACHE_KEY=xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}-${{ inputs.parent }}" >> $GITHUB_ENV | ||
else | ||
echo "RESTORE_CACHE_KEY=xcode-cache-deriveddata-${{ github.workflow }}-${{ github.event.number }}" >> $GITHUB_ENV | ||
fi | ||
shell: bash | ||
|
||
- name: Cache Xcode Derived Data | ||
uses: irgaly/xcode-cache@v1 | ||
with: | ||
key: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}-${{ github.job }} | ||
restore-keys: | | ||
${{ env.RESTORE_CACHE_KEY }} | ||
deriveddata-directory: derived_data # enable reading it from the input | ||
sourcepackages-directory: spm_cache # enable reading it from the input | ||
|
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,68 @@ | ||
# .github/actions/failure-handling/action.yml | ||
name: 'Failure Handling' | ||
description: 'Handle failure steps including uploading artifacts, sending Slack notifications, and parsing xcresult logs' | ||
inputs: | ||
xcresult-basenames: | ||
description: 'JSON array of base names to xcresult files' | ||
required: true | ||
slack-webhook-url: | ||
description: 'The Slack webhook URL to send notifications to' | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install jq | ||
run: | | ||
if ! command -v jq &> /dev/null; then | ||
brew install jq | ||
fi | ||
shell: bash | ||
|
||
- name: Upload SDK Test Data | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: SDK Test Data ${{ github.job }} | ||
path: ~/Library/Logs/scan | ||
|
||
- name: Send Slack notification | ||
uses: 8398a7/action-slack@v3 | ||
if: ${{ github.event_name == 'push' && failure() }} | ||
with: | ||
status: ${{ job.status }} | ||
text: "You shall not pass!" | ||
job_name: ${{ github.job }} | ||
fields: message,commit,author,action,workflow,job,took | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ inputs.slack-webhook-url }} | ||
MATRIX_CONTEXT: ${{ toJson(matrix) }} | ||
|
||
# Do we need those? | ||
- name: Install xcparse | ||
run: | | ||
brew install chargepoint/xcparse/xcparse | ||
shell: bash | ||
|
||
- name: Parse xcresult | ||
run: | | ||
echo '${{ inputs.xcresult-basenames }}' | jq -r '.[]' | while read basename; do | ||
xcparse logs fastlane/test_output/${basename}.xcresult fastlane/test_output/logs/${basename} | ||
done | ||
shell: bash | ||
|
||
- name: Prepare Test Data Content | ||
if: failure() | ||
run: | | ||
PATHS="" | ||
echo '${{ inputs.xcresult-basenames }}' | jq -r '.[]' | while read basename; do | ||
PATHS="$PATHS fastlane/test_output/logs/${basename}/Diagnostics/**/*.txt fastlane/test_output/logs/${basename}/Diagnostics/simctl_diagnostics/DiagnosticReports/*" | ||
done | ||
echo "PATHS=$PATHS" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Upload Test Data | ||
uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: Test Data ${{ github.job }} | ||
path: ${{ env.PATHS }} |
Oops, something went wrong.