diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 457db03..7f1ea63 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,11 +10,31 @@ concurrency: jobs: build: - runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest] + include: + - name: "Test Linux" + os: ubuntu-latest + - name: "Test Macos" + os: macos-latest + - name: "Test Windows" + os: windows-latest + - name: "Test Android" + os: macos-13 + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - - name: Build - run: swift test + - uses: actions/checkout@v3 + - name: Setup windows environment + if: ${{ matrix.os == 'windows-latest' }} + uses: compnerd/gha-setup-swift@main + with: + branch: swift-6.1-release + tag: 6.1-RELEASE + - name: ${{ matrix.name }} + if: ${{ matrix.name != 'Test Android' }} + run: swift test + - name: ${{ matrix.name }} + if: ${{ matrix.name == 'Test Android' }} + uses: skiptools/swift-android-action@v2 + with: + swift-version: 6.1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d049f20..4294cb5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,27 +3,44 @@ name: PR Check on: pull_request: branches: [ "main" ] + types: [opened, reopened, synchronize] concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - steps: - - uses: actions/checkout@v3 - - name: Build - run: swift test - build_android: - runs-on: macos-13 - steps: - - name: Check out code - uses: actions/checkout@v4 - - name: Run unit tests - uses: skiptools/swift-android-action@v2 - with: - swift-version: 6.1 + tests: + name: Test + uses: beatt83/github-workflows/.github/workflows/swift_package_test.yml@main + with: + enable_android_checks: true +# build: +# strategy: +# matrix: +# include: +# - name: "Test Linux" +# os: ubuntu-latest +# - name: "Test Macos" +# os: macos-latest +# - name: "Test Windows" +# os: windows-latest +# - name: "Test Android" +# os: macos-13 +# runs-on: ${{ matrix.os }} +# steps: +# - uses: actions/checkout@v3 +# - name: Setup windows environment +# if: ${{ matrix.os == 'windows-latest' }} +# uses: compnerd/gha-setup-swift@main +# with: +# branch: swift-6.1-release +# tag: 6.1-RELEASE +# - name: ${{ matrix.name }} +# if: ${{ matrix.name != 'Test Android' }} +# run: swift test +# - name: ${{ matrix.name }} +# if: ${{ matrix.name == 'Test Android' }} +# uses: skiptools/swift-android-action@v2 +# with: +# swift-version: 6.1 diff --git a/Package.swift b/Package.swift index 9fbc82d..6f88b30 100644 --- a/Package.swift +++ b/Package.swift @@ -39,7 +39,7 @@ let package = Package( .package(url: "https://github.com/beatt83/CryptoSwift.git", .upToNextMinor(from: "1.8.7")), .package(url: "https://github.com/apple/swift-certificates.git", from: "1.7.0"), // FOR `A256_CBC_HS512` with `ECDH-1PU-A256KW` - .package(url: "https://github.com/DLTAStudio/zlib.git",from:"1.0.1"), + .package(url: "https://github.com/beatt83/swift-zlib.git", branch: "feature/LikeCNIOZlib"), .package(url: "https://github.com/apple/swift-asn1.git", .upToNextMajor(from: "1.3.1")) ], targets: [ @@ -51,7 +51,7 @@ let package = Package( .product(name: "CryptoSwift", package: "CryptoSwift"), .product(name: "Crypto", package: "swift-crypto"), .product(name: "_CryptoExtras", package: "swift-crypto"), - .product(name: "Zlib", package: "ZLib"), + .product(name: "Zlib", package: "swift-zlib"), ] ), .testTarget( diff --git a/Sources/JSONWebAlgorithms/Compression/ZIP/Zip+ContentCompressor.swift b/Sources/JSONWebAlgorithms/Compression/ZIP/Zip+ContentCompressor.swift index d7fdb29..6d88134 100644 --- a/Sources/JSONWebAlgorithms/Compression/ZIP/Zip+ContentCompressor.swift +++ b/Sources/JSONWebAlgorithms/Compression/ZIP/Zip+ContentCompressor.swift @@ -15,7 +15,7 @@ */ import Foundation -import ZlibSwift +import SwiftZLib enum ZipError : Error { case compressionFailed @@ -29,9 +29,7 @@ public struct Zip: ContentCompressor, ContentDecompressor { /// - Throws: An error if the compression fails. /// - Returns: The compressed data. public func compress(input: Data) throws -> Data { - guard let compressed = input.zlibCompressed else { - throw ZipError.compressionFailed - } + let compressed = try input.zlibCompressed return compressed; } @@ -40,10 +38,7 @@ public struct Zip: ContentCompressor, ContentDecompressor { /// - Throws: An error if the decompression fails. /// - Returns: The decompressed data. public func decompress(input: Data) throws -> Data { - guard let decompressed = input.zlibDecompressed else { - throw ZipError.decompressionFailed - - } + let decompressed = try input.zlibDecompressed return decompressed; } } diff --git a/Tests/ExampleTests/ExampleTests.swift b/Tests/ExampleTests/ExampleTests.swift index 371710c..a102987 100644 --- a/Tests/ExampleTests/ExampleTests.swift +++ b/Tests/ExampleTests/ExampleTests.swift @@ -1,4 +1,3 @@ -#if !os(Android) import JSONWebKey import JSONWebToken import JSONWebSignature @@ -663,4 +662,3 @@ final class ExamplesTests: XCTestCase { _ = try JWS.verify(jwsString: jwsString, payload: payload, key: key) } } -#endif