Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI]Parallelize LLC tests #593

Draft
wants to merge 21 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .github/actions/bootstrap/action.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
name: 'Bootstrap'
description: 'Run bootstrap.sh'

input:
parent:
description: 'Optional input for job dependencies'
required: false

runs:
using: "composite"
steps:

- run: echo "IMAGE=${ImageOS}-${ImageVersion}" >> $GITHUB_ENV
shell: bash

- run: echo "$HOME/.mint/bin" >> $GITHUB_PATH
shell: bash

- name: Cache Mint
uses: actions/cache@v4
id: mint-cache
with:
path: ~/.mint
key: ${{ env.IMAGE }}-mint-${{ hashFiles('**/Mintfile') }}
restore-keys: ${{ env.IMAGE }}-mint-

- name: Cache brew
uses: actions/cache@v4
id: brew-cache
Expand All @@ -26,6 +36,14 @@ runs:
key: ${{ env.IMAGE }}-brew-${{ hashFiles('**/Brewfile.lock.json') }}
restore-keys: ${{ env.IMAGE }}-brew-
- uses: ./.github/actions/ruby-cache
- uses: ./.github/actions/xcode-cache
- uses: ./.github/actions/python-cache

- name: Xcode Cache
uses: ./.github/actions/dynamic-xcode-cache
with:
deriveddata-directory: derived_data
sourcepackages-directory: spm_cache
parent: ${{ inputs.parent }}

- run: ./Scripts/bootstrap.sh
shell: bash
43 changes: 43 additions & 0 deletions .github/actions/build-xcframework/action.yml
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 }}
37 changes: 37 additions & 0 deletions .github/actions/dynamic-xcode-cache/action.yml
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-${{ env.XCODE_VERSION }}-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}-${{ inputs.parent }}" >> $GITHUB_ENV
else
echo "RESTORE_CACHE_KEY=xcode-${{ env.XCODE_VERSION }}-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-${{ env.XCODE_VERSION }}-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

68 changes: 68 additions & 0 deletions .github/actions/failure-handling/action.yml
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 }}
Loading
Loading