Skip to content

Commit d45c580

Browse files
committed
Fix CI and code with swift-syntax 6.1
1 parent 5cc0e7b commit d45c580

File tree

5 files changed

+211
-135
lines changed

5 files changed

+211
-135
lines changed

.github/workflows/ci.yml

Lines changed: 121 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -17,144 +17,144 @@ concurrency:
1717
cancel-in-progress: true
1818

1919
jobs:
20-
# macos:
21-
# name: macOS - ${{ matrix.package }} (Xcode ${{ matrix.xcode }})
22-
# runs-on: ${{ matrix.os }}
23-
# strategy:
24-
# matrix:
25-
# include:
26-
# - os: macos-15
27-
# xcode: '16.2'
28-
# package: 'main'
29-
# - os: macos-15
30-
# xcode: '16.2'
31-
# package: 'Examples'
32-
# - os: macos-14
33-
# xcode: '15.4'
34-
# package: 'main'
35-
# - os: macos-14
36-
# xcode: '15.4'
37-
# package: 'Examples'
38-
# steps:
39-
# - name: Checkout repository
40-
# uses: actions/checkout@v4
41-
#
42-
# - name: Select Xcode ${{ matrix.xcode }}
43-
# run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
44-
#
45-
# - name: Print Swift version
46-
# run: swift --version
47-
#
48-
# # Set working directory to Examples if testing the examples package
49-
# - name: Set working directory
50-
# run: |
51-
# if [ "${{ matrix.package }}" = "Examples" ]; then
52-
# cd Examples
53-
# fi
54-
#
55-
# - name: Build package
56-
# run: swift build
57-
#
58-
# - name: Run tests
59-
# run: swift test
60-
#
61-
# linux:
62-
# name: Ubuntu - ${{ matrix.package }} (Swift ${{ matrix.swift }})
63-
# runs-on: ubuntu-latest
20+
macos:
21+
name: macOS - ${{ matrix.package }} (Xcode ${{ matrix.xcode }})
22+
runs-on: ${{ matrix.os }}
23+
strategy:
24+
matrix:
25+
include:
26+
- os: macos-15
27+
xcode: '16.2'
28+
package: 'main'
29+
- os: macos-15
30+
xcode: '16.2'
31+
package: 'Examples'
32+
- os: macos-14
33+
xcode: '15.4'
34+
package: 'main'
35+
- os: macos-14
36+
xcode: '15.4'
37+
package: 'Examples'
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v4
41+
42+
- name: Select Xcode ${{ matrix.xcode }}
43+
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
44+
45+
- name: Print Swift version
46+
run: swift --version
47+
48+
# Set working directory to Examples if testing the examples package
49+
- name: Set working directory
50+
run: |
51+
if [ "${{ matrix.package }}" = "Examples" ]; then
52+
cd Examples
53+
fi
54+
55+
- name: Build package
56+
run: swift build
57+
58+
- name: Run tests
59+
run: swift test
60+
61+
linux:
62+
name: Ubuntu - ${{ matrix.package }} (Swift ${{ matrix.swift }})
63+
runs-on: ubuntu-latest
64+
strategy:
65+
matrix:
66+
swift:
67+
- '6.0'
68+
- '5.10'
69+
- '5.9'
70+
package:
71+
- 'main'
72+
- 'Examples'
73+
container: swift:${{ matrix.swift }}
74+
steps:
75+
- name: Checkout repository
76+
uses: actions/checkout@v4
77+
78+
# Set working directory to Examples if testing the examples package
79+
- name: Set working directory
80+
run: |
81+
if [ "${{ matrix.package }}" = "Examples" ]; then
82+
cd Examples
83+
fi
84+
85+
- name: Build package
86+
run: swift build
87+
88+
- name: Run tests
89+
run: swift test
90+
91+
# windows:
92+
# name: Windows - ${{ matrix.package }} (Swift ${{ matrix.swift }})
93+
# runs-on: windows-latest
6494
# strategy:
6595
# matrix:
6696
# swift:
6797
# - '6.0'
6898
# - '5.10'
69-
# - '5.9'
99+
# - '5.9.1' # Macros has been added to Swift on Windows in 5.9.1 version
70100
# package:
71101
# - 'main'
72102
# - 'Examples'
73-
# container: swift:${{ matrix.swift }}
74103
# steps:
75104
# - name: Checkout repository
76105
# uses: actions/checkout@v4
77106
#
107+
# - name: Install Swift
108+
# uses: compnerd/gha-setup-swift@main
109+
# with:
110+
# branch: swift-${{ matrix.swift }}-release
111+
# tag: ${{ matrix.swift }}-RELEASE
112+
#
78113
# # Set working directory to Examples if testing the examples package
79114
# - name: Set working directory
80115
# run: |
81-
# if [ "${{ matrix.package }}" = "Examples" ]; then
116+
# if ("${{ matrix.package }}" -eq "Examples") {
82117
# cd Examples
83-
# fi
118+
# }
84119
#
85120
# - name: Build package
86121
# run: swift build
87-
#
88-
# - name: Run tests
89-
# run: swift test
90-
#
91-
## windows:
92-
## name: Windows - ${{ matrix.package }} (Swift ${{ matrix.swift }})
93-
## runs-on: windows-latest
94-
## strategy:
95-
## matrix:
96-
## swift:
97-
## - '6.0'
98-
## - '5.10'
99-
## - '5.9.1' # Macros has been added to Swift on Windows in 5.9.1 version
100-
## package:
101-
## - 'main'
102-
## - 'Examples'
103-
## steps:
104-
## - name: Checkout repository
105-
## uses: actions/checkout@v4
106-
##
107-
## - name: Install Swift
108-
## uses: compnerd/gha-setup-swift@main
109-
## with:
110-
## branch: swift-${{ matrix.swift }}-release
111-
## tag: ${{ matrix.swift }}-RELEASE
112-
##
113-
## # Set working directory to Examples if testing the examples package
114-
## - name: Set working directory
115-
## run: |
116-
## if ("${{ matrix.package }}" -eq "Examples") {
117-
## cd Examples
118-
## }
119-
##
120-
## - name: Build package
121-
## run: swift build
122-
#
123-
## Looks like tests don't work on Windows
124-
# # - name: Run tests
125-
# # run: swift test
126-
#
127-
# code-coverage:
128-
# name: Gather Code Coverage
129-
# needs: macos
130-
# runs-on: macos-15
131-
# steps:
132-
# - name: Checkout repository
133-
# uses: actions/checkout@v4
134-
#
135-
# - name: Select latest Xcode
136-
# run: sudo xcode-select -s /Applications/Xcode_16.2.app
137-
#
138-
# - name: Build and test with coverage
139-
# run: swift test -Xswiftc -Xfrontend -Xswiftc -dump-macro-expansions --enable-code-coverage
140-
#
141-
# - name: Gather code coverage
142-
# run: |
143-
# BUILD_PATH=$(swift build --show-bin-path)
144-
# xcrun llvm-cov report \
145-
# $BUILD_PATH/swift-spyablePackageTests.xctest/Contents/MacOS/swift-spyablePackageTests \
146-
# -instr-profile=$BUILD_PATH/codecov/default.profdata \
147-
# -ignore-filename-regex=".build|Tests" -use-color
148-
# xcrun llvm-cov export -format="lcov" \
149-
# $BUILD_PATH/swift-spyablePackageTests.xctest/Contents/MacOS/swift-spyablePackageTests \
150-
# -instr-profile=$BUILD_PATH/codecov/default.profdata \
151-
# -ignore-filename-regex=".build|Tests" > coverage_report.lcov
152-
#
153-
# - name: Upload coverage reports to Codecov
154-
# uses: codecov/codecov-action@v4
155-
# with:
156-
# token: ${{ secrets.CODECOV_TOKEN }}
157-
# files: ./coverage_report.lcov
122+
123+
# Looks like tests don't work on Windows
124+
# - name: Run tests
125+
# run: swift test
126+
127+
code-coverage:
128+
name: Gather Code Coverage
129+
needs: macos
130+
runs-on: macos-15
131+
steps:
132+
- name: Checkout repository
133+
uses: actions/checkout@v4
134+
135+
- name: Select latest Xcode
136+
run: sudo xcode-select -s /Applications/Xcode_16.2.app
137+
138+
- name: Build and test with coverage
139+
run: swift test -Xswiftc -Xfrontend -Xswiftc -dump-macro-expansions --enable-code-coverage
140+
141+
- name: Gather code coverage
142+
run: |
143+
BUILD_PATH=$(swift build --show-bin-path)
144+
xcrun llvm-cov report \
145+
$BUILD_PATH/swift-spyablePackageTests.xctest/Contents/MacOS/swift-spyablePackageTests \
146+
-instr-profile=$BUILD_PATH/codecov/default.profdata \
147+
-ignore-filename-regex=".build|Tests" -use-color
148+
xcrun llvm-cov export -format="lcov" \
149+
$BUILD_PATH/swift-spyablePackageTests.xctest/Contents/MacOS/swift-spyablePackageTests \
150+
-instr-profile=$BUILD_PATH/codecov/default.profdata \
151+
-ignore-filename-regex=".build|Tests" > coverage_report.lcov
152+
153+
- name: Upload coverage reports to Codecov
154+
uses: codecov/codecov-action@v4
155+
with:
156+
token: ${{ secrets.CODECOV_TOKEN }}
157+
files: ./coverage_report.lcov
158158

