Skip to content

CI

CI #215

Workflow file for this run

# 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-13
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: |
iOSVersion=$(if [[ ${{env.determinedFrameworkVersion}} = 9* ]]; then echo '15.0'; else echo '16.0'; fi)
echo "$iOSVersion"
echo "iOSVersion=$iOSVersion" >> $GITHUB_ENV
- 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 needed
run: |
neededXcode='Xcode_15.2'
echo "neededXcode=$neededXcode" >> $GITHUB_ENV
- name: "Set Xcode version 15.2"
if: env.neededXcode == 'Xcode_15.2'
run: sudo xcode-select -s /Applications/Xcode_15.2.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