-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (57 loc) · 1.99 KB
/
Copy pathspm-macos.yml
File metadata and controls
67 lines (57 loc) · 1.99 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
name: SPM macOS
on:
workflow_call:
env:
RUN_TESTS: true
jobs:
SPM-macOS:
name: macOS Xcode ${{ matrix.config.xcode }} [${{ matrix.build_config }}]
timeout-minutes: 30
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: true
matrix:
config: # newer versions at top
- { os: "macos-15", xcode: "16.0" }
- { os: "macos-14", xcode: "15.4" }
build_config:
- debug
- release
steps:
- uses: actions/checkout@v4
- name: Cache SPM dependencies
uses: actions/cache@v4
with:
path: |
~/Library/Caches/org.swift.swiftpm
~/Library/Developer/Xcode/DerivedData/**/SourcePackages
.build/artifacts
.build/checkouts
.build/repositories
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved', '**/*.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Select Xcode ${{ matrix.config.xcode }}
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.config.xcode }}.app
- name: Prepare
run: |
TARGET_TYPES=$(swift package describe --type json | jq '.targets[].type')
HAS_TESTS=$(echo $TARGET_TYPES | grep -q "test" && echo true || echo false)
echo "Package has tests: $HAS_TESTS"
echo "RUN_TESTS=$HAS_TESTS" >> $GITHUB_ENV
- name: Build
run: |
swift build -c ${{ matrix.build_config }}
- name: Test
if: env.RUN_TESTS == 'true'
run: |
swift test -c ${{ matrix.build_config }}
- name: Upload failure artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-${{ github.job }}-swift_${{ matrix.config.xcode }}-${{ matrix.build_config }}-${{ github.run_id }}
path: |
.build
if-no-files-found: warn
include-hidden-files: true