diff --git a/.github/workflows/docs.yml b/.github/workflows/Documentation.yml similarity index 90% rename from .github/workflows/docs.yml rename to .github/workflows/Documentation.yml index 9803ab63..f1d43ace 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/Documentation.yml @@ -18,8 +18,8 @@ jobs: - name: Install Swift uses: tayloraswift/swift-install-action@master with: - swift-prefix: "swift-6.0.1-release/ubuntu2404/swift-6.0.1-RELEASE" - swift-id: "swift-6.0.1-RELEASE-ubuntu24.04" + swift-prefix: "swift-6.0.2-release/ubuntu2404/swift-6.0.2-RELEASE" + swift-id: "swift-6.0.2-RELEASE-ubuntu24.04" - name: Install Unidoc uses: tayloraswift/swift-unidoc-action@master diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml new file mode 100644 index 00000000..f889a7dc --- /dev/null +++ b/.github/workflows/Tests.yml @@ -0,0 +1,42 @@ +name: tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + linux: + runs-on: ubuntu-24.04 + name: Ubuntu 24.04 + + steps: + - name: Install Swift + uses: tayloraswift/swift-install-action@master + with: + swift-prefix: "swift-6.0.2-release/ubuntu2404/swift-6.0.2-RELEASE" + swift-id: "swift-6.0.2-RELEASE-ubuntu24.04" + + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Run tests + run: Scripts/TestAll + + macos: + runs-on: macos-15 + name: macOS + + steps: + - name: Install Swift + uses: tayloraswift/swift-install-action@master + with: + swift-prefix: "swift-6.0.2-release/xcode/swift-6.0.2-RELEASE" + swift-id: "swift-6.0.2-RELEASE" + + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Run tests + run: Scripts/TestAll diff --git a/.github/workflows/iOS.yml b/.github/workflows/iOS.yml new file mode 100644 index 00000000..1e4f13b1 --- /dev/null +++ b/.github/workflows/iOS.yml @@ -0,0 +1,14 @@ +name: iOS + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + uses: tayloraswift/swift-device-action/.github/workflows/build.yml@master + with: + xcode-scheme: 'PNG' + destination: ${{ github.workflow }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index bf8b74f7..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: test - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - linux: - runs-on: ubuntu-24.04 - name: Ubuntu 24.04 - - steps: - - name: Install Swift - uses: tayloraswift/swift-install-action@master - with: - swift-prefix: "swift-5.10.1-release/ubuntu2404/swift-5.10.1-RELEASE" - swift-id: "swift-5.10.1-RELEASE-ubuntu24.04" - - - name: Checkout repository - uses: actions/checkout@v3 - - - run: .github/pipeline - - macos: - runs-on: macos-14 - name: macOS - strategy: - matrix: - swift: - - toolchain: 5.10.1-RELEASE - branch: swift-5.10.1-release - - env: - SWIFT_TOOLCHAIN_DIRECTORY: >- - /Library/Developer/Toolchains/swift-${{ matrix.swift.toolchain }}.xctoolchain - - steps: - - name: Cache Swift toolchain - id: cache - uses: actions/cache@v2 - with: - path: ~/swift-${{ matrix.swift.toolchain }}.pkg - key: macos:swift:${{ matrix.swift.toolchain }} - - - name: Download toolchain - if: steps.cache.outputs.cache-hit != 'true' - run: "curl https://download.swift.org/\ - ${{ matrix.swift.branch }}/xcode/\ - swift-${{ matrix.swift.toolchain }}/\ - swift-${{ matrix.swift.toolchain }}-osx.pkg \ - --output ~/swift-${{ matrix.swift.toolchain }}.pkg" - - - name: Install toolchain - run: | - sudo installer -pkg ~/swift-${{ matrix.swift.toolchain }}.pkg -target / - - - name: Select toolchain - run: | - echo "TOOLCHAINS=$(plutil -extract CFBundleIdentifier raw \ - $SWIFT_TOOLCHAIN_DIRECTORY/Info.plist)" >> $GITHUB_ENV - - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Run pipeline - run: .github/pipeline - - devices: - runs-on: macos-14 - name: macOS - strategy: - matrix: - device: [ios, tvos, watchos] - env: - DEVELOPER_DIR: "/Applications/Xcode_15.3.app/Contents/Developer" - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Build - run: | - swift --version - xcrun xcodebuild -list - xcrun xcodebuild build \ - -scheme "PNG" \ - -destination "generic/platform=${{ matrix.device }}" diff --git a/.github/workflows/tvOS.yml b/.github/workflows/tvOS.yml new file mode 100644 index 00000000..2332c93d --- /dev/null +++ b/.github/workflows/tvOS.yml @@ -0,0 +1,14 @@ +name: tvOS + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + uses: tayloraswift/swift-device-action/.github/workflows/build.yml@master + with: + xcode-scheme: 'PNG' + destination: ${{ github.workflow }} diff --git a/.github/workflows/visionOS.yml b/.github/workflows/visionOS.yml new file mode 100644 index 00000000..aae1d3b8 --- /dev/null +++ b/.github/workflows/visionOS.yml @@ -0,0 +1,14 @@ +name: visionOS + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + uses: tayloraswift/swift-device-action/.github/workflows/build.yml@master + with: + xcode-scheme: 'PNG' + destination: ${{ github.workflow }} diff --git a/.github/workflows/watchOS.yml b/.github/workflows/watchOS.yml new file mode 100644 index 00000000..e0521c57 --- /dev/null +++ b/.github/workflows/watchOS.yml @@ -0,0 +1,14 @@ +name: watchOS + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + uses: tayloraswift/swift-device-action/.github/workflows/build.yml@master + with: + xcode-scheme: 'PNG' + destination: ${{ github.workflow }} diff --git a/README.md b/README.md index 910e90d2..30f2e734 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,9 @@
-***`png`***
`4.4` +***`png`*** -[![ci status](https://github.com/tayloraswift/swift-png/actions/workflows/test.yml/badge.svg)](https://github.com/tayloraswift/swift-png/actions/workflows/test.yml) -[![ci status](https://github.com/tayloraswift/swift-png/actions/workflows/docs.yml/badge.svg)](https://github.com/tayloraswift/swift-png/actions/workflows/docs.yml) - - -[![swift package index versions](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Ftayloraswift%2Fswift-png%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/tayloraswift/swift-png) -[![swift package index platforms](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Ftayloraswift%2Fswift-png%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/tayloraswift/swift-png) +[![Tests](https://github.com/tayloraswift/swift-png/actions/workflows/Tests.yml/badge.svg)](https://github.com/tayloraswift/swift-png/actions/workflows/Tests.yml) +[![Documentation](https://github.com/tayloraswift/swift-png/actions/workflows/Documentation.yml/badge.svg)](https://github.com/tayloraswift/swift-png/actions/workflows/Documentation.yml)
@@ -19,6 +15,24 @@ Swift *PNG* is [available](LICENSE) under the [Apache 2.0 license](https://www.a Swift *PNG*’s [documentation](https://swiftinit.org/docs/swift-png/png) is available on Swiftinit! + +## Requirements + +The swift-png library requires Swift 5.10 or later. + +| Platform | Status | +| -------- | ------ | +| 🐧 Linux | [![Tests](https://github.com/tayloraswift/swift-png/actions/workflows/Tests.yml/badge.svg)](https://github.com/tayloraswift/swift-png/actions/workflows/Tests.yml) | +| 🍏 Darwin | [![Tests](https://github.com/tayloraswift/swift-png/actions/workflows/Tests.yml/badge.svg)](https://github.com/tayloraswift/swift-png/actions/workflows/Tests.yml) | +| 🍏 Darwin (iOS) | [![iOS](https://github.com/tayloraswift/swift-png/actions/workflows/iOS.yml/badge.svg)](https://github.com/tayloraswift/swift-png/actions/workflows/iOS.yml) | +| 🍏 Darwin (tvOS) | [![tvOS](https://github.com/tayloraswift/swift-png/actions/workflows/tvOS.yml/badge.svg)](https://github.com/tayloraswift/swift-png/actions/workflows/tvOS.yml) | +| 🍏 Darwin (visionOS) | [![visionOS](https://github.com/tayloraswift/swift-png/actions/workflows/visionOS.yml/badge.svg)](https://github.com/tayloraswift/swift-png/actions/workflows/visionOS.yml) | +| 🍏 Darwin (watchOS) | [![watchOS](https://github.com/tayloraswift/swift-png/actions/workflows/watchOS.yml/badge.svg)](https://github.com/tayloraswift/swift-png/actions/workflows/watchOS.yml) | + + +[Check deployment minimums](https://swiftinit.org/docs/swift-png#ss:platform-requirements) + + ## Getting started To use *Swift PNG* in a project, add this descriptor to the `dependencies` list in your `Package.swift` file: diff --git a/.github/pipeline b/Scripts/TestAll similarity index 100% rename from .github/pipeline rename to Scripts/TestAll diff --git a/Sources/PNG/System.swift b/Sources/PNG/System.swift index 1a5b1311..69672259 100644 --- a/Sources/PNG/System.swift +++ b/Sources/PNG/System.swift @@ -2,7 +2,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -#if os(macOS) || os(iOS) +#if canImport(Darwin) import Darwin #elseif canImport(Glibc) import Glibc @@ -15,7 +15,7 @@ #warning("unsupported or untested platform (please open an issue at https://github.com/tayloraswift/swift-png/issues)") #endif -#if os(macOS) || os(iOS) || os(Linux) || os(Windows) +#if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || os(Windows) /// A namespace for platform-dependent functionality. ///