Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Swift 6 support and switch to swift-testing #283

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: SwiftLint
uses: norio-nomura/[email protected]
with:
Expand Down
125 changes: 109 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,139 @@ on: [push, pull_request]
jobs:
mac-test:
name: Mac Test
runs-on: macOS-latest
runs-on: macos-latest
strategy:
matrix:
include:
- platform: macOS
scheme: "SWXMLHash OSX"
action: "build-for-testing test-without-building"

- platform: iOS
scheme: "SWXMLHash iOS"
action: "build-for-testing test-without-building"
sdk-and-dest: '-sdk iphonesimulator -destination "OS=17.2,name=iPhone 15"'

- platform: tvOS
scheme: "SWXMLHash tvOS"
sdk-and-dest: '-sdk appletvsimulator -destination "name=Apple TV"'

- platform: watchOS
scheme: "SWXMLHash watchOS"
action: "build-for-testing test-without-building"
sdk-and-dest: "-sdk watchsimulator"
steps:
- name: Checkout
uses: actions/checkout@master
- name: Build and test
uses: actions/checkout@v4

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "16.0"

- name: Build and Test
env:
WORKSPACE: "-workspace SWXMLHash.xcworkspace"
ACTION: "build-for-testing test-without-building"
run: |
set -o pipefail
xcodebuild $ACTION $WORKSPACE -scheme "SWXMLHash OSX" | xcpretty
xcodebuild $ACTION $WORKSPACE -scheme "SWXMLHash iOS" -sdk iphonesimulator -destination "OS=17.2,name=iPhone 15" | xcpretty
xcodebuild $ACTION $WORKSPACE -scheme "SWXMLHash tvOS" -sdk appletvsimulator -destination "name=Apple TV" | xcpretty
xcodebuild build $WORKSPACE -scheme "SWXMLHash watchOS" -sdk watchsimulator | xcpretty
bash <(curl -s https://codecov.io/bash) -t ${{secrets.CODECOV_TOKEN}}
xcodebuild ${{ matrix.action }} $WORKSPACE -scheme ${{ matrix.scheme }} ${{ matrix.sdk-and-dest }} | xcpretty

# TODO: I'd like to use this action instead of the above xcodebuild command, but I'm getting a destination error:
# xcodebuild: error: Unable to find a destination matching the provided destination specifier:
# { id:D918798E-6DEE-48F7-850A-A4C0D9328F0A }
#
# - uses: mxcl/[email protected]
# with:
# platform: ${{ matrix.platform }}
# workspace: "SWXMLHash.xcworkspace"

linux-test:
name: Linux Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- image: swift:5.8-focal
skip-testing: true

- image: swift:5.8-jammy
skip-testing: true

- image: swift:5.8-rhel-ubi9
skip-testing: true

- image: swift:5.9-focal
skip-testing: true

- image: swift:5.9-jammy
skip-testing: true

- image: swift:5.9-rhel-ubi9
skip-testing: true

- image: swift:5.10-focal
skip-testing: true

- image: swift:5.10-jammy
skip-testing: true

- image: swift:5.10-rhel-ubi9
skip-testing: true

- image: swift:6.0-focal
perform-testing: true

- image: swift:6.0-jammy
perform-testing: true

- image: swift:6.0-rhel-ubi9
perform-testing: true
container:
image: ${{ matrix.image }}
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v4
- name: Build
if: ${{ matrix.skip-testing }}
run: |
swift build
- name: Build and test
if: ${{ matrix.perform-testing }}
run: |
eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"
swift build --build-tests
swift test

windows-test:
name: Windows Test
runs-on: windows-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- branch: swift-5.10-release
tag: 5.10-RELEASE
skip-testing: true

- branch: swift-6.0-release
tag: 6.0-RELEASE
perform-testing: true

steps:
- name: Install Swift
uses: compnerd/gha-setup-swift@main
with:
branch: swift-5.8-release
tag: 5.8-RELEASE
branch: ${{ matrix.branch}}
tag: ${{ matrix.tag }}

- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v4
- name: Build
if: ${{ matrix.skip-testing }}
run: |
swift build
- name: Build and test
run: swift test
if: ${{ matrix.perform-testing }}
run: |
swift build --build-tests
swift test
1 change: 0 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ included:
- Tests
- ./Package.swift
opt_in_rules:
- anyobject_protocol
- array_init
- attributes
- closure_end_indentation
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v8.0.0 (September 17, 2024)

- Added Swift 6.0 support (via [#283](https://github.com/drmohundro/SWXMLHash/pull/283))
- The tests are now all using swift-testing
- Prior deprecations have been removed

## v7.0.2 (May 9, 2023)

- Added Windows support (via [#273](https://github.com/drmohundro/SWXMLHash/pull/273))
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM swift:5.1
FROM swiftlang/swift:nightly-6.0-focal

ENV APP_HOME ./app
RUN mkdir $APP_HOME
Expand Down
14 changes: 10 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.3
// swift-tools-version:6.0

//
// Package.swift
Expand Down Expand Up @@ -35,6 +35,9 @@ let package = Package(
targets: ["SWXMLHash"]
)
],
dependencies: [
.package(url: "https://github.com/apple/swift-testing.git", from: "0.10.0")
],
targets: [
.target(
name: "SWXMLHash",
Expand All @@ -43,11 +46,14 @@ let package = Package(
),
.testTarget(
name: "SWXMLHashTests",
dependencies: ["SWXMLHash"],
dependencies: [
"SWXMLHash",
.product(name: "Testing", package: "swift-testing")
],
exclude: ["Info.plist", "test.xml"]
)
],
swiftLanguageVersions: [
.v5
swiftLanguageModes: [
.v6
]
)
47 changes: 29 additions & 18 deletions Tests/LinuxMain.swift → [email protected]
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// swift-tools-version:5.10

//
// TypesConversionBasicTests.swift
// [email protected].swift
// SWXMLHash
//
// Copyright (c) 2016 Norio Nomura

// Copyright (c) 2024 David Mohundro
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,19 +25,29 @@
// THE SOFTWARE.
//

@testable import SWXMLHashTests
import XCTest
import PackageDescription

XCTMain([
testCase(LazyTypesConversionTests.allTests),
testCase(LazyWhiteSpaceParsingTests.allTests),
testCase(LazyXMLParsingTests.allTests),
testCase(MixedTextWithXMLElementsTests.allTests),
testCase(XMLHashConfigTests.allTests),
testCase(TypeConversionArrayOfNonPrimitiveTypesTests.allTests),
testCase(TypeConversionBasicTypesTests.allTests),
testCase(TypeConversionComplexTypesTests.allTests),
testCase(TypeConversionPrimitiveTypesTests.allTests),
testCase(WhiteSpaceParsingTests.allTests),
testCase(XMLParsingTests.allTests)
])
let package = Package(
name: "SWXMLHash",
products: [
.library(
name: "SWXMLHash",
targets: ["SWXMLHash"]
)
],
targets: [
.target(
name: "SWXMLHash",
path: "Source",
exclude: ["Info.plist"]
),
.testTarget(
name: "SWXMLHashTests",
dependencies: ["SWXMLHash"],
exclude: ["Info.plist", "test.xml"]
)
],
swiftLanguageVersions: [
.v5
]
)
14 changes: 9 additions & 5 deletions [email protected][email protected]
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// swift-tools-version:5.1
// swift-tools-version:5.8

//
// SWXMLHash.swift
// [email protected].swift
// SWXMLHash
//
// Copyright (c) 2014 David Mohundro
// Copyright (c) 2024 David Mohundro
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand All @@ -23,6 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

import PackageDescription

let package = Package(
Expand All @@ -36,11 +38,13 @@ let package = Package(
targets: [
.target(
name: "SWXMLHash",
path: "Source"
path: "Source",
exclude: ["Info.plist"]
),
.testTarget(
name: "SWXMLHashTests",
dependencies: ["SWXMLHash"]
dependencies: ["SWXMLHash"],
exclude: ["Info.plist", "test.xml"]
)
],
swiftLanguageVersions: [
Expand Down
16 changes: 10 additions & 6 deletions [email protected][email protected]
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// swift-tools-version:4.2
// swift-tools-version:5.9

//
// SWXMLHash.swift
// [email protected].swift
// SWXMLHash
//
// Copyright (c) 2014 David Mohundro
// Copyright (c) 2024 David Mohundro
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -38,12 +38,16 @@ let package = Package(
targets: [
.target(
name: "SWXMLHash",
path: "Source"
path: "Source",
exclude: ["Info.plist"]
),
.testTarget(
name: "SWXMLHashTests",
dependencies: ["SWXMLHash"]
dependencies: ["SWXMLHash"],
exclude: ["Info.plist", "test.xml"]
)
],
swiftLanguageVersions: [.v3, .v4, .v4_2]
swiftLanguageVersions: [
.v5
]
)
Loading