forked from ephread/Instructions
-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (93 loc) · 3.61 KB
/
continuous-integration.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
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"