Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ad5c5e9
Set version range in manifest, up to local swift version to resolve
SixFiveSoftware Sep 15, 2025
f0eefbe
Bump to Swift 6.0 and up major
bjsaturn Sep 24, 2025
96c8e28
Merge pull request #1 from bjsaturn/bj/version-range-p2
SixFiveSoftware Sep 24, 2025
ef936ad
Merge branch 'main' into bj/version-range
JosephDuffy Jan 3, 2026
fe50a00
Use same version range in Package@swift-5.9.swift
JosephDuffy Jan 3, 2026
138dd5f
Test swift-sytnax range on CI
JosephDuffy Jan 3, 2026
995cf27
Merge branch 'main' into bj/version-range
JosephDuffy Jan 3, 2026
5175c11
Run tests on pull request target
JosephDuffy Jan 3, 2026
b5c0933
Pin swift-dependency-compatibility-checker to main branch
JosephDuffy Jan 3, 2026
ef31eae
Allow Codebcov upload to fail for PRs from forks
JosephDuffy Jan 3, 2026
00f5411
Remove swift-dependency-compatibility-checker from Mintfile
JosephDuffy Jan 3, 2026
2c9a5ed
Skip Codecov upload for PRs from forks
JosephDuffy Jan 3, 2026
a0e4d7e
Set Package.resolved version to 2
JosephDuffy Jan 3, 2026
d1fb3d9
Remove support for Swift < 6.0
JosephDuffy Jan 3, 2026
8887acc
Silent output for mint to enable parsing as matrix
JosephDuffy Jan 3, 2026
f18dac9
Check event name for pull request target, not `event.action`
JosephDuffy Jan 3, 2026
3bd73a4
Revert Package.resolved changes
JosephDuffy Jan 4, 2026
6e67d8a
Remove testing of Swift < 6.0
JosephDuffy Jan 4, 2026
4a95d28
Use codecov-actions@v5, which should support uploading from forks
JosephDuffy Jan 4, 2026
986ca90
Use `files`, which is the _replacement_, not the deprecated argument
JosephDuffy Jan 4, 2026
b0caa74
Select Xcode 26.0.1, install mint
JosephDuffy Jan 4, 2026
86795fd
Include macOS version in cache keys
JosephDuffy Jan 4, 2026
f7dcbde
Update xcbeautify to 3.1.2
JosephDuffy Jan 4, 2026
b39a251
Use xcbeautify 2.30.1 to support Swift 6.0
JosephDuffy Jan 4, 2026
99a1d75
Fail job when tests fail
JosephDuffy Jan 5, 2026
b72409f
Fix tests with Swift Syntax 510.0.0 or greater
JosephDuffy Jan 5, 2026
6380ed1
Fix warning on Swift Syntax 600.0.0
JosephDuffy Jan 5, 2026
85f1605
Fix expected output on Swift Syntax 600.0.0
JosephDuffy Jan 5, 2026
ce94fcf
Fix test assertions on Swift Syntax 602.0.0
JosephDuffy Jan 5, 2026
c3573a9
Only compile against Swift Syntax 601.0.0
JosephDuffy Jan 5, 2026
1efc302
Use single quotes to fix syntax error
JosephDuffy Jan 5, 2026
4dfb825
Replace deprecated inputs
JosephDuffy Jan 5, 2026
e7ef043
Always depend on HashableMacroFoundation
JosephDuffy Jan 5, 2026
e3a1cd9
Fix step name
JosephDuffy Jan 5, 2026
1942390
Upload coverage for all Swift Syntax versions
JosephDuffy Jan 5, 2026
a750a1c
Enable code coverage
JosephDuffy Jan 5, 2026
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: 0 additions & 2 deletions .github/generate-xcode-tests-matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ set -e
platforms='["macOS","iOS","tvOS","watchOS","macCatalyst","visionOS"]'

