Skip to content
This repository was archived by the owner on Oct 17, 2021. It is now read-only.

Commit d347119

Browse files
authored
Update for Swift 5.3 (#10)
* Update CI workflow for Swift 5.3 * Update CI workflow for macOS Big Sur * Remove and ignore Package.resolved * Add Swift 5.2 package manifest * Update for Swift 5.3
1 parent 29cc6ab commit d347119

File tree

7 files changed

+99
-26
lines changed

7 files changed

+99
-26
lines changed

.github/workflows/ci.yml

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,79 @@ on:
77
branches: [master]
88

99
jobs:
10-
macos:
11-
runs-on: macOS-latest
10+
macos_big_sur:
11+
runs-on: macos-11.0
12+
13+
strategy:
14+
matrix:
15+
xcode:
16+
- "11.7" # Swift 5.2
17+
- "12.2" # Swift 5.3
18+
19+
name: "macOS Big Sur (Xcode ${{ matrix.xcode }})"
1220

1321
steps:
1422
- name: Checkout
1523
uses: actions/checkout@v1
24+
- uses: actions/cache@v2
25+
with:
26+
path: .build
27+
key: ${{ runner.os }}-spm-xcode-${{ matrix.xcode }}-${{ hashFiles('**/Package.resolved') }}
28+
restore-keys: |
29+
${{ runner.os }}-spm-xcode-${{ matrix.xcode }}-
1630
- name: Build and Test
17-
run: swift test
31+
run: |
32+
swift test
1833
env:
19-
DEVELOPER_DIR: /Applications/Xcode_11.4.app/Contents/Developer
34+
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
35+
36+
macos_catalina:
37+
runs-on: macos-10.15
38+
39+
strategy:
40+
matrix:
41+
xcode:
42+
- "11.7" # Swift 5.2
43+
- "12" # Swift 5.3
44+
45+
name: "macOS Catalina (Xcode ${{ matrix.xcode }})"
46+
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@v1
50+
- uses: actions/cache@v2
51+
with:
52+
path: .build
53+
key: ${{ runner.os }}-spm-xcode-${{ matrix.xcode }}-${{ hashFiles('**/Package.resolved') }}
54+
restore-keys: |
55+
${{ runner.os }}-spm-xcode-${{ matrix.xcode }}-
56+
- name: Build and Test
57+
run: |
58+
swift test
59+
env:
60+
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
2061

2162
linux:
2263
runs-on: ubuntu-latest
2364

65+
strategy:
66+
matrix:
67+
swift: ["5.3", "5.2"]
68+
69+
name: "Linux (Swift ${{ matrix.swift }})"
70+
2471
container:
25-
image: swift:5.2
72+
image: swift:${{ matrix.swift }}
2673

2774
steps:
2875
- name: Checkout
2976
uses: actions/checkout@v1
77+
- uses: actions/cache@v2
78+
with:
79+
path: .build
80+
key: ${{ runner.os }}-spm-swift-${{ matrix.swift }}-${{ hashFiles('**/Package.resolved') }}
81+
restore-keys: |
82+
${{ runner.os }}-spm-swift-${{ matrix.swift }}-
3083
- name: Build and Test
31-
run: swift test --enable-test-discovery
84+
run: |
85+
swift test --enable-test-discovery

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
/*.xcodeproj
55
.swiftpm/
66
xcuserdata/
7+
Package.resolved

Package.resolved

Lines changed: 0 additions & 16 deletions
This file was deleted.

Package.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.1
1+
// swift-tools-version:5.3
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
@@ -14,7 +14,9 @@ let package = Package(
1414
],
1515
dependencies: [
1616
// Dependencies declare other packages that this package depends on.
17-
.package(url: "https://github.com/apple/swift-syntax.git", .exact("0.50200.0")),
17+
.package(name: "SwiftSyntax",
18+
url: "https://github.com/apple/swift-syntax.git",
19+
.exact("0.50300.0")),
1820
],
1921
targets: [
2022
// Targets are the basic building blocks of a package. A target can define a module or a test suite.

[email protected]

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// swift-tools-version:5.1
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "SwiftSemantics",
8+
products: [
9+
// Products define the executables and libraries produced by a package, and make them visible to other packages.
10+
.library(
11+
name: "SwiftSemantics",
12+
targets: ["SwiftSemantics"]
13+
),
14+
],
15+
dependencies: [
16+
// Dependencies declare other packages that this package depends on.
17+
.package(url: "https://github.com/apple/swift-syntax.git",
18+
.exact("0.50200.0")),
19+
],
20+
targets: [
21+
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
22+
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
23+
.target(
24+
name: "SwiftSemantics",
25+
dependencies: ["SwiftSyntax"]
26+
),
27+
.testTarget(
28+
name: "SwiftSemanticsTests",
29+
dependencies: ["SwiftSemantics"]
30+
),
31+
]
32+
)

Tests/SwiftSemanticsTests/DeclarationCollectorTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class DeclarationCollectorTests: XCTestCase {
2121

2222
let collector = DeclarationCollector()
2323
let tree = try SyntaxParser.parse(source: source)
24-
_ = collector.walk(tree)
24+
collector.walk(tree)
2525

2626
XCTAssertEqual(collector.imports.count, 1)
2727
XCTAssertEqual(collector.imports.first?.pathComponents, ["UIKit"])

Tests/SwiftSemanticsTests/Extensions/SyntaxParser+Declarations.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extension SyntaxParser {
66
static func declarations<T: Declaration>(of type: T.Type, source: String) throws -> [T] {
77
let collector = DeclarationCollector()
88
let tree = try parse(source: source)
9-
_ = collector.walk(tree)
9+
collector.walk(tree)
1010

1111
switch type {
1212
case is AssociatedType.Type:

0 commit comments

Comments
 (0)