-
Notifications
You must be signed in to change notification settings - Fork 2
137 lines (114 loc) · 4.22 KB
/
tests.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
name: Tests
on:
push:
pull_request:
branches:
- "**:**" # PRs from forks have a prefix with `owner:`
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
macos_tests:
name: macOS Tests (SwiftPM, Xcode ${{ matrix.xcode }})
runs-on: "macos-14"
strategy:
fail-fast: false
matrix:
xcode: ["15.1", "15.3"]
steps:
- uses: actions/checkout@v4
- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.xcode }}.app
- name: Cache SwiftPM
uses: actions/cache@v3
with:
path: .build
key: ${{ runner.os }}-xcode_${{ matrix.xcode }}-swiftpm-${{ github.ref }}-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-xcode_${{ matrix.xcode }}-swiftpm-${{ github.ref }}-
${{ runner.os }}-xcode_${{ matrix.xcode }}-swiftpm-main-
${{ runner.os }}-xcode_${{ matrix.xcode }}-swiftpm-
- name: SwiftPM tests
run: swift test --enable-code-coverage
- name: Convert coverage for Codecov
id: convert-coverage
uses: sersoft-gmbh/swift-coverage-action@v4
with:
ignore-conversion-failures: true
fail-on-empty-output: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ${{ join(fromJSON(steps.convert-coverage.outputs.files), ',') }}
fail_ci_if_error: true
xcode_tests:
name: ${{ matrix.platform }} Tests (Xcode ${{ matrix.xcode }})
runs-on: macos-14
strategy:
fail-fast: false
matrix:
xcode: ["15.1", "15.3"]
platform: ["macOS", "iOS", "tvOS", "watchOS", "macCatalyst"]
steps:
- uses: actions/checkout@v4
- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.xcode }}.app
- name: Install Mint
run: brew install mint
- name: Cache Mint
uses: actions/cache@v3
with:
path: ~/.mint
key: ${{ runner.os }}-mint-xcode_${{ matrix.xcode }}-${{ hashFiles('**/Mintfile') }}
restore-keys: |
${{ runner.os }}-mint-xcode_${{ matrix.xcode }}
- run: mint bootstrap
- name: Cache DerivedData
uses: actions/cache@v3
with:
path: ~/Library/Developer/Xcode/DerivedData
key: ${{ runner.os }}-xcode_${{ matrix.xcode }}-derived_data-${{ github.ref }}
restore-keys: |
${{ runner.os }}-xcode_${{ matrix.xcode }}-derived_data-main
${{ runner.os }}-xcode_${{ matrix.xcode }}-derived_data-
- name: Run Tests
run: |
set -o pipefail
mint run xcutils test ${{ matrix.platform }} --scheme HashableMacro --enable-code-coverage | $(mint which xcbeautify)
- name: Convert coverage for Codecov
id: convert-coverage
uses: sersoft-gmbh/swift-coverage-action@v4
with:
fail-on-empty-output: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ${{ join(fromJSON(steps.convert-coverage.outputs.files), ',') }}
fail_ci_if_error: true
linux_tests:
name: Swift ${{ matrix.swift }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
container:
image: swift:${{ matrix.swift }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
swift: ["5.9.2", "5.10"]
steps:
- uses: actions/checkout@v4
- name: Cache SwiftPM
uses: actions/cache@v3
with:
path: .build
key: ${{ runner.os }}-swift_${{ matrix.swift }}-swiftpm-deps-${{ github.ref }}-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ runner.os }}-swift_${{ matrix.swift }}-swiftpm-deps-${{ github.ref }}-
${{ runner.os }}-swift_${{ matrix.swift }}-swiftpm-deps-main-
${{ runner.os }}-swift_${{ matrix.swift }}-swiftpm-deps-
- name: swift test
run: swift test