includes='[
{"os":"macos-14", "xcode":"15.2", "swift": "5.9"},
{"os":"macos-14", "xcode":"15.3", "swift": "5.10"},
{"os":"macos-15", "xcode":"16.0", "swift": "6.0"},
{"os":"macos-15", "xcode":"16.3", "swift": "6.1"},
{"os":"macos-26", "xcode":"26.0.1", "swift": "6.2"}
Expand Down
128 changes: 105 additions & 23 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: Tests
on:
push:
pull_request:
branches:
- "**:**" # PRs from forks have a prefix with `owner:`
pull_request_target:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -18,10 +17,6 @@ jobs:
fail-fast: false
matrix:
include:
- os: "macos-14"
xcode: "15.1" # Swift 5.9. Same as 15.2.
- os: "macos-14"
xcode: "15.3" # Swift 5.10. Same as 15.4.
- os: "macos-15"
xcode: "16.0" # Swift 6.0. Same as 16.1 and 16.2.
- os: "macos-15"
Expand All @@ -42,34 +37,121 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.mint
key: ${{ runner.os }}-mint-xcode_${{ matrix.xcode }}-${{ hashFiles('**/Mintfile') }}
key: ${{ runner.os }}-${{ matrix.os }}-mint-xcode_${{ matrix.xcode }}-${{ hashFiles('**/Mintfile') }}
restore-keys: |
${{ runner.os }}-mint-xcode_${{ matrix.xcode }}
${{ runner.os }}-${{ matrix.os }}-mint-xcode_${{ matrix.xcode }}

- run: mint bootstrap

- name: Cache SwiftPM
uses: actions/cache@v3
with:
path: .build
key: ${{ runner.os }}-xcode_${{ matrix.xcode }}-swiftpm-${{ github.ref }}-${{ hashFiles('**/Package.resolved') }}
key: ${{ runner.os }}-${{ matrix.os }}-xcode_${{ matrix.xcode }}-swiftpm-${{ github.ref }}-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-xcode_${{ matrix.xcode }}-swiftpm-${{ github.ref }}-
${{ runner.os }}-xcode_${{ matrix.xcode }}-swiftpm-main-
${{ runner.os }}-xcode_${{ matrix.xcode }}-swiftpm-
${{ runner.os }}-${{ matrix.os }}-xcode_${{ matrix.xcode }}-swiftpm-${{ github.ref }}-
${{ runner.os }}-${{ matrix.os }}-xcode_${{ matrix.xcode }}-swiftpm-main-
${{ runner.os }}-${{ matrix.os }}-xcode_${{ matrix.xcode }}-swiftpm-

- name: SwiftPM tests
run: swift test --enable-code-coverage | mint run xcbeautify --renderer github-actions
run: |
set -o pipefail
swift test --enable-code-coverage | mint run xcbeautify --renderer github-actions

- name: Convert coverage for Codecov
id: convert-coverage
uses: sersoft-gmbh/swift-coverage-action@v4
with:
ignore-conversion-failures: true
fail-on-empty-output: true

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ${{ join(fromJSON(steps.convert-coverage.outputs.files), ',') }}
fail_ci_if_error: true

generate_swift_syntax_version:
name: Generate Swift Syntax Versions
runs-on: macos-26
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4

- run: brew install mint

- name: Cache Mint
uses: actions/cache@v3
with:
path: ~/.mint
key: macOS-macos-26-mint-swift-dependency-compatibility-checker

- name: Set up matrix
id: set-matrix
run: |
matrix="$(mint run --silent josephduffy/swift-dependency-compatibility-checker@main swift-syntax --resolve-only --github-actions-matrix)"
echo "${matrix}"
echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}"

test_swift_syntax_versions:
name: Swift Syntax ${{ matrix.version }} Tests
needs:
- generate_swift_syntax_version
runs-on: macos-26
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate_swift_syntax_version.outputs.matrix) }}

steps:
- uses: actions/checkout@v4

- name: Select Xcode 26.0.1
run: sudo xcode-select --switch /Applications/Xcode_26.0.1.app

- name: Install Mint
run: brew install mint

- name: Cache Mint
uses: actions/cache@v3
with:
path: ~/.mint
key: macOS-macos-26-mint-xcode_26.0.1-${{ hashFiles('**/Mintfile') }}
restore-keys: |
macOS-macos-26-mint-xcode_26.0.1

- run: mint bootstrap

- run: swift package resolve

- run: swift package resolve swift-syntax --version ${{ matrix.version }}

- name: Run Tests
# swift-macro-testing does not compile with swift-syntax 601.0.0
if: ${{ matrix.version != '601.0.0' }}
run: |
set -o pipefail
swift test --enable-code-coverage | mint run xcbeautify --renderer github-actions

- name: Compile Project
if: ${{ matrix.version == '601.0.0' }}
run: |
set -o pipefail
swift build | mint run xcbeautify --renderer github-actions

