Skip to content

Commit

Permalink
Merge pull request #26 from Darock-Studio/dev/test-screenshot
Browse files Browse the repository at this point in the history
Make UI Test Screenshots Ready to View in CI
  • Loading branch information
WindowsMEMZ authored Dec 10, 2023
2 parents a44e1da + 03eed3c commit 9a28153
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/ui-test.yml
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'

0 comments on commit 9a28153

Please sign in to comment.