Skip to content

armgit / xtool

Public Imported from GitHub
0

Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, macOS.

ci: enable warnings as errors (#248)

Kabir Oberai189654c23522
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 2c6bfb7..5b2c158 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -6,6 +6,8 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
+env:
+ XTL_CI: "1"
jobs:
build-linux:
strategy:
@@ -22,7 +24,7 @@ jobs:
uses: actions/checkout@v6
- name: Build and test
run: |
- docker compose run --build xtool bash -c \
+ docker compose run --build -e XTL_CI=1 xtool bash -c \
"swift build --product xtool && .build/debug/xtool --help && swift test"
build-macos:
runs-on: macos-26
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 0b11ced..a94fc30 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -3,6 +3,9 @@ on:
tags:
- "*"
+env:
+ XTL_CI: "1"
+
jobs:
build-linux:
strategy:
@@ -23,6 +26,7 @@ jobs:
run: |
docker compose run --build \
-e XTOOL_VERSION=${{ github.ref_name }} \
+ -e XTL_CI=1 \
--rm xtool Linux/build.sh
- name: Upload artifact
uses: actions/upload-artifact@v7
@@ -88,6 +92,8 @@ jobs:
id-token: write # for signing attestations and cache entries with GitHub OIDC
packages: write # to push built images to GitHub Container Registry
with:
+ build-args: |
+ XTL_CI=1
output: image
push: true
platforms: linux/amd64,linux/arm64
diff --git a/Dockerfile b/Dockerfile
index 6e9c71d..d498da1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -100,6 +100,8 @@ CMD [ "/bin/bash" ]
FROM build-xtool-base AS build-xtool
+ARG XTL_CI
+
ADD Package.swift Package.resolved /xtool/
RUN swift package resolve
diff --git a/Package.swift b/Package.swift
index 193a14a..dab231d 100644
--- a/Package.swift
+++ b/Package.swift
@@ -1,4 +1,4 @@
-// swift-tools-version:6.0
+// swift-tools-version:6.2
import PackageDescription
@@ -19,6 +19,14 @@ let cSettings: [CSetting] = [
.define("_GNU_SOURCE", .when(platforms: [.linux])),
]
+let swiftSettings: [SwiftSetting] = {
+ var settings: [SwiftSetting] = []
+ if Context.environment["XTL_CI"] == "1" {
+ settings.append(.treatAllWarnings(as: .error))
+ }
+ return settings
+}()
+
let package = Package(
name: "xtool",
platforms: [
@@ -90,7 +98,8 @@ let package = Package(
dependencies: [
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
],
- exclude: ["openapi-generator-config.yaml", "patch.js"]
+ exclude: ["openapi-generator-config.yaml", "patch.js"],
+ swiftSettings: swiftSettings,
),
// common utilities shared across xtool targets
.target(
@@ -102,7 +111,8 @@ let package = Package(
package: "swift-subprocess",
condition: .when(platforms: [.linux, .macOS])
),
- ]
+ ],
+ swiftSettings: swiftSettings,
),
.target(
name: "XKit",
@@ -141,14 +151,16 @@ let package = Package(
condition: .when(platforms: [.linux])
),
],
- cSettings: cSettings
+ cSettings: cSettings,
+ swiftSettings: swiftSettings,
),
.testTarget(
name: "XToolTests",
dependencies: [
"XKit",
"XToolSupport",
- ]
+ ],
+ swiftSettings: swiftSettings,
),
.target(
name: "XToolSupport",
@@ -162,7 +174,8 @@ let package = Package(
.product(name: "Version", package: "Version"),
.product(name: "libunxip", package: "unxip"),
],
- cSettings: cSettings
+ cSettings: cSettings,
+ swiftSettings: swiftSettings,
),
.target(
name: "PackLib",
@@ -170,7 +183,8 @@ let package = Package(
"XUtils",
.product(name: "Yams", package: "Yams"),
.product(name: "XcodeGenKit", package: "XcodeGen", condition: .when(platforms: [.macOS])),
- ]
+ ],
+ swiftSettings: swiftSettings,
),
.executableTarget(
name: "xtool",
@@ -179,7 +193,8 @@ let package = Package(
"XKit",
"XToolSupport",
],
- cSettings: cSettings
+ cSettings: cSettings,
+ swiftSettings: swiftSettings,
),
]
)
diff --git a/Sources/XKit/GrandSlam/Anisette/LocalAnisetteDataProviders.swift b/Sources/XKit/GrandSlam/Anisette/LocalAnisetteDataProviders.swift
index a8c0dc2..8df98cd 100644
--- a/Sources/XKit/GrandSlam/Anisette/LocalAnisetteDataProviders.swift
+++ b/Sources/XKit/GrandSlam/Anisette/LocalAnisetteDataProviders.swift
@@ -8,6 +8,8 @@
#if false
+// For reference: https://github.com/xtool-org/xtool/issues/196
+
import Foundation
/// Creates a socket connected to `ip` on `port`.
diff --git a/Sources/XToolSupport/DSCommands/DSTeamsCommand.swift b/Sources/XToolSupport/DSCommands/DSTeamsCommand.swift
index 4d2ae15..704d471 100644
--- a/Sources/XToolSupport/DSCommands/DSTeamsCommand.swift
+++ b/Sources/XToolSupport/DSCommands/DSTeamsCommand.swift
@@ -22,7 +22,7 @@ struct DSTeamsListCommand: AsyncParsableCommand {
func run() async throws {
let token = try AuthToken.saved()
- guard case let .xcode(authData) = try token.authData() else {
+ guard case let .xcode(authData) = token.authData() else {
throw Console.Error("This command requires password-based authentication")
}
let client = DeveloperServicesClient(authData: authData)
diff --git a/Sources/xtool/XTool.swift b/Sources/xtool/XTool.swift
index 2968919..6557740 100644
--- a/Sources/xtool/XTool.swift
+++ b/Sources/xtool/XTool.swift
@@ -8,7 +8,7 @@ import Dependencies
enum XToolMain {
static func main() async throws {
prepareDependencies { _ in
- #warning("Improve persistence mechanism")
+ // TODO: Improve persistence mechanism
// for Windows, we could use dpapi.h or wincred.h.
// for Linux, maybe use libsecret?
// see https://github.com/atom/node-keytar