Skip to content

Commit

Permalink
Add Linux support
Browse files Browse the repository at this point in the history
  • Loading branch information
dfed committed Jan 10, 2024
1 parent 209f319 commit 6e0e67f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: macos-13
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_15.0.1.app/Contents/Developer
- name: Build and Test Framework
Expand All @@ -28,7 +28,7 @@ jobs:
runs-on: macos-13
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_15.0.1.app/Contents/Developer
- name: Build Package Integration
Expand All @@ -39,17 +39,30 @@ jobs:
runs-on: macos-13
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Select Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_15.0.1.app/Contents/Developer
- name: Build Project Integration
run: pushd Examples/ExampleProjectIntegration; xcrun xcodebuild build -skipPackagePluginValidation -skipMacroValidation -scheme ExampleProjectIntegration; popd

linux:
name: "Build and Test on Linux"
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Swift Environment
uses: swift-actions/setup-swift@v1
with:
swift-version: 5.9
- name: Build and Test Framework
run: swift test -c release -Xswiftc -enable-testing

readme-validation:
name: Check Markdown links
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Validate Markdown
uses: gaurav-nelson/github-action-markdown-link-check@v1
8 changes: 2 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,13 @@ let package = Package(
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftParser", package: "swift-syntax"),
.byNameItem(name: "ZippyJSON", condition: .when(platforms: [.iOS, .tvOS, .macOS])),
"SafeDICore",
"ZippyJSON",
]
),
.testTarget(
name: "SafeDIToolTests",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser"),
"SafeDITool",
"ZippyJSON",
]
dependencies: ["SafeDITool"]
),

// Core
Expand Down
6 changes: 6 additions & 0 deletions Sources/SafeDITool/SafeDITool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import ArgumentParser
import Foundation
import SafeDICore
import SwiftParser
#if canImport(ZippyJSON)
import ZippyJSON
#endif

@main
struct SafeDITool: AsyncParsableCommand {
Expand Down Expand Up @@ -173,7 +175,11 @@ struct SafeDITool: AsyncParsableCommand {
of: ModuleInfo.self,
returning: [ModuleInfo].self
) { taskGroup in
#if canImport(ZippyJSON)
let decoder = ZippyJSONDecoder()
#else
let decoder = JSONDecoder()
#endif
for moduleInfoURL in moduleInfoURLs {
taskGroup.addTask {
try decoder.decode(
Expand Down

0 comments on commit 6e0e67f

Please sign in to comment.