Skip to content

Commit

Permalink
swift: bootstrap Swift Package library (#252)
Browse files Browse the repository at this point in the history
- Define Swift Package repository
- Define Xcode project
- Define GitHub Actions workflow
  • Loading branch information
pylapp authored Dec 18, 2024
2 parents 77c3f70 + fa17422 commit ebd74ea
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Swift ITSClient

on:
push:
branches:
- main
- develop
- 'swift-*'

pull_request:
types:
- opened
- synchronize
- reopened

jobs:
build:
runs-on: macos-15
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Xcode 16
run: |
sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
- name: Build
run: |
cd swift/ITSClient
swift build
test:
runs-on: macos-15
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Xcode 16
run: |
sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
- name: Build
run: |
cd swift/ITSClient
swift test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ python/**/monitoring.csv
python/**/reception.txt
python/**/sending.txt

# macOS
.DS_Store

# Custom
.idea
*.iml
8 changes: 8 additions & 0 deletions swift/ITSClient/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
28 changes: 28 additions & 0 deletions swift/ITSClient/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "ITSClient",
platforms: [
.macOS(.v13),
.iOS(.v16)
],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "ITSClient",
targets: ["ITSClient"]),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "ITSClient"),
.testTarget(
name: "ITSClientTests",
dependencies: ["ITSClient"]
),
]
)
10 changes: 10 additions & 0 deletions swift/ITSClient/Sources/ITSClient/ITSClient.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Software Name : ITSClient
* SPDX-FileCopyrightText: Copyright (c) Orange SA
* SPDX-License-Identifier: MIT
*
* This software is distributed under the MIT license,
* see the "LICENSE.txt" file for more details or https://opensource.org/license/MIT/
*
* Software description: Swift ITS client.
*/
17 changes: 17 additions & 0 deletions swift/ITSClient/Tests/ITSClientTests/ITSClientTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Software Name : ITSClient
* SPDX-FileCopyrightText: Copyright (c) Orange SA
* SPDX-License-Identifier: MIT
*
* This software is distributed under the MIT license,
* see the "LICENSE.txt" file for more details or https://opensource.org/license/MIT/
*
* Software description: Swift ITS client.
*/

import Testing
@testable import ITSClient

@Test func example() async throws {
// Write your test here and use APIs like `#expect(...)` to check expected conditions.
}

0 comments on commit ebd74ea

Please sign in to comment.