159159
check-macro-compatibility:
160160
name: Check Macro Compatibility
@@ -167,8 +167,8 @@ jobs:
167167
run: swift --version
168168

169169
- name: Run Swift Macro Compatibility Check
170-
uses: Matejkob/swift-macro-compatibility-check@main
170+
uses: Matejkob/swift-macro-compatibility-check@v1
171171
with:
172-
run-tests: false
172+
run-tests: true
173173
major-versions-only: true
174174

Package.resolved

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 6.1
1+
// swift-tools-version: 5.9
22

33
import CompilerPluginSupport
44
import PackageDescription

Package@swift-6.0.swift

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// swift-tools-version: 6.0
2+
3+
import CompilerPluginSupport
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "swift-spyable",
8+
platforms: [
9+
.macOS(.v10_15),
10+
.iOS(.v13),
11+
.tvOS(.v13),
12+
.watchOS(.v6),
13+
.macCatalyst(.v13),
14+
],
15+
products: [
16+
.library(
17+
name: "Spyable",
18+
targets: ["Spyable"]
19+
)
20+
],
21+
dependencies: [
22+
.package(url: "https://github.com/swiftlang/swift-syntax", "509.0.0"..<"602.0.0")
23+
],
24+
targets: [
25+
.macro(
26+
name: "SpyableMacro",
27+
dependencies: [
28+
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
29+
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
30+
]
31+
),
32+
.target(
33+
name: "Spyable",
34+
dependencies: [
35+
"SpyableMacro"
36+
]
37+
),
38+
.testTarget(
39+
name: "SpyableMacroTests",
40+
dependencies: [
41+
"SpyableMacro",
42+
.product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"),
43+
]
44+
),
45+
],
46+
swiftLanguageModes: [.v6]
47+
)

0 commit comments

Comments
 (0)