forked from SwiftUIX/SwiftUIX
-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (81 loc) · 2.75 KB
/
Copy pathbuild.yml
File metadata and controls
98 lines (81 loc) · 2.75 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# This workflow builds the project for all platforms.
# For more information see:
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
name: Build Runner
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build (${{ matrix.name }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- name: Xcode 16
runner: macos-15
xcode-version: "16"
- name: Xcode 26
runner: macos-26
xcode-version: "26"
steps:
- name: Checkout Code
uses: actions/checkout@v5
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode-version }}
- name: Show Xcode Version
run: xcodebuild -version
- name: Install xcbeautify
run: |
if ! command -v xcbeautify >/dev/null 2>&1; then
brew install xcbeautify
fi
- name: Build All Platforms
shell: bash
run: |
set -eo pipefail
TARGET=""
DESTINATIONS=(
"iOS|generic/platform=iOS"
"macOS|generic/platform=macOS"
"Mac Catalyst|platform=macOS,variant=Mac Catalyst,arch=arm64"
"tvOS|generic/platform=tvOS"
"watchOS|generic/platform=watchOS"
"visionOS|generic/platform=visionOS"
)
if [ -z "$TARGET" ]; then
TARGET=$(swift package dump-package | python3 -c "import json,sys; print(json.load(sys.stdin)['name'])")
if [ -z "$TARGET" ]; then
echo "Error: Failed to resolve package name"
exit 1
fi
fi
build_destination() {
local NAME=$1
local DESTINATION=$2
echo "Building $TARGET for $NAME..."
if ! NSUnbufferedIO=YES xcodebuild -scheme "$TARGET" -derivedDataPath .build -destination "$DESTINATION" build 2>&1 | xcbeautify --renderer github-actions; then
echo "Failed to build $TARGET for $NAME"
return 1
fi
echo "Successfully built $TARGET for $NAME"
}
echo
echo "Building $TARGET for configured destinations..."
for DESTINATION_PAIR in "${DESTINATIONS[@]}"; do
NAME="${DESTINATION_PAIR%%|*}"
DESTINATION="${DESTINATION_PAIR#*|}"
if ! build_destination "$NAME" "$DESTINATION"; then
exit 1
fi
done
echo
echo "Building $TARGET completed successfully!"