- name: Convert coverage for Codecov
id: convert-coverage
uses: sersoft-gmbh/swift-coverage-action@v4
if: ${{ matrix.version != '601.0.0' }}
with:
ignore-conversion-failures: true
fail-on-empty-output: true

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5
if: ${{ matrix.version != '601.0.0' }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
Expand Down Expand Up @@ -113,20 +195,20 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.mint
key: ${{ runner.os }}-mint-xcode_${{ matrix.xcode }}-${{ hashFiles('**/Mintfile') }}
key: ${{ runner.os }}-${{ matrix.os }}-mint-xcode_${{ matrix.xcode }}-${{ hashFiles('**/Mintfile') }}
restore-keys: |
${{ runner.os }}-mint-xcode_${{ matrix.xcode }}
${{ runner.os }}-${{ matrix.os }}-mint-xcode_${{ matrix.xcode }}

- run: mint bootstrap

- name: Cache DerivedData
uses: actions/cache@v3
with:
path: ~/Library/Developer/Xcode/DerivedData
key: ${{ runner.os }}-xcode_${{ matrix.xcode }}-derived_data-${{ github.ref }}
key: ${{ runner.os }}-${{ matrix.os }}-xcode_${{ matrix.xcode }}-derived_data-${{ github.ref }}
restore-keys: |
${{ runner.os }}-xcode_${{ matrix.xcode }}-derived_data-main
${{ runner.os }}-xcode_${{ matrix.xcode }}-derived_data-
${{ runner.os }}-${{ matrix.os }}-xcode_${{ matrix.xcode }}-derived_data-main
${{ runner.os }}-${{ matrix.os }}-xcode_${{ matrix.xcode }}-derived_data-

- name: Run Tests
run: |
Expand All @@ -140,7 +222,7 @@ jobs:
fail-on-empty-output: true

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
Expand All @@ -156,7 +238,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
swift: ["5.9.2", "5.10", "6.0", "6.1", "6.2"]
swift: ["6.0", "6.1", "6.2"]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -192,8 +274,8 @@ jobs:
- name: Install Swift
uses: compnerd/gha-setup-swift@main
with:
branch: ${{ matrix.branch }}
tag: ${{ matrix.tag }}
swift-version: ${{ matrix.branch }}
swift-build: ${{ matrix.tag }}

- name: swift test
run: swift test
2 changes: 1 addition & 1 deletion Mintfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
josephduffy/xcutils@v0.3.0
tuist/xcbeautify@1.0.1
cpisciotta/xcbeautify@2.30.1
10 changes: 3 additions & 7 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/swiftlang/swift-syntax", from: "509.1.0"),
// Tests (specifically swift-snapshot-testing) do not support 601.0.0 but the project does build.
.package(url: "https://github.com/swiftlang/swift-syntax", "509.1.0"..<"603.0.0"),
// We only really need swift-macro-testing 0.3.0 or newer but 0.4.0 is required to compile due
// to breaking changes in swift-snapshot-testing.
.package(url: "https://github.com/pointfreeco/swift-macro-testing.git", from: "0.4.0"),
Expand All @@ -45,12 +46,7 @@ let package = Package(
.macro(
name: "HashableMacroMacros",
dependencies: [
.targetItem(
name: "HashableMacroFoundation",
condition: .when(
platforms: [.macOS, .iOS, .tvOS, .watchOS, .macCatalyst]
)
),
"HashableMacroFoundation",
.product(name: "SwiftDiagnostics", package: "swift-syntax"),
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
Expand Down
73 changes: 0 additions & 73 deletions Package@swift-5.9.swift

This file was deleted.

21 changes: 17 additions & 4 deletions Sources/HashableMacroMacros/Macros/HashableMacro+Hashable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,29 @@ extension HashableMacro {
)
}

let hashFunctionType: AttributedTypeSyntax

#if canImport(SwiftSyntax600)
hashFunctionType = AttributedTypeSyntax(
specifiers: [
.simpleTypeSpecifier(SimpleTypeSpecifierSyntax(specifier: .keyword(.inout)))
],
baseType: TypeSyntax(stringLiteral: "Hasher")
)
#else
hashFunctionType = AttributedTypeSyntax(
specifier: .keyword(.inout),
baseType: TypeSyntax(stringLiteral: "Hasher")
)
#endif

let hashFunctionSignature = FunctionSignatureSyntax(
parameterClause: FunctionParameterClauseSyntax(
parameters: [
FunctionParameterSyntax(
firstName: .identifier("into"),
secondName: .identifier("hasher"),
type: AttributedTypeSyntax(
specifier: .keyword(.inout),
baseType: TypeSyntax(stringLiteral: "Hasher")
)
type: hashFunctionType
),
]
)
Expand Down
Loading
Loading