Skip to content

Commit de5fc7a

Browse files
RISCfutureclaude
andcommitted
Simplify CI matrix
Standardize the CI matrix around a category-based strategy (Category C: macOS 15 + Swift 6.0, macOS 15 + Swift 6.2, macOS 26 + Swift 6.2). Guard String(localized:comment:) calls behind #if canImport(Darwin) with plain string fallbacks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d460e86 commit de5fc7a

3 files changed

Lines changed: 97 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
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+
111
name: CI
212

313
on:
@@ -17,14 +27,12 @@ jobs:
1727
fail-fast: false
1828
matrix:
1929
include:
20-
- os: macos-14
21-
swift: "6.0"
22-
- os: macos-14
23-
swift: "6.1"
2430
- os: macos-15
25-
swift: "6.1"
31+
swift: "6.0"
2632
- os: macos-15
2733
swift: "6.2"
34+
- os: macos-26
35+
swift: "6.2"
2836
runs-on: ${{ matrix.os }}
2937
steps:
3038
- uses: actions/checkout@v4
@@ -48,15 +56,9 @@ jobs:
4856
image: swift:latest
4957
steps:
5058
- uses: actions/checkout@v4
51-
- name: Install dependencies
52-
run: apt-get update && apt-get install -y wget
5359
- name: Download .swift-format config
54-
run: wget -O .swift-format https://gist.githubusercontent.com/RISCfuture/e0c21afb7bd80a88d128a42bf40d2ecd/raw/.swift-format
55-
- name: Install swift-format
5660
run: |
57-
git clone https://github.com/swiftlang/swift-format.git
58-
cd swift-format
59-
swift build -c release
60-
cp .build/release/swift-format /usr/local/bin/
61+
apt-get update && apt-get install -y wget
62+
wget -O .swift-format https://gist.githubusercontent.com/RISCfuture/e0c21afb7bd80a88d128a42bf40d2ecd/raw/.swift-format
6163
- name: Run swift-format lint
62-
run: swift-format lint -r .
64+
run: swift format lint -r .

.github/workflows/doc.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
21
name: Deploy Documentation
32

43
on:
54
push:
65
branches: [main]
6+
workflow_dispatch:
77

8-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
98
permissions:
109
contents: read
1110
pages: write
1211
id-token: write
1312

14-
# Allow one concurrent deployment
1513
concurrency:
1614
group: pages
1715
cancel-in-progress: true
1816

1917
jobs:
20-
# Build job
2118
build:
2219
name: Generate Documentation
2320
runs-on: macos-latest
@@ -60,7 +57,6 @@ jobs:
6057
with:
6158
path: "docs/"
6259

63-
# Deployment job
6460
deploy:
6561
environment:
6662
name: github-pages

