Skip to content

Commit 593d8fa

Browse files
committed
Use the generic Xcode Build template
1 parent 7840124 commit 593d8fa

1 file changed

Lines changed: 19 additions & 25 deletions

File tree

.github/workflows/build.yaml

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,32 @@
1-
name: Build
1+
name: Xcode - Build and Analyze
22

33
on:
44
push:
5-
branches: ["main"]
5+
branches: [ "main" ]
66
pull_request:
7-
branches: ["main"]
8-
9-
concurrency:
10-
group: build-${{ github.ref }}
11-
cancel-in-progress: true
7+
branches: [ "main" ]
128

139
jobs:
1410
build:
15-
name: Build Relay
16-
runs-on: macos-15
11+
name: Build and analyse default scheme using xcodebuild command
12+
runs-on: macos-latest
13+
1714
steps:
1815
- name: Checkout
1916
uses: actions/checkout@v4
20-
21-
- name: Select Xcode
22-
run: sudo xcode-select -s /Applications/Xcode_26.app/Contents/Developer
23-
17+
- name: Set Default Scheme
18+
run: |
19+
scheme_list=$(xcodebuild -list -json | tr -d "\n")
20+
default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]")
21+
echo $default | cat >default
22+
echo Using default scheme: $default
2423
- name: Create Secrets.xcconfig
2524
run: cp Secrets.xcconfig.example Secrets.xcconfig
26-
27-
- name: Resolve packages
28-
run: xcodebuild -resolvePackageDependencies -project Relay.xcodeproj -scheme Relay
29-
3025
- name: Build
31-
run: >
32-
xcodebuild build
33-
-project Relay.xcodeproj
34-
-scheme Relay
35-
-destination 'generic/platform=macOS'
36-
CODE_SIGN_IDENTITY="-"
37-
CODE_SIGNING_ALLOWED=NO
38-
| xcpretty && exit ${PIPESTATUS[0]}
26+
env:
27+
scheme: ${{ 'default' }}
28+
run: |
29+
if [ $scheme = default ]; then scheme=$(cat default); fi
30+
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi
31+
file_to_build=`echo $file_to_build | awk '{$1=$1;print}'`
32+
xcodebuild clean build analyze -scheme "$scheme" -"$filetype_parameter" "$file_to_build" | xcpretty && exit ${PIPESTATUS[0]}

0 commit comments

Comments
 (0)