-
Notifications
You must be signed in to change notification settings - Fork 16
140 lines (113 loc) · 3.57 KB
/
build.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
140
name: Build
on:
pull_request:
push:
branches:
- 'main'
- 'chore/**'
- 'docs/**'
- 'feat/**'
- 'feature/**'
- 'fix/**'
- 'refactor/**'
- 'releases/**'
- 'style/**'
- 'test/**'
- 'tech/**'
- 'for-posterity/**'
env:
RUST_TARGET_PATH: pact-reference
jobs:
test:
name: Run ${{ matrix.platform }} on ${{ matrix.host }}
runs-on: ${{ matrix.host }}
strategy:
fail-fast: true
matrix:
host: [macos-11, macos-12]
platform: [ios, macos]
include:
- platform: ios
scheme: "PactSwift-iOS"
destination: "platform=iOS Simulator,name=iPhone 12 Pro"
- platform: macos
scheme: "PactSwift-macOS"
destination: "arch=x86_64"
- host: macos-11
xcode: 13.2.1
- host: macos-12
xcode: 14.0.1
env:
SCHEME: ${{ matrix.scheme }}
DESTINATION: ${{ matrix.destination }}
concurrency:
group: test_${{ matrix.host }}_${{ matrix.scheme }}_${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Use Xcode ${{ matrix.xcode }}
run: sudo xcode-select -switch /Applications/Xcode_${{ matrix.xcode }}.app
- name: Prepare Tools
run: |
Scripts/prepare_build_tools
- name: Run tests (Xcode)
run: |
set -o pipefail && xcodebuild clean test -project PactSwift.xcodeproj -scheme "$SCHEME" -destination "$DESTINATION" GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES | xcbeautify
- name: Run tests (CLI - Swift Package)
run: |
swift build
swift test -c release
test_linux:
name: Run on Ubuntu
runs-on: ubuntu-latest
strategy:
fail-fast: true
concurrency:
group: test-linux-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: fwal/setup-swift@v1
- name: Get swift version
run: swift --version
- name: "⬇️ Checkout repository"
uses: actions/checkout@v2
- name: Install Protoc
uses: arduino/setup-protoc@v1
- name: "♼ Cache rust binaries"
uses: actions/cache@v3
with:
path: |
${{ env.RUST_TARGET_PATH }}
key: build-${{ runner.os }}-rust-pactswift-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
build-${{ runner.os }}-rust-pactswift
build-${{ runner.os }}-rust-
- name: "⚗️ Build and Test"
run: |
Scripts/build_test_linux
test_carthage:
name: "Verify for Carthage"
runs-on: macos-12
strategy:
fail-fast: true
concurrency:
group: test-carthage-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Use Xcode 13.4.1
run: sudo xcode-select -switch /Applications/Xcode_13.4.1.app
- name: Carthage build
run: |
carthage build --use-xcframeworks --no-skip-current
after_success:
needs: [test, test_carthage, test_linux]
name: Build demo projects
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Build demo projects
run: |
curl -X POST https://api.github.com/repos/surpher/pact-swift-examples/dispatches -H 'Accept: application/vnd.github.everest-preview+json' -u ${{ secrets.PACT_SWIFT_TOKEN }} --data '{"event_type":"PactSwift - ${{ github.event.head_commit.message }}"}'