-
Notifications
You must be signed in to change notification settings - Fork 3
132 lines (112 loc) · 4.29 KB
/
build-ios-simulator.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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Create an iOS Simulator build
on:
push:
paths:
- '*'
- '.github/workflows/build-ios-simulator.yml'
- 'ios/**'
- 'src/**'
- '!**/*.md'
branches:
- ionic
jobs:
build-ios-simulator:
name: Create an iOS Simulator build
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
# Setup Web environment to install packages.
- name: Setup Web environment
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- uses: hendrikmuhs/ccache-action@v1.2
name: Xcode Compile Cache
with:
key: ${{ runner.os }}-ccache # makes a unique key w/related restore key internally
create-symlink: true
max-size: 1500M
- name: Restore node_modules from cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-node-modules-
- name: Install Ionic CLI
run: npm install -g @ionic/cli
- name: Install packages
run: npm ci
# # improve iOS build compilation time
# - name: Restore buildcache
# uses: mikehardy/buildcache-action@v2
# continue-on-error: true
- name: Restore Pods cache
uses: actions/cache@v4
with:
path: |
ios/App/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }}
restore-keys: ${{ runner.os }}-pods-
- name: Restore build artifacts from cache
uses: actions/cache@v4
with:
path: ios/App/build
key: ${{ runner.os }}-ios-derived-data-${{ hashFiles('ios/Podfile.lock') }}
restore-keys: ${{ runner.os }}-ios-derived-data-
- name: Build the ionic project for iOS
run: ionic capacitor build ios --prod --no-open
# - name: Restore build artifacts from cache
# uses: actions/cache@v4
# with:
# path: ~/Library/Developer/Xcode/DerivedData
# key: ${{ runner.os }}-ios-derived-data-${{ hashFiles('ios/Podfile.lock') }}
# restore-keys: |
# ${{ runner.os }}-ios-derived-data-
# - name: Run app on iOS
# run: npx react-native run-ios --simulator 'iPhone 14 Pro Max' --configuration Release
# - name: Store build .app file as zip
# working-directory: ios
# run: |
# cd ~/Library/Developer/Xcode/DerivedData/rn_test_github_actions-*/Build/Products/Release-iphonesimulator
# mkdir -p output
# zip -r -y -o output/rn_test_github_actions.zip rn_test_github_actions.app
# - name: Save build file as artifact
# uses: actions/upload-artifact@v4
# with:
# name: rn-ios-simulator-build
# path: ~/Library/Developer/Xcode/DerivedData/rn_test_github_actions-*/Build/Products/Release-iphonesimulator/output
- name: Install xcpretty
run: gem install xcpretty
- name: Run simulator build command
working-directory: ios/App
run: |
export CCACHE_SLOPPINESS=clang_index_store,file_stat_matches,include_file_ctime,include_file_mtime,ivfsoverlay,pch_defines,modules,system_headers,time_macros
export CCACHE_FILECLONE=true
export CCACHE_DEPEND=true
export CCACHE_INODECACHE=true
export CCACHE_LIMIT_MULTIPLE=0.95
ccache -s
set -o pipefail
xcodebuild \
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
-scheme App \
-workspace App.xcworkspace \
-sdk iphonesimulator \
-configuration Release \
-derivedDataPath build | xcpretty
ccache -s
- name: Store build .app file as zip
working-directory: ios/App
run: |
cd build/Build/Products/Release-iphonesimulator
mv App.app ionic_github_action_ios.app
mkdir -p output
zip -r -y -o output/ionic_github_action_ios.zip ionic_github_action_ios.app
- name: Save build file as artifact
uses: actions/upload-artifact@v4
with:
name: ionic-ios-simulator-build
path: ios/App/build/Build/Products/Release-iphonesimulator/output