-
Notifications
You must be signed in to change notification settings - Fork 5
134 lines (130 loc) · 6.27 KB
/
ci.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
133
134
# Workflow supports podspec verification for iOS SDK 9.x (iOS 15) and iOS SDK 10.x (iOS 16)
name: CI
on:
push:
branches: [ main, ci-test ]
pull_request:
workflow_dispatch:
inputs:
frameworkVersion:
description: 'Framework Version'
required: true
default: '9.2.7'
iOSVersion:
description: 'iOS Version'
required: true
default: '15.0'
jobs:
verify-podspec-install:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Create .netrc file with credentials to download binaries from SAP RSBC
uses: bcomnes/netrc-creds@v3
with:
machine: rbsc.repositories.cloud.sap
login: sap-sdkiospecs
password: ${{ secrets.RSBC_USER_BASICAUTH_PWD }}
- name: Install required tools
run: brew install xcodegen
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
if: github.event_name != 'workflow_dispatch'
- name: Determine relevant podspec versions (based on changed files)
id: frameworkVersion
if: github.event_name != 'workflow_dispatch'
run: |
relevantVersion=9.0.1 # safeguard in case no podspec file(s) were changed
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
lastVersion=`echo ${file} | cut -d / -f 2`
[[ $lastVersion == [0-9]* ]] && relevantVersion=$lastVersion
echo "File checked: ${file}."
done
echo ${relevantVersion}
echo "determinedFrameworkVersion=$relevantVersion" >> $GITHUB_ENV
- name: Comment on PR if no framework version can be determined
if: github.event_name == 'pull_request' && env.determinedFrameworkVersion == '9.0.1'
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🚨 Cannot determine relevant framework version'
})
- name: Determine iOSVersion
id: iOSVersion
if: github.event_name != 'workflow_dispatch'
run: |
frameworkVersion=${{ env.determinedFrameworkVersion }}
majorMinorVersion=$(echo $frameworkVersion | cut -d '.' -f 1-2)
if [ "$majorMinorVersion" = "24.12" ]; then
iOSVersion="17.0"
elif [ "$majorMinorVersion" = "24.8" ] || [ "$majorMinorVersion" = "24.4" ] || [ "$majorMinorVersion" = "10.0" ]; then
iOSVersion="16.0"
else
iOSVersion="16.0" # Default fallback
fi
echo "Framework version: $frameworkVersion -> iOS version: $iOSVersion"
echo "iOSVersion=$iOSVersion" >> $GITHUB_ENV - name: Create Podfile with latest podspecs
- name: Create Podfile with latest podspecs
if: github.event_name != 'workflow_dispatch'
run: |
cd .testing
rm Podfile
echo "platform :ios, '${{ env.iOSVersion }}'" >> Podfile
echo "use_frameworks!" >> Podfile
echo "target 'TestApp' do" >> Podfile
echo " pod 'SAPCommon', :podspec => '../SAPCommon/${{ env.determinedFrameworkVersion }}/SAPCommon.podspec'" >> Podfile
echo " pod 'SAPFoundation', :podspec => '../SAPFoundation/${{ env.determinedFrameworkVersion }}/SAPFoundation.podspec'" >> Podfile
echo " pod 'SAPFiori', :podspec => '../SAPFiori/${{ env.determinedFrameworkVersion }}/SAPFiori.podspec'" >> Podfile
echo " pod 'SAPFioriFlows', :podspec => '../SAPFioriFlows/${{ env.determinedFrameworkVersion }}/SAPFioriFlows.podspec'" >> Podfile
echo " pod 'SAPOData', :podspec => '../SAPOData/${{ env.determinedFrameworkVersion }}/SAPOData.podspec'" >> Podfile
echo " pod 'SAPOfflineOData', :podspec => '../SAPOfflineOData/${{ env.determinedFrameworkVersion }}/SAPOfflineOData.podspec'" >> Podfile
echo " pod 'SAPML', :podspec => '../SAPML/${{ env.determinedFrameworkVersion }}/SAPML.podspec'" >> Podfile
echo "end" >> Podfile
cat Podfile
- name: Create Podfile with version specified manually
if: github.event_name == 'workflow_dispatch'
run: |
cd .testing
rm Podfile
echo "platform :ios, '${{ github.event.inputs.iOSVersion }}'" >> Podfile
echo "use_frameworks!" >> Podfile
echo "target 'TestApp' do" >> Podfile
echo " pod 'SAPCommon', :podspec => '../SAPCommon/${{ github.event.inputs.frameworkVersion }}/SAPCommon.podspec'" >> Podfile
echo " pod 'SAPFoundation', :podspec => '../SAPFoundation/${{ github.event.inputs.frameworkVersion }}/SAPFoundation.podspec'" >> Podfile
echo " pod 'SAPFiori', :podspec => '../SAPFiori/${{ github.event.inputs.frameworkVersion }}/SAPFiori.podspec'" >> Podfile
echo " pod 'SAPFioriFlows', :podspec => '../SAPFioriFlows/${{ github.event.inputs.frameworkVersion }}/SAPFioriFlows.podspec'" >> Podfile
echo " pod 'SAPOData', :podspec => '../SAPOData/${{ github.event.inputs.frameworkVersion }}/SAPOData.podspec'" >> Podfile
echo " pod 'SAPOfflineOData', :podspec => '../SAPOfflineOData/${{ github.event.inputs.frameworkVersion }}/SAPOfflineOData.podspec'" >> Podfile
echo " pod 'SAPML', :podspec => '../SAPML/${{ github.event.inputs.frameworkVersion }}/SAPML.podspec'" >> Podfile
echo "end" >> Podfile
cat Podfile
- name: "Displays Xcode current version"
run: sudo xcode-select -p
- name: Determine Xcode version based on iOS version
run: |
if [[ ${{ env.iOSVersion }} == '17.0' ]]; then
neededXcode='Xcode_16.1'
else
neededXcode='Xcode_15.4'
fi
echo "neededXcode=$neededXcode" >> $GITHUB_ENV
- name: "Set Xcode version"
if: env.neededXcode != ''
run: sudo xcode-select -s /Applications/${{ env.neededXcode }}.app/Contents/Developer
- name: Create test application
run: |
cd .testing
xcodegen generate
- name: Install pods for test application
run: |
cd .testing
pod install
- name: Build test application (which uses the frameworks)
run: |
cd .testing
xcodebuild -workspace TestApp.xcworkspace -scheme 'TestApp' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15' clean build