-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (103 loc) · 3.4 KB
/
ci.yml
File metadata and controls
119 lines (103 loc) · 3.4 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
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
name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
strategy:
fail-fast: false
matrix:
include:
- name: "macOS Universal"
runner: macos-15
platform: "macOS"
xcode: "16.4"
arch: "universal"
comprehensive_test: true
lint_check: true
- name: "Linux x86_64"
runner: ubuntu-latest
platform: "Linux"
arch: "x86_64"
triple: "x86_64-unknown-linux-gnu"
comprehensive_test: true
lint_check: true
- name: "Linux ARM64"
runner: ubuntu-24.04-arm
platform: "Linux"
arch: "aarch64"
triple: "aarch64-unknown-linux-gnu"
comprehensive_test: true
lint_check: true
runs-on: ${{ matrix.runner }}
name: ${{ matrix.name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Xcode
if: matrix.platform == 'macOS'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode }}
- name: Setup Swift (Linux only)
if: matrix.platform == 'Linux'
run: |
# Check if Swift is already available
if command -v swift >/dev/null 2>&1; then
echo "Swift is already available:"
swift --version
else
echo "Installing Swift using Swiftly..."
# Install Swiftly
curl -L https://swift-server.github.io/swiftly/swiftly-install.sh | bash
# Add Swiftly to PATH for current session
export PATH="$HOME/.local/bin:$PATH"
echo "$HOME/.local/bin" >> $GITHUB_PATH
# Install latest Swift toolchain
swiftly install latest
swiftly use latest
echo "Swift installation completed:"
swift --version
fi
- name: Cache Swift Package Manager
uses: actions/cache@v4
with:
path: |
.build
~/.cache/org.swift.swiftpm
key: ${{ runner.os }}-${{ matrix.arch }}-spm-${{ hashFiles('Package.swift', 'Package.resolved') }}-ci
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-spm-
- name: Swift format lint (check only)
if: matrix.lint_check
run: |
if command -v swift-format >/dev/null 2>&1; then
swift-format lint --recursive Sources/ Plugins/
else
echo "swift-format not available, skipping lint check"
fi
- name: Build package
run: |
if [ "${{ matrix.platform }}" = "macOS" ] && [ "${{ matrix.arch }}" = "universal" ]; then
# Build universal binary for macOS
swift build --configuration release --arch arm64
swift build --configuration release --arch x86_64
elif [ "${{ matrix.platform }}" = "Linux" ]; then
swift build --configuration release --triple ${{ matrix.triple }} --static-swift-stdlib
else
swift build --configuration release
fi
- name: Run tests
if: matrix.comprehensive_test
run: swift test
- name: Smoke test CLI tools
if: matrix.comprehensive_test
run: |
# Basic smoke tests - just verify help works
swift run BuildEnvironmentExtractor --help
swift run GitInfoExtractor --help