Skip to content

Commit

Permalink
Merge pull request #620 from 417-72KI/drop-swift-5.7
Browse files Browse the repository at this point in the history
Drop Swift 5.7
  • Loading branch information
f-meloni authored Sep 15, 2024
2 parents d99c795 + 172603d commit 1d085f6
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 49 deletions.
107 changes: 92 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,51 @@ concurrency:
cancel-in-progress: true

jobs:
test-on-macos-12:
name: Test on macOS 12
runs-on: macOS-12
test-on-macos-13:
name: Test on macOS 13
runs-on: macOS-13
strategy:
fail-fast: false
matrix:
xcode: ["13.2.1", "13.4.1", "14.1"]
xcode: ["14.3.1"]
steps:
- uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
.build/artifacts
.build/checkouts
.build/repositories
key: ${{ runner.os }}-dependencies-${{ matrix.xcode }}-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-dependencies-${{ matrix.xcode }}-${{ hashFiles('**/Package.resolved') }}
${{ runner.os }}-dependencies-${{ matrix.xcode }}-
- name: Select Xcode
run: |
xcodebuild -version
ls -nt /Applications/ | grep "Xcode*"
sudo xcode-select -switch /Applications/Xcode_${{ matrix.xcode }}.app
xcodebuild -version
- name: Install danger-js
run: brew install danger/tap/danger-js

- run: swift test

