-
Notifications
You must be signed in to change notification settings - Fork 639
150 lines (142 loc) · 4.62 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
141
142
143
144
145
146
147
148
149
150
name: build
on:
push:
pull_request:
jobs:
macos:
strategy:
fail-fast: false
matrix:
macos:
- 12
- 13
- latest
xcode:
- latest-stable
runs-on: macos-${{ matrix.macos }}
steps:
- name: Select Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode }}
- name: Checkout
uses: actions/checkout@v4
- name: Build and Test
run: |
# Set up a git user for the git tests
git config user.name "test user"
git config user.email "[email protected]"
xcodebuild -project SwiftFormat.xcodeproj -scheme "SwiftFormat (Framework)" -sdk macosx clean build test -enableCodeCoverage YES -derivedDataPath Build/
cd Build/Build/ProfileData
cd $(ls -d */|head -n 1)
directory=${PWD##*/}
pathCoverage=Build/Build/ProfileData/${directory}/Coverage.profdata
cd ../../../../
xcrun llvm-cov export -format="lcov" -instr-profile $pathCoverage Build/Build/Products/Debug/SwiftFormat.framework/SwiftFormat > info.lcov
- name: Codecov
uses: codecov/codecov-action@v4
with:
# the token is optional for a public repo, but including it anyway
token: a47579fa-9a2a-4c48-b557-aa725c6b5f92
env_vars: MD_APPLE_SDK_ROOT,RUNNER_OS,RUNNER_ARCH
linux:
strategy:
fail-fast: false
matrix:
swiftver:
- swift:5.3
- swift:5.10
swiftos:
- focal
runs-on: ubuntu-latest
container:
image: ${{ format('{0}-{1}', matrix.swiftver, matrix.swiftos) }}
options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --security-opt apparmor=unconfined
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and Test
run: |
# Set up a git user for the git tests
git config --global user.name "test user"
git config --global user.email "[email protected]"
# Needed to be allowed to run git commands in the tests
# https://github.com/actions/runner-images/issues/6775
git config --global --add safe.directory /__w/SwiftFormat/SwiftFormat
swift test --enable-test-discovery
windows:
strategy:
fail-fast: false
matrix:
include:
# Oldest working version.
# 5.6 fails with "error: could not build C module 'CDispatch'"
# 5.7 fails with "error: expressions are not allowed at the top level" for "XCTMain(tests)"
- branch: swift-5.8-release
tag: 5.8-RELEASE
# Version used by the release workflow
- branch: swift-5.10.1-release
tag: 5.10.1-RELEASE
runs-on: windows-latest
name: windows (${{ matrix.tag }})
steps:
- uses: compnerd/gha-setup-swift@main
with:
tag: ${{ matrix.tag }}
branch: ${{ matrix.branch }}
- uses: actions/checkout@v4
- run: swift test
command-line-tool:
strategy:
fail-fast: false
matrix:
macos:
- 13
xcode:
- latest-stable
runs-on: macos-${{ matrix.macos }}
steps:
- name: Select Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode }}
- name: Checkout
uses: actions/checkout@v4
- name: Build Command Line Tool
run: xcodebuild -project SwiftFormat.xcodeproj -scheme "SwiftFormat (Command Line Tool)" -sdk macosx clean build
swiftformat-for-xcode:
strategy:
fail-fast: false
matrix:
macos:
- 13
xcode:
- latest-stable
runs-on: macos-${{ matrix.macos }}
steps:
- name: Select Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode }}
- name: Checkout
uses: actions/checkout@v4
- name: Build Swift Format for Xcode app
run: xcodebuild -project SwiftFormat.xcodeproj -scheme "SwiftFormat for Xcode" -sdk macosx clean build
editor-extension:
strategy:
fail-fast: false
matrix:
macos:
- 13
xcode:
- latest-stable
runs-on: macos-${{ matrix.macos }}
steps:
- name: Select Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode }}
- name: Checkout
uses: actions/checkout@v4
- name: Build Editor Extension
run: xcodebuild -project SwiftFormat.xcodeproj -scheme "SwiftFormat (Editor Extension)" -sdk macosx clean build