diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 5d3780a..27ddcac 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -12,11 +12,10 @@ jobs: strategy: fail-fast: false matrix: - swift_version: ["5.10"] + swift_version: ["6.0"] runs-on: ubuntu-22.04 env: OPENGRAPH_WERROR: 1 - OPENGRAPH_SWIFT_TESTING: 1 OPENGRAPH_ATTRIBUTEGRAPH: 0 OPENGRAPH_COMPATIBILITY_TEST: 0 container: swift:${{ matrix.swift_version }}-jammy diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml index 3914d14..5e9153b 100644 --- a/.github/workflows/wasm.yml +++ b/.github/workflows/wasm.yml @@ -12,12 +12,14 @@ jobs: strategy: fail-fast: false matrix: - swift_version: ["5.10.0-RELEASE"] + swift_version: ["5.10.0-RELEASE", "6.0-SNAPSHOT-2024-09-18-a"] os: [ubuntu-22.04] + include: + - swift_version: "6.0-SNAPSHOT-2024-09-18-a" + continue-on-error: true runs-on: ${{ matrix.os }} env: OPENGRAPH_WERROR: 1 - OPENGRAPH_SWIFT_TESTING: 0 OPENGRAPH_ATTRIBUTEGRAPH: 0 OPENGRAPH_COMPATIBILITY_TEST: 0 steps: @@ -26,9 +28,9 @@ jobs: with: swift-version: wasm-${{ matrix.swift_version }} - name: build + continue-on-error: ${{ matrix.continue-on-error }} run: | swift build --triple wasm32-unknown-wasi - # Blocked by upstream support for WASM. See https://github.com/apple/swift-testing/issues/228 # - name: test - # run: | - # swift test --triple wasm32-unknown-wasi + # run: | + # swift test --triple wasm32-unknown-wasi \ No newline at end of file diff --git a/Package.swift b/Package.swift index d1dda28..6253173 100644 --- a/Package.swift +++ b/Package.swift @@ -60,10 +60,10 @@ let openGraphCompatibilityTestTarget = Target.testTarget( swiftSettings: sharedSwiftSettings ) -let swiftBinPath = Context.environment["_"] ?? "" +let swiftBinPath = Context.environment["_"] ?? "/usr/bin/swift" let swiftBinURL = URL(fileURLWithPath: swiftBinPath) let SDKPath = swiftBinURL.deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent().path -let includePath = SDKPath.appending("/usr/lib/swift_static") +let includePath = SDKPath.appending("/usr/lib/swift") let package = Package( name: "OpenGraph", diff --git a/Package@swift-5.10.swift b/Package@swift-5.10.swift index e712d85..2701a02 100644 --- a/Package@swift-5.10.swift +++ b/Package@swift-5.10.swift @@ -55,7 +55,7 @@ let openGraphCompatibilityTestTarget = Target.testTarget( swiftSettings: sharedSwiftSettings ) -let swiftBinPath = Context.environment["_"] ?? "" +let swiftBinPath = Context.environment["_"] ?? "/usr/bin/swift" let swiftBinURL = URL(fileURLWithPath: swiftBinPath) let SDKPath = swiftBinURL.deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent().path let includePath = SDKPath.appending("/usr/lib/swift_static") diff --git a/Plugins/UpdateModule/UpdateModuleCommand.swift b/Plugins/UpdateModule/UpdateModuleCommand.swift index 49a2704..b45ffb3 100644 --- a/Plugins/UpdateModule/UpdateModuleCommand.swift +++ b/Plugins/UpdateModule/UpdateModuleCommand.swift @@ -10,21 +10,12 @@ import Foundation @main struct UpdateModuleCommand: CommandPlugin { func performCommand(context: PackagePlugin.PluginContext, arguments: [String]) async throws { + #if compiler(>=6.0) // Skip build on WASI 5.10 let process = Process() - #if os(macOS) - let path: String = try context.tool(named: "zsh").url.path() - let url: URL? = if #available(macOS 14, *) { - URL(filePath: path) - } else { - URL(string: "file://\(path)") - } - #else - let path = try context.tool(named: "zsh").path.string - let url = URL(string: "file://\(path)") - #endif - process.executableURL = url + process.executableURL = try context.tool(named: "zsh").url process.arguments = ["AG/update.sh"] try process.run() process.waitUntilExit() + #endif } } diff --git a/Scripts/build.sh b/Scripts/build.sh index 1dcc13d..a12a29d 100755 --- a/Scripts/build.sh +++ b/Scripts/build.sh @@ -9,5 +9,4 @@ OPENGRAPH_ROOT="$(dirname $(dirname $(filepath $0)))" cd $OPENGRAPH_ROOT -export OPENGRAPH_SWIFT_TESTING=0 swift build diff --git a/Scripts/og_swiftinterface.sh b/Scripts/og_swiftinterface.sh index 49345f1..12a3817 100755 --- a/Scripts/og_swiftinterface.sh +++ b/Scripts/og_swiftinterface.sh @@ -9,5 +9,4 @@ OG_ROOT="$(dirname $(dirname $(filepath $0)))" cd $OG_ROOT -export OPENGRAPH_SWIFT_TESTING=0 swift build -Xswiftc -emit-module-interface -Xswiftc -enable-library-evolution diff --git a/Tests/OpenGraphCompatibilityTests/Attribute/Attribute/PointerOffsetTests.swift b/Tests/OpenGraphCompatibilityTests/Attribute/Attribute/PointerOffsetTests.swift index 00ee624..10d5aaa 100644 --- a/Tests/OpenGraphCompatibilityTests/Attribute/Attribute/PointerOffsetTests.swift +++ b/Tests/OpenGraphCompatibilityTests/Attribute/Attribute/PointerOffsetTests.swift @@ -42,7 +42,6 @@ struct PointerOffsetTests { #expect(invalidPointer == UnsafeMutablePointer(bitPattern: stride)) } - #if compiler(>=6.0) @Test(.bug("https://github.com/OpenSwiftUIProject/OpenGraph/issues/70", id: 70, "Verify fix of #70")) func ofAndOffset() { struct Empty { @@ -79,7 +78,6 @@ struct PointerOffsetTests { .of(&invalid.third) } } - #endif @Test("Extension API between UnsafePointer/UnsafeMutablePointer and PointerOffset") func unsafePointerAndUnsafeMutablePointerExtension() { @@ -147,7 +145,6 @@ struct PointerOffsetTests { #expect((pointer + secondOffset).pointee == 4) #expect((pointer + thirdOffset).pointee == 5) } - #if !(!canImport(Darwin) && !DEBUG) withUnsafePointer(to: triple) { pointer in #expect((pointer + firstOffset).pointee == 3) #expect((pointer + secondOffset).pointee == 4) @@ -156,31 +153,6 @@ struct PointerOffsetTests { #expect(triple.first == 3) #expect(triple.second == 4) #expect(triple.third == 5) - #endif - } - } - - #if !canImport(Darwin) && !DEBUG - @Test("Undefined Behavior Issue for PointerOffset", .bug("#73", relationship: .uncoveredBug)) - func unsafePointerAndUnsafeMutablePointerExtensionUB() { - var tuple = Tuple(first: 1, second: 2) - typealias Base = Tuple - let firstOffset = PointerOffset(byteOffset: 0) - withUnsafeMutablePointer(to: &tuple) { pointer in - #expect(pointer[offset: firstOffset] == 1) - pointer[offset: firstOffset] = 3 - } - let unexpectedValue = tuple.first - // The value will be unexpected due to UB - #expect(unexpectedValue == 1) - // The value will be expected after and within a withKnownIssue block - withKnownIssue { - let expectedValue = tuple.first - #expect(expectedValue == 3) - Issue.record("To make withKnownIssue pass") } - let expectedValue = tuple.first - #expect(expectedValue == 3) } - #endif }