forked from swiftyfinch/Rugby
-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (148 loc) · 4.8 KB
/
checks.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Checks
on:
workflow_dispatch:
pull_request:
push:
branches: [main]
paths-ignore: ['Docs/**', 'README.md']
jobs:
swiftformat:
name: SwiftFormat
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- run: swiftformat . --lint --quiet --reporter github-actions-log
swiftlint:
name: SwiftLint
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- run: swiftlint --strict --quiet --reporter github-actions-logging
install:
name: Install Script
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install Rugby
run: |
curl -Ls curl -Ls https://swiftyfinch.github.io/rugby/install.sh | bash
chmod +x ~/.rugby/clt/rugby && echo ~/.rugby/clt >> $GITHUB_PATH
- run: rugby -h
release:
name: Build Binary
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
restore-keys: ${{ runner.os }}-spm-
- name: Build
run: swift build -c release
tests:
name: Unit Tests
runs-on: macos-latest
env:
LCOV_PATH: .build/artifacts/info.lcov
BUILD_FOLDER: .build/debug/RugbyPackageTests.xctest/Contents/MacOS/RugbyPackageTests
PROFDATA_FOLDER: .build/debug/codecov/default.profdata
IGNORE_FILENAME_REGEX: .build|Tests
steps:
- uses: actions/checkout@v3
- run: brew install xcbeautify
- uses: actions/cache@v3
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
restore-keys: ${{ runner.os }}-spm-
- name: Test
run: set -o pipefail && swift test --enable-code-coverage 2>&1 | xcbeautify
- name: Prepare coverage to upload
run: |
xcrun llvm-cov export $BUILD_FOLDER \
-instr-profile $PROFDATA_FOLDER > $LCOV_PATH \
--ignore-filename-regex=$IGNORE_FILENAME_REGEX \
-format="lcov" \
--use-color
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Prepare binary artifact
run: |
RUGBY_PATH=`swift build --show-bin-path`/rugby
strip -rSTx $RUGBY_PATH
echo "RUGBY_PATH=$RUGBY_PATH" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3
with:
name: rugby
path: ${{ env.RUGBY_PATH }}
smoke-frameworks:
name: Smoke (Frameworks)
needs: tests
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with: { name: rugby }
- run: chmod +x rugby && echo `pwd` >> $GITHUB_PATH
- run: rugby --version
- uses: actions/cache@v3
with:
path: Example/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('Example/Podfile.lock') }}
restore-keys: ${{ runner.os }}-pods-
- name: CocoaPods
working-directory: ./Example
run: pod install --repo-update
- name: Rugby
working-directory: ./Example
run: rugby --prebuild --targets Pods-ExampleFrameworks --output multiline
- run: brew install xcbeautify
- name: XcodeBuild Test
working-directory: ./Example
run: |
set -o pipefail && env NSUnbufferedIO=YES xcodebuild test \
-workspace Example.xcworkspace \
-scheme ExampleFrameworks \
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 14' \
-derivedDataPath build \
COMPILER_INDEX_STORE_ENABLE=NO \
SWIFT_COMPILATION_MODE=wholemodule \
| xcbeautify
smoke-libs:
name: Smoke (Libraries)
needs: tests
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with: { name: rugby }
- run: chmod +x rugby && echo `pwd` >> $GITHUB_PATH
- run: rugby --version
- uses: actions/cache@v3
with:
path: Example/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('Example/Podfile.lock') }}
restore-keys: ${{ runner.os }}-pods-
- name: CocoaPods
working-directory: ./Example
run: pod install --repo-update
- name: Rugby
working-directory: ./Example
run: rugby --prebuild --targets Pods-ExampleLibs --output multiline
- run: brew install xcbeautify
- name: XcodeBuild Test
working-directory: ./Example
run: |
set -o pipefail && env NSUnbufferedIO=YES xcodebuild test \
-workspace Example.xcworkspace \
-scheme ExampleLibs \
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 14' \
-derivedDataPath build \
COMPILER_INDEX_STORE_ENABLE=NO \
SWIFT_COMPILATION_MODE=wholemodule \
| xcbeautify