-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (60 loc) · 2.68 KB
/
macos-xcode.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
name: Xcode - Build and Analyze
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
name: Build and analyse default scheme using xcodebuild command
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: target
key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.OS }}-build-
- name: Install latest rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: beta
target: x86_64-apple-darwin
default: true
override: true
- name: Install dylibbundler
run: |
brew install dylibbundler
- name: Build for mac
run: ./build_macos_lib.sh
- name: Set Default Scheme
working-directory: ./macos
run: |
scheme_list=$(xcodebuild -list -json | tr -d "\n")
default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]")
echo $default | cat >default
echo Using default scheme: $default
- name: Build
working-directory: ./macos
env:
scheme: ${{ 'default' }}
run: |
if [ $scheme = default ]; then scheme=$(cat default); fi
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
file_to_build=`echo $file_to_build | awk '{$1=$1;print}'`
xcodebuild ARCHS=x86_64 ONLY_ACTIVE_ARCH=NO clean build analyze archive -scheme "$scheme" -"$filetype_parameter" "$file_to_build" | xcpretty && exit ${PIPESTATUS[0]}
- name: Get App
working-directory: ./macos
run: |
xcodebuild ARCHS=x86_64 ONLY_ACTIVE_ARCH=NO archive -archivePath archive.xcarchive -scheme Cappy3ds
xcodebuild -archivePath ./archive.xcarchive -exportArchive -exportPath ./ -exportOptionsPlist ./exportOptionsAdHoc.plist
dylibBundler -b -cd -d ./Cappy3ds.app/Contents/Frameworks -p @executable_path/../Frameworks/ -x ./Cappy3ds.app/Contents/Frameworks/libcappy3ds_render.dylib
install_name_tool -change /Users/runner/work/Cappy3ds/Cappy3ds/target/debug/deps/libcappy3ds_render.dylib @executable_path/../Frameworks/libcappy3ds_render.dylib ./Cappy3ds.app/Contents/MacOS/Cappy3ds
zip -r -X ../result.zip Cappy3ds.app
- uses: actions/upload-artifact@v3
with:
name: macOS
path: result.zip