- run: swift run danger-swift ci --verbose --failOnErrors
if: ${{ github.event_name == 'pull_request' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test-on-macos-14:
name: Test on macOS 14
runs-on: macOS-14
strategy:
fail-fast: false
matrix:
xcode: ["15.2", "15.4"]
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -53,11 +91,11 @@ jobs:

test-dependencies-resolver:
name: Test dependencies resolver
runs-on: macOS-12
runs-on: macOS-14
strategy:
fail-fast: false
matrix:
xcode: ["13.2.1", "13.4.1", "14.1"]
xcode: ["15.2", "15.4"]
steps:
- uses: actions/checkout@v2

Expand All @@ -83,7 +121,7 @@ jobs:
- name: Install danger-js
run: brew install danger/tap/danger-js

- run: make install
- run: make install PREFIX='/opt/homebrew'

- run: mkdir DangerTestWithDependencies && mv DangerfileWithDependencies.swift DangerTestWithDependencies/Dangerfile.swift

Expand All @@ -94,11 +132,11 @@ jobs:

test-on-linux:
name: Test on Linux
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
swift: ["5.5.3", "5.6.3", "5.7"]
swift: ["5.8", "5.9", "5.10"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
Expand Down Expand Up @@ -131,13 +169,13 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test-without-spm-on-macos-12:
name: Test without SPM on macOS 12
runs-on: macOS-12
test-without-spm-on-macos-13:
name: Test without SPM on macOS 13
runs-on: macOS-13
strategy:
fail-fast: false
matrix:
xcode: ["13.2.1", "13.4.1", "14.1"]
xcode: ["14.3.1"]
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -170,13 +208,52 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test-without-spm-on-macos-14:
name: Test without SPM on macOS 14
runs-on: macOS-14
strategy:
fail-fast: false
matrix:
xcode: ["15.2", "15.4"]
steps:
- uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
.build/artifacts
.build/checkouts
.build/repositories
key: ${{ runner.os }}-without-spm-package-${{ matrix.xcode }}-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-without-spm-package-${{ matrix.xcode }}-${{ hashFiles('**/Package.resolved') }}
${{ runner.os }}-without-spm-package-${{ matrix.xcode }}-
- name: Select Xcode
run: |
xcodebuild -version
ls -nt /Applications/ | grep "Xcode*"
sudo xcode-select -switch /Applications/Xcode_${{ matrix.xcode }}.app
xcodebuild -version
- name: Install danger-js
run: brew install danger/tap/danger-js

- run: make install PREFIX='/opt/homebrew'

- run: danger-swift ci --verbose --failOnErrors
if: ${{ github.event_name == 'pull_request' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test-without-spm-on-linux:
name: Test without SPM on Linux
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
swift: ["5.5.3", "5.6.3", "5.7"]
swift: ["5.8", "5.9", "5.10"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
Expand Down
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.5
5.10
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

## Master

- Drop Swift 5.7 [@417-72KI][] - [#620](https://github.com/danger/swift/pull/620)
- Fix pattern for detecting SwiftLint in package [@417-72KI][] - [#616](https://github.com/danger/swift/pull/616)
- Allow optional GitLab MR description [@kvvzr][] - [#609](https://github.com/danger/swift/pull/609)

## 3.18.1
Expand Down
49 changes: 29 additions & 20 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
"version": "0.2.0"
}
},
{
"package": "CryptoSwift",
"repositoryURL": "https://github.com/krzyzanowskim/CryptoSwift.git",
"state": {
"branch": null,
"revision": "678d442c6f7828def400a70ae15968aef67ef52d",
"version": "1.8.3"
}
},
{
"package": "Komondor",
"repositoryURL": "https://github.com/shibapm/Komondor",
Expand All @@ -33,8 +42,8 @@
"repositoryURL": "https://github.com/nerdishbynature/octokit.swift",
"state": {
"branch": null,
"revision": "f762f1566f7cd0e683b9329f169c28ab6ef993cc",
"version": "0.12.0"
"revision": "44192458beb89180c3a3a1245d904aacac8be0ae",
"version": "0.13.0"
}
},
{
Expand All @@ -51,8 +60,8 @@
"repositoryURL": "https://github.com/nerdishbynature/RequestKit.git",
"state": {
"branch": null,
"revision": "8b0258ea2a4345cbcac90509b764faacea12efb0",
"version": "3.2.1"
"revision": "e4d905fed938807e36d87f28375f88b7c1c26840",
"version": "3.3.0"
}
},
{
Expand All @@ -78,8 +87,8 @@
"repositoryURL": "https://github.com/jpsim/SourceKitten.git",
"state": {
"branch": null,
"revision": "b6dc09ee51dfb0c66e042d2328c017483a1a5d56",
"version": "0.34.1"
"revision": "fd4df99170f5e9d7cf9aa8312aa8506e0e7a44e7",
"version": "0.35.0"
}
},
{
Expand All @@ -96,35 +105,35 @@
"repositoryURL": "https://github.com/pointfreeco/swift-snapshot-testing.git",
"state": {
"branch": null,
"revision": "f29e2014f6230cf7d5138fc899da51c7f513d467",
"version": "1.10.0"
"revision": "6d932a79e7173b275b96c600c86c603cf84f153c",
"version": "1.17.4"
}
},
{
"package": "SwiftSyntax",
"repositoryURL": "https://github.com/apple/swift-syntax.git",
"package": "swift-syntax",
"repositoryURL": "https://github.com/swiftlang/swift-syntax.git",
"state": {
"branch": null,
"revision": "013a48e2312e57b7b355db25bd3ea75282ebf274",
"version": "0.50900.0-swift-DEVELOPMENT-SNAPSHOT-2023-02-06-a"
"revision": "515f79b522918f83483068d99c68daeb5116342d",
"version": "600.0.0-prerelease-2024-08-14"
}
},
{
"package": "SwiftFormat",
"repositoryURL": "https://github.com/nicklockwood/SwiftFormat",
"state": {
"branch": null,
"revision": "7d3682f70f790805ecab81a685b711f6842f4698",
"version": "0.51.1"
"revision": "d6309f7440889427426143b4a0b100b959d3f3e6",
"version": "0.54.3"
}
},
{
"package": "SwiftLint",
"repositoryURL": "https://github.com/Realm/SwiftLint",
"state": {
"branch": null,
"revision": "eb85125a5f293de3d3248af259980c98bc2b1faa",
"version": "0.51.0"
"revision": "a24488f26e60247d8fff7bbb03d51910af3dc91c",
"version": "0.56.2"
}
},
{
Expand All @@ -150,8 +159,8 @@
"repositoryURL": "https://github.com/drmohundro/SWXMLHash.git",
"state": {
"branch": null,
"revision": "4d0f62f561458cbe1f732171e625f03195151b60",
"version": "7.0.1"
"revision": "a853604c9e9a83ad9954c7e3d2a565273982471f",
"version": "7.0.2"
}
},
{
Expand All @@ -168,8 +177,8 @@
"repositoryURL": "https://github.com/jpsim/Yams",
"state": {
"branch": null,
"revision": "f47ba4838c30dbd59998a4e4c87ab620ff959e8a",
"version": "5.0.5"
"revision": "3036ba9d69cf1fd04d433527bc339dc0dc75433d",
"version": "5.1.3"
}
}
]
Expand Down
25 changes: 16 additions & 9 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.5
// swift-tools-version:5.8

import PackageDescription

Expand All @@ -8,10 +8,10 @@ import PackageDescription
let isDevelop = true

let swiftLint: Package.Dependency = {
#if compiler(>=5.7)
return .package(url: "https://github.com/Realm/SwiftLint", from: "0.51.0")
#if compiler(>=5.9)
return .package(url: "https://github.com/Realm/SwiftLint", from: "0.56.0")
#else
return .package(url: "https://github.com/Realm/SwiftLint", .exact("0.48.0"))
return .package(url: "https://github.com/Realm/SwiftLint", exact: "0.53.0")
#endif
}()

Expand All @@ -22,10 +22,10 @@ let devProducts: [Product] = isDevelop
let devDependencies: [Package.Dependency] = isDevelop
? [
.package(url: "https://github.com/shibapm/Komondor", from: "1.1.4"),
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.50.5"),
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.54.0"),
swiftLint,
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing.git", from: "1.10.0"),
.package(url: "https://github.com/shibapm/Rocket", from: "1.2.1"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing.git", from: "1.17.0"),
.package(url: "https://github.com/shibapm/Rocket", from: "1.3.0"),
] : []
let devTargets: [Target] = isDevelop
? [
Expand Down Expand Up @@ -59,13 +59,20 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/shibapm/Logger", from: "0.1.0"),
.package(url: "https://github.com/mxcl/Version", from: "2.0.1"),
.package(name: "OctoKit", url: "https://github.com/nerdishbynature/octokit.swift", from: "0.12.0"),
.package(url: "https://github.com/nerdishbynature/octokit.swift", from: "0.13.0"),
] + devDependencies,
targets: [
.target(name: "Danger-Swift", dependencies: ["Danger"]),
.target(name: "DangerShellExecutor"),
.target(name: "DangerDependenciesResolver", dependencies: ["DangerShellExecutor", "Version", "Logger"]),
.target(name: "Danger", dependencies: ["OctoKit", "Logger", "DangerShellExecutor"]),
.target(
name: "Danger",
dependencies: [
.product(name: "OctoKit", package: "octokit.swift"),
"Logger",
"DangerShellExecutor"
]
),
.target(name: "RunnerLib", dependencies: ["Logger", "DangerShellExecutor", "Version"]),
.executableTarget(name: "Runner", dependencies: ["RunnerLib", "Logger", "DangerDependenciesResolver"]),
.target(name: "DangerFixtures", dependencies: ["Danger"]),
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ Write your Dangerfiles in Swift.

### Requirements

Latest version requires Swift 5.5
Latest version requires Swift 5.8

If you are using an older Swift, use the supported version according to next table.

| Swift version | Danger support version |
| ------------- | ---------------------- |
| 5.5-5.7 | v3.18.1 |
| 5.4 | v3.15.0 |
| 5.3 | v3.13.0 |
| 5.2 | v3.11.1 |
Expand Down
4 changes: 2 additions & 2 deletions Scripts/create_homebrew_tap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ echo " url \"https://github.com/danger/danger-swift/archive/#{version}.tar.gz\"
echo " sha256 \"${SHA}\"" >> danger-swift.rb
echo " head \"https://github.com/danger/danger-swift.git\"" >> danger-swift.rb
echo >> danger-swift.rb
echo " # Runs only on Xcode 12" >> danger-swift.rb
echo " depends_on :xcode => [\"12\", :build]" >> danger-swift.rb
echo " # Runs only on Xcode 14" >> danger-swift.rb
echo " depends_on :xcode => [\"14\", :build]" >> danger-swift.rb
echo " # Use the vendored danger" >> danger-swift.rb
echo " depends_on \"danger/tap/danger-js\"" >> danger-swift.rb
echo >> danger-swift.rb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ struct InlineDependenciesFinder {
.trimmingCharacters(in: .whitespaces)
.components(separatedBy: " " + config.majorVersionPrefix)

guard let url = URL(string: splittedImportString[0]) else {
let url: URL? = {
#if os(macOS) && compiler(>=5.9)
if #available(macOS 14.0, *) {
return URL(string: splittedImportString[0], encodingInvalidCharacters: false)
}
#endif
return URL(string: splittedImportString[0])
}()
guard let url = url else {
throw Errors.invalidInlineDependencyURL(splittedImportString[0])
}

Expand Down

0 comments on commit 1d085f6

Please sign in to comment.