Skip to content

Commit cdda6d0

Browse files
RISCfutureclaude
andcommitted
Simplify CI matrix and add Linux CI support
Standardize the CI matrix (Category A: macOS 26 + Swift 6.2). Add Linux CI with build and test support. Guard CoreLocation usage behind #if canImport(CoreLocation) across 18 source and test files. Guard String(localized:bundle:.module) behind #if canImport(Darwin) with plain string fallbacks. Move E2E executable target behind #if os(macOS) so swift test works on Linux. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 45a9e07 commit cdda6d0

22 files changed

Lines changed: 389 additions & 213 deletions

.github/workflows/ci.yml

Lines changed: 47 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
name: Build and Test
1+
# CI Matrix Policy
2+
#
3+
# Category A (tools-version 6.2 + macOS 26 min): macos-26 + Swift 6.2
4+
# Category B (tools-version 6.2 + older macOS): macos-15 + 6.2, macos-26 + 6.2
5+
# Category C (tools-version 6.0): macos-15 + 6.0, macos-15 + 6.2, macos-26 + 6.2
6+
# Linux (if viable): ubuntu + Swift 6.0, ubuntu + Swift 6.2
7+
#
8+
# When Swift 6.3 ships: bump 6.0→6.1 and 6.2→6.3 in Category C
9+
# When bumping tools-version to 6.2: drop 6.0/6.1, move to Category A or B
10+
11+
name: CI
212

313
on:
414
push:
@@ -7,53 +17,55 @@ on:
717
branches: [main]
818

919
concurrency:
10-
group: ${{ github.workflow }}-${{ github.ref }}
20+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1121
cancel-in-progress: true
1222

1323
jobs:
14-
build-test:
24+
tests:
1525
name: Build and Test
16-
runs-on: macos-26
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
include:
30+
- os: macos-26
31+
swift: "6.2"
32+
runs-on: ${{ matrix.os }}
1733
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v4
20-
21-
- name: Setup Swift
22-
uses: swift-actions/setup-swift@v2
34+
- uses: actions/checkout@v4
35+
- uses: SwiftyLab/setup-swift@latest
2336
with:
24-
swift-version: '6.2'
25-
37+
swift-version: ${{ matrix.swift }}
2638
- name: Build
2739
run: swift build -v
28-
29-
- name: Run Tests
40+
- name: Test
3041
run: swift test -v
31-
32-
swiftlint:
33-
name: SwiftLint
42+
test-linux:
43+
name: Test on Linux
3444
runs-on: ubuntu-latest
45+
container:
46+
image: swift:6.2
3547
steps:
36-
- name: Checkout
37-
uses: actions/checkout@v4
38-
39-
- name: SwiftLint
40-
uses: norio-nomura/action-swiftlint@3.2.1
41-
48+
- uses: actions/checkout@v4
49+
- name: Build
50+
run: swift build -v
51+
- name: Test
52+
run: swift test -v
53+
lint:
54+
name: Run Swiftlint
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
- uses: norio-nomura/action-swiftlint@3.2.1
4259
swift-format:
43-
name: swift-format
60+
name: Run swift-format
4461
runs-on: ubuntu-latest
4562
container:
46-
image: swift:6.2
63+
image: swift:latest
4764
steps:
48-
- name: Checkout
49-
uses: actions/checkout@v4
50-
51-
- name: Install swift-format
65+
- uses: actions/checkout@v4
66+
- name: Download .swift-format config
5267
run: |
53-
git clone --branch 600.0.0 --depth 1 https://github.com/swiftlang/swift-format.git /tmp/swift-format
54-
cd /tmp/swift-format
55-
swift build -c release
56-
cp /tmp/swift-format/.build/release/swift-format /usr/local/bin/
57-
58-
- name: Run swift-format
59-
run: swift-format lint -r .
68+
apt-get update && apt-get install -y wget
69+
wget -O .swift-format https://gist.githubusercontent.com/RISCfuture/e0c21afb7bd80a88d128a42bf40d2ecd/raw/.swift-format
70+
- name: Run swift-format lint
71+
run: swift format lint -r .

.github/workflows/doc.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name: Documentation
1+
name: Deploy Documentation
22

33
on:
44
push:
55
branches: [main]
6+
workflow_dispatch:
67

78
permissions:
89
contents: read
@@ -18,14 +19,10 @@ jobs:
1819
name: Build Documentation
1920
runs-on: macos-26
2021
steps:
21-
- name: Checkout
22-
uses: actions/checkout@v4
23-
24-
- name: Setup Swift
25-
uses: swift-actions/setup-swift@v2
22+
- uses: actions/checkout@v4
23+
- uses: SwiftyLab/setup-swift@latest
2624
with:
27-
swift-version: '6.2'
28-
25+
swift-version: "6.2"
2926
- name: Build Documentation
3027
run: |
3128
swift package --allow-writing-to-directory docs \
@@ -34,11 +31,9 @@ jobs:
3431
--transform-for-static-hosting \
3532
--hosting-base-path SwiftCIFP \
3633
--output-path docs
37-
3834
- name: Create Redirect
3935
run: |
4036
echo '<html><head><meta http-equiv="refresh" content="0; url=/SwiftCIFP/documentation/swiftcifp/"></head></html>' > docs/index.html
41-
4237
- name: Upload Pages Artifact
4338
uses: actions/upload-pages-artifact@v3
4439
with:

