Skip to content

Commit db41617

Browse files
committed
chore: add windows support
1 parent 043ae23 commit db41617

File tree

5 files changed

+63
-35
lines changed

5 files changed

+63
-35
lines changed

.github/workflows/release.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,31 @@ concurrency:
1010

1111
jobs:
1212
build:
13-
runs-on: ${{ matrix.os }}
1413
strategy:
1514
matrix:
16-
os: [ubuntu-latest, macos-latest]
15+
include:
16+
- name: "Test Linux"
17+
os: ubuntu-latest
18+
- name: "Test Macos"
19+
os: macos-latest
20+
- name: "Test Windows"
21+
os: windows-latest
22+
- name: "Test Android"
23+
os: macos-13
24+
runs-on: ${{ matrix.os }}
1725
steps:
18-
- uses: actions/checkout@v3
19-
- name: Build
20-
run: swift test
26+
- uses: actions/checkout@v3
27+
- name: Setup windows environment
28+
if: ${{ matrix.os == 'windows-latest' }}
29+
uses: compnerd/gha-setup-swift@main
30+
with:
31+
branch: swift-6.1-release
32+
tag: 6.1-RELEASE
33+
- name: ${{ matrix.name }}
34+
if: ${{ matrix.name != 'Test Android' }}
35+
run: swift test
36+
- name: ${{ matrix.name }}
37+
if: ${{ matrix.name == 'Test Android' }}
38+
uses: skiptools/swift-android-action@v2
39+
with:
40+
swift-version: 6.1

.github/workflows/test.yml

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,42 @@ name: PR Check
33
on:
44
pull_request:
55
branches: [ "main" ]
6+
types: [opened, reopened, synchronize]
67

78
concurrency:
89
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
910
cancel-in-progress: true
1011

1112
jobs:
12-
build:
13-
runs-on: ${{ matrix.os }}
14-
strategy:
15-
matrix:
16-
os: [ubuntu-latest, macos-latest]
17-
steps:
18-
- uses: actions/checkout@v3
19-
- name: Build
20-
run: swift test
21-
build_android:
22-
runs-on: macos-13
23-
steps:
24-
- name: Check out code
25-
uses: actions/checkout@v4
26-
- name: Run unit tests
27-
uses: skiptools/swift-android-action@v2
28-
with:
29-
swift-version: 6.1
13+
tests:
14+
name: Test
15+
uses: beatt83/github-workflows/.github/workflows/swift_package_test.yml@main
16+
# build:
17+
# strategy:
18+
# matrix:
19+
# include:
20+
# - name: "Test Linux"
21+
# os: ubuntu-latest
22+
# - name: "Test Macos"
23+
# os: macos-latest
24+
# - name: "Test Windows"
25+
# os: windows-latest
26+
# - name: "Test Android"
27+
# os: macos-13
28+
# runs-on: ${{ matrix.os }}
29+
# steps:
30+
# - uses: actions/checkout@v3
31+
# - name: Setup windows environment
32+
# if: ${{ matrix.os == 'windows-latest' }}
33+
# uses: compnerd/gha-setup-swift@main
34+
# with:
35+
# branch: swift-6.1-release
36+
# tag: 6.1-RELEASE
37+
# - name: ${{ matrix.name }}
38+
# if: ${{ matrix.name != 'Test Android' }}
39+
# run: swift test
40+
# - name: ${{ matrix.name }}
41+
# if: ${{ matrix.name == 'Test Android' }}
42+
# uses: skiptools/swift-android-action@v2
43+
# with:
44+
# swift-version: 6.1

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ let package = Package(
3939
.package(url: "https://github.com/beatt83/CryptoSwift.git", .upToNextMinor(from: "1.8.7")),
4040
.package(url: "https://github.com/apple/swift-certificates.git", from: "1.7.0"),
4141
// FOR `A256_CBC_HS512` with `ECDH-1PU-A256KW`
42-
.package(url: "https://github.com/DLTAStudio/zlib.git",from:"1.0.1"),
42+
.package(url: "https://github.com/beatt83/swift-zlib.git", branch: "feature/LikeCNIOZlib"),
4343
.package(url: "https://github.com/apple/swift-asn1.git", .upToNextMajor(from: "1.3.1"))
4444
],
4545
targets: [
@@ -51,7 +51,7 @@ let package = Package(
5151
.product(name: "CryptoSwift", package: "CryptoSwift"),
5252
.product(name: "Crypto", package: "swift-crypto"),
5353
.product(name: "_CryptoExtras", package: "swift-crypto"),
54-
.product(name: "Zlib", package: "ZLib"),
54+
.product(name: "Zlib", package: "swift-zlib"),
5555
]
5656
),
5757
.testTarget(

Sources/JSONWebAlgorithms/Compression/ZIP/Zip+ContentCompressor.swift

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import Foundation
18-
import ZlibSwift
18+
import SwiftZLib
1919

2020
enum ZipError : Error {
2121
case compressionFailed
@@ -29,9 +29,7 @@ public struct Zip: ContentCompressor, ContentDecompressor {
2929
/// - Throws: An error if the compression fails.
3030
/// - Returns: The compressed data.
3131
public func compress(input: Data) throws -> Data {
32-
guard let compressed = input.zlibCompressed else {
33-
throw ZipError.compressionFailed
34-
}
32+
let compressed = try input.zlibCompressed
3533
return compressed;
3634
}
3735

@@ -40,10 +38,7 @@ public struct Zip: ContentCompressor, ContentDecompressor {
4038
/// - Throws: An error if the decompression fails.
4139
/// - Returns: The decompressed data.
4240
public func decompress(input: Data) throws -> Data {
43-
guard let decompressed = input.zlibDecompressed else {
44-
throw ZipError.decompressionFailed
45-
46-
}
41+
let decompressed = try input.zlibDecompressed
4742
return decompressed;
4843
}
4944
}

Tests/ExampleTests/ExampleTests.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#if !os(Android)
21
import JSONWebKey
32
import JSONWebToken
43
import JSONWebSignature
@@ -663,4 +662,3 @@ final class ExamplesTests: XCTestCase {
663662
_ = try JWS.verify(jwsString: jwsString, payload: payload, key: key)
664663
}
665664
}
666-
#endif

0 commit comments

Comments
 (0)