Repository navigation
75 lines (69 loc) · 2.46 KB
/
Copy pathxcodebuild.yml
File metadata and controls
75 lines (69 loc) · 2.46 KB
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
name: Xcode Build & Test
on:
pull_request:
branches: ["master", "develop"]
paths-ignore: ["docs/**", "**.md", "mkdocs.yml"]
push:
branches: ["master", "develop"]
paths-ignore: ["docs/**", "**.md", "mkdocs.yml"]
jobs:
build-test:
name: Build & Test AppBox
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
# Use latest-stable to avoid beta toolchains. A maintainer can pin an
# exact version here (e.g. '16.4') for full reproducibility.
xcode-version: latest-stable
- name: Cache Swift Package Manager dependencies
uses: actions/cache@v4
with:
path: |
~/Library/Caches/org.swift.swiftpm
~/Library/Developer/Xcode/DerivedData/**/SourcePackages
# Hash BOTH resolved files: the standalone `swift test` step resolves from
# AppBoxCore/Package.resolved, not the workspace one.
key: spm-${{ runner.os }}-${{ hashFiles('AppBox.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved', 'AppBoxCore/Package.resolved') }}
restore-keys: |
spm-${{ runner.os }}-
- name: Test AppBoxCore package
run: |
set -o pipefail
cd AppBoxCore
swift test 2>&1 | tee ../appboxcore-test.log
if [ ${PIPESTATUS[0]} -ne 0 ]; then
echo "::error::AppBoxCore package tests failed"
exit 1
fi
- name: Build & Test
run: |
set -o pipefail
xcodebuild test \
-project AppBox.xcodeproj \
-scheme AppBoxTests \
-testPlan AppBoxTests \
-destination 'platform=macOS' \
-resultBundlePath TestResults.xcresult \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO \
2>&1 | tee build.log
if [ ${PIPESTATUS[0]} -ne 0 ]; then
echo "::error::Build or tests failed"
exit 1
fi
- name: Report code coverage
if: always()
run: |
if [ -d TestResults.xcresult ]; then
xcrun xccov view --report TestResults.xcresult || true
fi
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: TestResults
path: TestResults.xcresult
if-no-files-found: ignore