-
Notifications
You must be signed in to change notification settings - Fork 1.1k
107 lines (97 loc) · 3.86 KB
/
ci.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
name: Build & Tests
on:
push:
branches: [ 2.x, master ]
pull_request:
branches: [ 2.x, master ]
jobs:
build:
strategy:
matrix:
xcode: ['xcode14.3.1', 'xcode15.2']
include:
- xcode: 'xcode15.2'
xcode-path: '/Applications/Xcode_15.2.app/Contents/Developer'
upload-dist: true
run-analyzer: true
macos: 'macos-13'
- xcode: 'xcode14.3.1'
xcode-path: '/Applications/Xcode_14.3.1.app/Contents/Developer'
upload-dist: false
run-analyzer: false
macos: 'macos-13'
name: Build and Test Sparkle
runs-on: ${{ matrix.macos }}
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Build Unit Tests
env:
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild build-for-testing -project Sparkle.xcodeproj -scheme Distribution -enableCodeCoverage YES -derivedDataPath build
- name: Run Unit Tests
env:
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild test-without-building -project Sparkle.xcodeproj -scheme Distribution -enableCodeCoverage YES -derivedDataPath build
- name: Build UI Tests
env:
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild build-for-testing -project Sparkle.xcodeproj -scheme UITests -configuration Debug -derivedDataPath build
- name: Run UI Tests
env:
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild test-without-building -project Sparkle.xcodeproj -scheme UITests -configuration Debug -derivedDataPath build
- name: Analyze Sparkle
if: ${{ matrix.run-analyzer && github.event_name == 'pull_request' }}
env:
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild analyze -project Sparkle.xcodeproj -quiet -scheme Sparkle -configuration Release -derivedDataPath analyze > anaylze_output.txt
- name: Find Analyzed Warnings
if: ${{ success() && matrix.run-analyzer && github.event_name == 'pull_request' }}
id: findwarnings
env:
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
if grep -q "warning:" anaylze_output.txt; then
echo '::set-output name=analyzestatus::0'
else
echo '::set-output name=analyzestatus::1'
fi
- name: Extract Analyzed Warnings
if: ${{ success() && matrix.run-analyzer && github.event_name == 'pull_request' && steps.findwarnings.outputs.analyzestatus == '0' }}
id: warnings
run: |
echo ::set-output name=content::$(cat anaylze_output.txt)
- name: Post Analyzed Warnings
if: ${{ success() && matrix.run-analyzer && github.event_name == 'pull_request' && steps.findwarnings.outputs.analyzestatus == '0' }}
uses: mshick/add-pr-comment@v2
with:
allow-repeats: false
message: "``` ${{ steps.warnings.outputs.content }} ```"
- name: Build Release Distribution
env:
DEVELOPER_DIR: ${{ matrix.xcode-path }}
run: |
xcodebuild build -project Sparkle.xcodeproj -scheme Distribution -configuration Release -derivedDataPath build
- name: Archive Test Results
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-logs
path: build/Logs
- name: Upload Distribution
if: ${{ success() && matrix.upload-dist }}
uses: actions/upload-artifact@v4
with:
name: Sparkle-distribution-${{ matrix.xcode }}.tar.xz
path: build/Build/Products/Release/sparkle-dist.tar.xz