Package.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,20 @@ let package = Package(
2828
name: "SwiftCIFPTests",
2929
dependencies: ["SwiftCIFP"]
3030
),
31+
],
32+
swiftLanguageModes: [.v5, .v6]
33+
)
34+
35+
#if os(macOS)
36+
package.targets.append(
3137
.executableTarget(
3238
name: "SwiftCIFP_E2E",
3339
dependencies: [
3440
"SwiftCIFP",
3541
.product(name: "ArgumentParser", package: "swift-argument-parser"),
3642
.product(name: "ZIPFoundation", package: "ZIPFoundation"),
37-
.product(name: "Progress", package: "Progress.swift")
43+
.product(name: "Progress", package: "Progress.swift"),
3844
]
3945
)
40-
],
41-
swiftLanguageModes: [.v5, .v6]
42-
)
46+
)
47+
#endif

Sources/SwiftCIFP/CIFP.swift

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
import CoreLocation
21
import Foundation
2+
3+
#if canImport(CoreLocation)
4+
import CoreLocation
5+
#endif
36
@preconcurrency import RegexBuilder
47

58
/// Container for CIFP (Coded Instrument Flight Procedures) data.
@@ -290,15 +293,17 @@ public struct CIFP: Sendable, Codable {
290293
airports[id]
291294
}
292295

293-
/// Returns the GridMORA containing the given coordinate, if available.
294-
///
295-
/// - Parameter coordinate: The coordinate to look up.
296-
/// - Returns: The GridMORA for the grid square containing the coordinate, or `nil` if not available.
297-
public func gridMORA(at coordinate: CLLocationCoordinate2D) -> GridMORA? {
298-
let latDeg = Int(floor(coordinate.latitude))
299-
let lonDeg = Int(floor(coordinate.longitude))
300-
return gridMORA(latitudeDeg: latDeg, longitudeDeg: lonDeg)
301-
}
296+
#if canImport(CoreLocation)
297+
/// Returns the GridMORA containing the given coordinate, if available.
298+
///
299+
/// - Parameter coordinate: The coordinate to look up.
300+
/// - Returns: The GridMORA for the grid square containing the coordinate, or `nil` if not available.
301+
public func gridMORA(at coordinate: CLLocationCoordinate2D) -> GridMORA? {
302+
let latDeg = Int(floor(coordinate.latitude))
303+
let lonDeg = Int(floor(coordinate.longitude))
304+
return gridMORA(latitudeDeg: latDeg, longitudeDeg: lonDeg)
305+
}
306+
#endif
302307

303308
/// Returns the GridMORA for the given grid square, if available.
304309
///

Sources/SwiftCIFP/CIFPData.swift

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
import CoreLocation
21
import Foundation
32

3+
#if canImport(CoreLocation)
4+
import CoreLocation
5+
#endif
6+
47
/// Central data container actor that enables model linking.
58
///
69
/// `CIFPData` holds all CIFP collections and establishes weak references
@@ -367,15 +370,17 @@ public actor CIFPData {
367370
heliports[id]
368371
}
369372

370-
/// Returns the GridMORA containing the given coordinate, if available.
371-
///
372-
/// - Parameter coordinate: The coordinate to look up.
373-
/// - Returns: The GridMORA for the grid square containing the coordinate, or `nil` if not available.
374-
public func gridMORA(at coordinate: CLLocationCoordinate2D) -> GridMORA? {
375-
let latDeg = Int(floor(coordinate.latitude))
376-
let lonDeg = Int(floor(coordinate.longitude))
377-
return gridMORA(latitudeDeg: latDeg, longitudeDeg: lonDeg)
378-
}
373+
#if canImport(CoreLocation)
374+
/// Returns the GridMORA containing the given coordinate, if available.
375+
///
376+
/// - Parameter coordinate: The coordinate to look up.
377+
/// - Returns: The GridMORA for the grid square containing the coordinate, or `nil` if not available.
378+
public func gridMORA(at coordinate: CLLocationCoordinate2D) -> GridMORA? {
379+
let latDeg = Int(floor(coordinate.latitude))
380+
let lonDeg = Int(floor(coordinate.longitude))
381+
return gridMORA(latitudeDeg: latDeg, longitudeDeg: lonDeg)
382+
}
383+
#endif
379384

380385
/// Returns the GridMORA for the given grid square, if available.
381386
///

Sources/SwiftCIFP/Models/Airport/Airport.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import CoreLocation
21
import Foundation
32

43
/// Airport reference record.

Sources/SwiftCIFP/Models/Airport/LocalizerGlideSlope.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import CoreLocation
21
import Foundation
32

43
/// Localizer/Glide Slope record.

Sources/SwiftCIFP/Models/Airport/PathPoint.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import CoreLocation
21
import Foundation
32

43
/// Path point type.

Sources/SwiftCIFP/Models/Airport/Runway.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import CoreLocation
21
import Foundation
32

43
/// Runway record.

Sources/SwiftCIFP/Models/Airport/TerminalNavaid.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import CoreLocation
21
import Foundation
32

43
/// Terminal Navaid record.

0 commit comments

Comments
 (0)