-
Notifications
You must be signed in to change notification settings - Fork 10
139 lines (113 loc) · 3.62 KB
/
build-and-test.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
135
136
137
138
139
name: Build and Test
env:
afterpay-scheme: Afterpay
DEVELOPER_DIR: /Applications/Xcode_15.0.1.app/Contents/Developer
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build-and-test:
name: Build and Test
runs-on: macos-latest
env:
destination: platform=iOS Simulator,name=iPhone 15,OS=17.4
example-scheme: Example
example-ui-test-scheme: ExampleUITests
workspace: Afterpay.xcworkspace
steps:
- uses: actions/checkout@v3
- name: Cache Mint Packages
uses: actions/cache@v3
with:
path: /usr/local/lib/mint
key: ${{ runner.os }}-mint-${{ hashFiles('Mintfile') }}
restore-keys: |
${{ runner.os }}-mint-
- name: Install Dependencies
run: Tools/mint/mint bootstrap
- name: SwiftLint
run: Tools/mint/mint run swiftlint --reporter github-actions-logging
- name: Build SDK Project
run: |
xcodebuild build-for-testing \
-workspace ${{ env.workspace }} \
-scheme ${{ env.afterpay-scheme }} \
-destination '${{ env.destination }}'
- name: Test SDK Project
run: |
xcodebuild test-without-building \
-workspace ${{ env.workspace }} \
-scheme ${{ env.afterpay-scheme }} \
-destination '${{ env.destination }}'
- name: Build Example Project
run: |
xcodebuild \
-workspace ${{ env.workspace }} \
-scheme ${{ env.example-scheme }} \
-skipPackagePluginValidation \
-destination '${{ env.destination }}'
- name: Checkout Example Server
uses: actions/checkout@v3
with:
repository: afterpay/sdk-example-server
path: ./example-server
- name: Setup Example Server
uses: actions/setup-node@v3
with:
node-version: 16
- name: Run Example Server
working-directory: ./example-server
run: |
npm install
npm run build
npm run start &
env:
AFTERPAY_MERCHANT_ID: ${{ secrets.AFTERPAY_MERCHANT_ID_AU }}
AFTERPAY_SECRET_KEY: ${{ secrets.AFTERPAY_SECRET_KEY_AU }}
AFTERPAY_REGION: AU
- name: UI Test SDK Project
run: |
xcodebuild build-for-testing \
-workspace ${{ env.workspace }} \
-scheme ${{ env.example-ui-test-scheme }} \
-skipPackagePluginValidation \
-destination '${{ env.destination }}'
xcodebuild test-without-building \
-workspace ${{ env.workspace }} \
-scheme ${{ env.example-ui-test-scheme }} \
-destination '${{ env.destination }}'
- name: Upload UI test artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: xcresults
path: /Users/runner/Library/Developer/Xcode/DerivedData/Afterpay-*/Logs/Test/*
validate-cocoapods:
name: Validate Pod
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
run: gem install cocoapods
- name: Validate Pod
run: |
export LIB_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)
pod lib lint
validate-swift-package:
name: Validate Swift Package
runs-on: macos-latest
env:
destination: platform=macOS,variant=Mac Catalyst
workspace: .swiftpm/xcode/package.xcworkspace
steps:
- uses: actions/checkout@v3
- name: Validate Swift Package
run: |
xcodebuild \
-workspace ${{ env.workspace }} \
-scheme ${{ env.afterpay-scheme }} \
-destination '${{ env.destination }}'