Sources/SwiftMETAR/Error.swift

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,85 +56,165 @@ extension Error: LocalizedError {
5656
public var errorDescription: String? {
5757
switch self {
5858
case .invalidWindsAloftHeader, .invalidWindsAloftGroup, .invalidWindsAloftColumns:
59+
#if canImport(Darwin)
5960
return String(
6061
localized: "Couldn’t parse Winds Aloft product.",
6162
comment: "error description"
6263
)
64+
#else
65+
return "Couldn’t parse Winds Aloft product."
66+
#endif
6367
default:
68+
#if canImport(Darwin)
6469
return String(localized: "Couldn’t parse METAR or TAF.", comment: "error description")
70+
#else
71+
return "Couldn’t parse METAR or TAF."
72+
#endif
6573
}
6674
}
6775

6876
public var failureReason: String? {
6977
switch self {
7078
case .badFormat:
79+
#if canImport(Darwin)
7180
return String(localized: "METAR or TAF format is incorrect.", comment: "failure reason")
81+
#else
82+
return "METAR or TAF format is incorrect."
83+
#endif
7284
case .invalidDate(let date):
85+
#if canImport(Darwin)
7386
return String(localized: "Invalid date ‘\(date)’.", comment: "failure reason")
87+
#else
88+
return "Invalid date ‘\(date)’."
89+
#endif
7490
case .invalidWinds(let winds):
91+
#if canImport(Darwin)
7592
return String(localized: "Invalid winds ‘\(winds)’.", comment: "failure reason")
93+
#else
94+
return "Invalid winds ‘\(winds)’."
95+
#endif
7696
case .invalidVisibility(let visibility):
97+
#if canImport(Darwin)
7798
return String(localized: "Invalid visibility ‘\(visibility)’.", comment: "failure reason")
99+
#else
100+
return "Invalid visibility ‘\(visibility)’."
101+
#endif
78102
case .invalidWeather(let weather):
103+
#if canImport(Darwin)
79104
return String(localized: "Invalid weather ‘\(weather)’.", comment: "failure reason")
105+
#else
106+
return "Invalid weather ‘\(weather)’."
107+
#endif
80108
case .invalidConditions(let conditions):
109+
#if canImport(Darwin)
81110
return String(localized: "Invalid conditions ‘\(conditions)’.", comment: "failure reason")
111+
#else
112+
return "Invalid conditions ‘\(conditions)’."
113+
#endif
82114
case .invalidTempDewpoint(let temps):
115+
#if canImport(Darwin)
83116
return String(
84117
localized: "Invalid temperature and dewpoint ‘\(temps)’.",
85118
comment: "failure reason"
86119
)
120+
#else
121+
return "Invalid temperature and dewpoint ‘\(temps)’."
122+
#endif
87123
case .invalidAltimeter(let altimeter):
124+
#if canImport(Darwin)
88125
return String(
89126
localized: "Invalid altimeter setting ‘\(altimeter)’.",
90127
comment: "failure reason"
91128
)
129+
#else
130+
return "Invalid altimeter setting ‘\(altimeter)’."
131+
#endif
92132
case .invalidPeriod(let period):
133+
#if canImport(Darwin)
93134
return String(localized: "Invalid TAF period ‘\(period)’.", comment: "failure reason")
135+
#else
136+
return "Invalid TAF period ‘\(period)’."
137+
#endif
94138
case .invalidWindshear(let windshear):
139+
#if canImport(Darwin)
95140
return String(
96141
localized: "Invalid low-level windshear ‘\(windshear)’.",
97142
comment: "failure reason"
98143
)
144+
#else
145+
return "Invalid low-level windshear ‘\(windshear)’."
146+
#endif
99147
case .invalidIcing(let icing):
148+
#if canImport(Darwin)
100149
return String(localized: "Invalid icing ‘\(icing)", comment: "failure reason")
150+
#else
151+
return "Invalid icing ‘\(icing)"
152+
#endif
101153
case .invalidTurbulence(let turbulence):
154+
#if canImport(Darwin)
102155
return String(localized: "Invalid turbulence ‘\(turbulence)", comment: "failure reason")
156+
#else
157+
return "Invalid turbulence ‘\(turbulence)"
158+
#endif
103159
case .invalidForecastTemperature(let temp):
160+
#if canImport(Darwin)
104161
return String(
105162
localized: "Invalid forecast temperature '\(temp)'",
106163
comment: "failure reason"
107164
)
165+
#else
166+
return "Invalid forecast temperature '\(temp)'"
167+
#endif
108168
case .invalidWindsAloftHeader(let header):
169+
#if canImport(Darwin)
109170
return String(
110171
localized: "Invalid winds aloft header '\(header)'.",
111172
comment: "failure reason"
112173
)
174+
#else
175+
return "Invalid winds aloft header '\(header)'."
176+
#endif
113177
case .invalidWindsAloftGroup(let group):
178+
#if canImport(Darwin)
114179
return String(
115180
localized: "Invalid winds aloft data group '\(group)'.",
116181
comment: "failure reason"
117182
)
183+
#else
184+
return "Invalid winds aloft data group '\(group)'."
185+
#endif
118186
case .invalidWindsAloftColumns(let columns):
187+
#if canImport(Darwin)
119188
return String(
120189
localized: "Invalid winds aloft column layout '\(columns)'.",
121190
comment: "failure reason"
122191
)
192+
#else
193+
return "Invalid winds aloft column layout '\(columns)'."
194+
#endif
123195
}
124196
}
125197

126198
public var recoverySuggestion: String? {
127199
switch self {
128200
case .invalidWindsAloftHeader, .invalidWindsAloftGroup, .invalidWindsAloftColumns:
201+
#if canImport(Darwin)
129202
return String(
130203
localized: "Verify the format of the Winds Aloft product.",
131204
comment: "recovery suggestion"
132205
)
206+
#else
207+
return "Verify the format of the Winds Aloft product."
208+
#endif
133209
default:
210+
#if canImport(Darwin)
134211
return String(
135212
localized: "Verify the format of the METAR or TAF string.",
136213
comment: "recovery suggestion"
137214
)
215+
#else
216+
return "Verify the format of the METAR or TAF string."
217+
#endif
138218
}
139219
}
140220
}

0 commit comments

Comments
 (0)