-
Notifications
You must be signed in to change notification settings - Fork 12
73 lines (63 loc) · 2.66 KB
/
status-check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Status Check Workflow
on:
workflow_dispatch:
inputs:
psha:
required: true
jobs:
build:
name: Check Build
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='Building...' \
-f context='API Status Checker'
- 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: Get Current Time
id: current-time
run: echo "time=$(date +"%Y%m%d%H%M%S")" >> $GITHUB_OUTPUT
- name: Cache Build Caches
uses: actions/cache@v3
with:
key: ${{ runner.os }}-check-build-cache-${{ steps.current-time.outputs.time }}
path: |
~/Library/Developer/Xcode/DerivedData
restore-keys: |
${{ runner.os }}-check-build-cache-
- name: Update Status Env
run: echo "FIN_STATUS=failure" >> $GITHUB_ENV
- name: Build DarockBili App
continue-on-error: true
run: |
output=$(xcodebuild -scheme 'DarockBili Watch App' -configuration Release build CODE_SIGN_IDENTITY=""); exit_code=$?; while IFS= read -r line; do if [[ "$line" =~ ^/Users/runner/work/Darock-Bili/Darock-Bili/.*:[0-9]+:[0-9]+:[[:space:]](error|warning|note): ]]; then type="${BASH_REMATCH[1]}"; case $type in "error") color='\e[91m';; "warning") color='\e[93m';; "note") color='\e[94m';; esac; echo -e "${color}$line\e[0m"; IFS= read -r line; echo "$line"; IFS= read -r line; echo "$line"; echo; fi; done <<< "$output"; exit $exit_code
echo "FIN_STATUS=success" >> $GITHUB_ENV
- 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='API Status Checker'