-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from Darock-Studio/dev/test-screenshot
Make UI Test Screenshots Ready to View in CI
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: UI Test Workflow | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
psha: | ||
required: true | ||
|
||
jobs: | ||
test: | ||
name: UI Test | ||
runs-on: macos-13 | ||
permissions: | ||
checks: write | ||
statuses: write | ||
env: | ||
FIN_STATUS: "error" | ||
GH_TOKEN: ${{ github.token }} | ||
steps: | ||
- name: Update Check Status | ||
run: | | ||
gh api \ | ||
--method POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/${{ github.repository }}/statuses/$GITHUB_SHA \ | ||
-f state='pending' \ | ||
-f target_url='https://github.com/Darock-Studio/Darock-Bili/actions/runs/${{ github.run_id }}' \ | ||
-f description='Testing...' \ | ||
-f context='UI Test' | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.psha }} | ||
|
||
- name: Set Xcode Version | ||
run: sudo xcode-select -s /Applications/Xcode_15.0.app | ||
|
||
- name: Prepare Environment | ||
run: | | ||
brew install chargepoint/xcparse/xcparse | ||
mkdir Caches | ||
- name: Update Status Env | ||
run: echo "FIN_STATUS=failure" >> $GITHUB_ENV | ||
|
||
- name: Run DarockBili Watch App UI Test | ||
run: | | ||
xcodebuild test -scheme 'DarockBili Watch App' -configuration Release -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 (41mm),OS=10.0' -destination 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm),OS=10.0' -testPlan WatchAppUITestPlan -testProductsPath ./Caches/TestProducts.xctestproducts -derivedDataPath ./Caches/DerivedData | ||
echo "FIN_STATUS=success" >> $GITHUB_ENV | ||
- name: Process Test Result | ||
run: | | ||
mv ./Caches/DerivedData/Logs/Test/Test-*.xcresult ./Caches/DerivedData/Logs/Test/Test-1.xcresult | ||
mkdir Caches/ExportFiles | ||
xcparse -s ./Caches/DerivedData/Logs/Test/Test-1.xcresult ./Caches/ExportFiles | ||
- name: Upload Test Attachments | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Test Attachments | ||
path: ./Caches/ExportFiles | ||
|
||
- name: Update Check Status | ||
if: always() | ||
run: | | ||
gh api \ | ||
--method POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/${{ github.repository }}/statuses/$GITHUB_SHA \ | ||
-f state='${{ env.FIN_STATUS }}' \ | ||
-f target_url='https://github.com/Darock-Studio/Darock-Bili/actions/runs/${{ github.run_id }}' \ | ||
-f context='Unit Test' | ||