From 3a7db2f35069af5f4445c919b28c7c5ad78d96f8 Mon Sep 17 00:00:00 2001 From: Mattt Date: Tue, 24 Nov 2020 03:57:21 -0800 Subject: [PATCH] Update to Swift 5.3 (#29) * Update swift-syntax dependency for Swift 5.3 * Update swift-argument-parser dependency to 0.3.1 * Update swift-log dependency to 1.4.0 * Update macOS platform target to 10.12 * Update to swift-tools-version:5.3 * Update CI workflow for macOS Big Sur and Swift 5.3 * Update Requirements section in README * Add changelog entry for #29 --- .github/workflows/ci.yml | 59 ++++++++++++++++++++++++++++---- Changelog.md | 5 +++ Package.resolved | 12 +++---- Package.swift | 45 ++++++++++++++++-------- README.md | 2 +- Sources/swift-doctest/main.swift | 10 +++--- 6 files changed, 100 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd0821a..3293166 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,26 +7,73 @@ on: branches: [master] jobs: - macos: - runs-on: macOS-latest + macos_big_sur: + runs-on: macos-11.0 + + strategy: + matrix: + xcode: + - "12.2" # Swift 5.3 + + name: "macOS Big Sur (Xcode ${{ matrix.xcode }})" steps: - name: Checkout uses: actions/checkout@v1 + - uses: actions/cache@v2 + with: + path: .build + key: ${{ runner.os }}-spm-xcode-${{ matrix.xcode }}-${{ hashFiles('**/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-spm-xcode-${{ matrix.xcode }}- - name: Build and Test - run: swift test + run: | + swift test env: - DEVELOPER_DIR: /Applications/Xcode_11.4.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer + + macos_catalina: + runs-on: macos-10.15 + + strategy: + matrix: + xcode: + - "12" # Swift 5.3 + + name: "macOS Catalina (Xcode ${{ matrix.xcode }})" + + steps: + - name: Checkout + uses: actions/checkout@v1 + - uses: actions/cache@v2 + with: + path: .build + key: ${{ runner.os }}-spm-xcode-${{ matrix.xcode }}-${{ hashFiles('**/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-spm-xcode-${{ matrix.xcode }}- + - name: Build and Test + run: | + swift test + env: + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer linux: runs-on: ubuntu-latest + strategy: + matrix: + swift: + - "5.3" + + name: "Linux (Swift ${{ matrix.swift }})" + container: - image: swift:5.2 + image: swift:${{ matrix.swift }} options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --security-opt apparmor=unconfined steps: - name: Checkout uses: actions/checkout@v1 - name: Build and Test - run: swift test --enable-test-discovery + run: | + swift test --enable-test-discovery diff --git a/Changelog.md b/Changelog.md index db799fa..3541bca 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Changed Swift version requirement to 5.3. + #29 by @mattt. + ## [0.1.0] - 2020-05-04 ### Added diff --git a/Package.resolved b/Package.resolved index 651ce0c..4078b0b 100644 --- a/Package.resolved +++ b/Package.resolved @@ -15,8 +15,8 @@ "repositoryURL": "https://github.com/apple/swift-argument-parser.git", "state": { "branch": null, - "revision": "9f04d1ff1afbccd02279338a2c91e5f27c45e93a", - "version": "0.0.5" + "revision": "92646c0cdbaca076c8d3d0207891785b3379cbff", + "version": "0.3.1" } }, { @@ -24,16 +24,16 @@ "repositoryURL": "https://github.com/apple/swift-log.git", "state": { "branch": null, - "revision": "74d7b91ceebc85daf387ebb206003f78813f71aa", - "version": "1.2.0" + "revision": "173f567a2dfec11d74588eea82cecea555bdc0bc", + "version": "1.4.0" } }, { "package": "SwiftSyntax", "repositoryURL": "https://github.com/apple/swift-syntax.git", "state": { - "branch": "0.50200.0", - "revision": "0688b9cfc4c3dd234e4f55f1f056b2affc849873", + "branch": "0.50300.0", + "revision": "844574d683f53d0737a9c6d706c3ef31ed2955eb", "version": null } }, diff --git a/Package.swift b/Package.swift index 1992882..5a5c24c 100644 --- a/Package.swift +++ b/Package.swift @@ -1,36 +1,53 @@ -// swift-tools-version:5.1 -// The swift-tools-version declares the minimum version of Swift required to build this package. +// swift-tools-version:5.3 import PackageDescription let package = Package( name: "DocTest", platforms: [ - .macOS(.v10_10) + .macOS(.v10_12) ], products: [ .executable(name: "swift-doctest", targets: ["swift-doctest"]), .library(name: "DocTest", targets: ["DocTest"]) ], dependencies: [ - // Dependencies declare other packages that this package depends on. - .package(url: "https://github.com/apple/swift-syntax.git", .revision("0.50200.0")), - .package(url: "https://github.com/apple/swift-argument-parser.git", .upToNextMinor(from: "0.0.4")), - .package(url: "https://github.com/SwiftDocOrg/TAP.git", .upToNextMinor(from: "0.1.1")), - .package(url: "https://github.com/SwiftDocOrg/StringLocationConverter.git", .upToNextMinor(from: "0.0.1")), - .package(url: "https://github.com/apple/swift-log.git", .upToNextMinor(from: "1.2.0")), + .package(name: "SwiftSyntax", + url: "https://github.com/apple/swift-syntax.git", + .revision("0.50300.0") + ), + .package(url: "https://github.com/apple/swift-argument-parser.git", + .upToNextMinor(from: "0.3.1") + ), + .package(url: "https://github.com/SwiftDocOrg/TAP.git", + .upToNextMinor(from: "0.1.1") + ), + .package(url: "https://github.com/SwiftDocOrg/StringLocationConverter.git", + .upToNextMinor(from: "0.0.1") + ), + .package(url: "https://github.com/apple/swift-log.git", + .upToNextMinor(from: "1.4.0") + ), ], targets: [ - // Targets are the basic building blocks of a package. A target can define a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "swift-doctest", - dependencies: ["DocTest", "StringLocationConverter", "ArgumentParser", "Logging"]), + dependencies: [ + .target(name: "DocTest"), + .product(name: "StringLocationConverter", package: "StringLocationConverter"), + .product(name: "ArgumentParser", package: "swift-argument-parser"), + .product(name: "Logging", package: "swift-log"), + ]), .target( name: "DocTest", - dependencies: ["SwiftSyntax", "TAP"]), + dependencies: [ + .product(name: "SwiftSyntax", package: "SwiftSyntax"), + .product(name: "TAP", package: "TAP"), + ]), .testTarget( name: "DocTestTests", - dependencies: ["DocTest"]), + dependencies: [ + .target(name: "DocTest"), + ]), ] ) diff --git a/README.md b/README.md index 22ddc8d..c3d9c41 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ just like a unit test. ## Requirements -- Swift 5.2 +- Swift 5.3 > **Note**: > When running `swift-doctest` from a Docker container, diff --git a/Sources/swift-doctest/main.swift b/Sources/swift-doctest/main.swift index 15dc8b0..f4e51d8 100644 --- a/Sources/swift-doctest/main.swift +++ b/Sources/swift-doctest/main.swift @@ -30,21 +30,19 @@ struct SwiftDocTest: ParsableCommand { var input: String @Option(name: [.customLong("swift-launch-path")], - default: REPL.Configuration.default.launchPath, help: "The path to the swift executable.") - var launchPath: String + var launchPath: String = REPL.Configuration.default.launchPath @Flag(name: [.customShort("p"), .customLong("package")], help: "Whether to run the REPL through Swift Package Manager (`swift run --repl`).") - var runThroughPackageManager: Bool + var runThroughPackageManager: Bool = false @Option(name: [.customLong("assumed-filename")], - default: "Untitled.swift", help: "The assumed filename to use for reporting when parsing from standard input.") - var assumedFilename: String + var assumedFilename: String = "Untitled.swift" @Flag(help: "Use verbose output") - var verbose: Bool + var verbose: Bool = false } static var configuration = CommandConfiguration(