fix: added support for Swift 6 #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches: | |
- master | |
- github-actions | |
- 'release-**' | |
env: | |
# Expected to be used withint scripts. | |
LANG: en_US.UTF-8 | |
PROJECT: "Instructions.xcodeproj" | |
EXAMPLE_PROJECT: "Examples/Instructions Example.xcodeproj" | |
APPEX_EXAMPLE_PROJECT: "Examples/Instructions App Extensions Example.xcodeproj" | |
SCHEME: "Instructions" | |
EXAMPLE_SCHEME: "Instructions Example" | |
APPEX_EXAMPLE_SCHEME: "Instructions App Extensions Example" | |
SDK: "iphonesimulator13.4" | |
ALLOW_WARNINGS: "NO" | |
DESTINATION: "OS=13.4,name=iPhone 11" | |
# Wether or not to perform certain steps. | |
run_pod_lint: true | |
build_example: true | |
build_app_extension_example: true | |
run_tests: true | |
jobs: | |
test: | |
name: Build, lint & test | |
runs-on: macos-10.15 | |
steps: | |
- name: Switch Xcode version | |
run: sudo xcode-select --switch /Applications/Xcode_11.4_beta.app | |
- name: Check out the repository | |
uses: actions/checkout@v2 | |
with: | |
submodules: 'recursive' | |
- name: Install test dependencies | |
run: | | |
gem install slather | |
cd "Examples" && carthage bootstrap --platform ios && cd .. | |
- name: Run Cocoapods' linter | |
if: env.run_pod_lint == 'true' | |
# Warnings might be allowed in versions where Instructions continue to support | |
# deprecated methods. | |
run: | | |
if [ $ALLOW_WARNINGS == "YES" ]; then | |
pod lib lint --allow-warnings; | |
else | |
pod lib lint; | |
fi | |
- name: Build example project | |
if: env.build_example == 'true' | |
run: > | |
set -o pipefail && xcodebuild clean build -project "$EXAMPLE_PROJECT" | |
-scheme "$EXAMPLE_SCHEME" -sdk "$SDK" -destination "$DESTINATION" | |
ONLY_ACTIVE_ARCH=YES | xcpretty -c; | |
- name: Build App Extensions example project | |
if: env.build_app_extension_example == 'true' | |
run: > | |
set -o pipefail && xcodebuild clean build -project "$APPEX_EXAMPLE_PROJECT" | |
-scheme "$APPEX_EXAMPLE_SCHEME" -sdk "$SDK" -destination "$DESTINATION" | |
ONLY_ACTIVE_ARCH=YES | xcpretty -c; | |
- name: Build frameworks | |
run: > | |
set -o pipefail && xcodebuild clean build -project "$PROJECT" | |
-scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" | |
-configuration Debug ONLY_ACTIVE_ARCH=YES | xcpretty -c; | |
- name: Run tests | |
if: env.run_tests == 'true' | |
env: | |
# Instead of using a matrix, we're just going to use a bash loop to | |
# test multiple simulators. | |
IPHONE_11: "OS=13.4,name=iPhone 11" | |
IPHONE_8: "OS=13.4,name=iPhone 8" | |
IPAD_PRO: "OS=13.4,name=iPad Pro (11-inch) (2nd generation)" | |
IPAD_AIR: "OS=13.4,name=iPad Air (3rd generation)" | |
run: | | |
IFS_BACKUP=$IFS | |
IFS=":" | |
DEVICES="${IPHONE_11}:${IPHONE_8}:${IPAD_PRO}:${IPAD_AIR}" | |
for TEST_DESTINATION in ${DEVICES[@]}; do | |
set -o pipefail && xcodebuild test -project "$EXAMPLE_PROJECT" -scheme "$EXAMPLE_SCHEME" \ | |
-sdk "$SDK" -destination "$TEST_DESTINATION" -configuration Debug -enableCodeCoverage YES \ | |
-derivedDataPath Build/ ONLY_ACTIVE_ARCH=YES | xcpretty -c; | |
done | |
IFS=$IFS_BACKUP | |
- name: Convert and upload coverage | |
uses: paambaati/[email protected] | |
if: env.run_tests == 'true' | |
env: | |
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}} | |
with: | |
coverageCommand: "slather coverage -x --build-directory Build/" | |
coverageLocations: "${{github.workspace}}/Tests/cobertura.xml:cobertura" |