From 1cecc16d2bc62efb68c8b9ea470dbf55bc0125ea Mon Sep 17 00:00:00 2001 From: Florian Friedrich Date: Tue, 27 Apr 2021 16:32:57 +0200 Subject: [PATCH] Add Swift 5.4 support --- .github/workflows/release.yml | 4 +++- .github/workflows/swift-test.yml | 32 ++++++++++---------------------- Package.swift | 2 +- Package@swift-5.3.swift | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 24 deletions(-) create mode 100644 Package@swift-5.3.swift diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6767b4..a684a40 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,9 @@ jobs: publish-docs: runs-on: macos-latest steps: - - run: sudo xcode-select -s /Applications/Xcode_12.3.app/Contents/Developer + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: ^12.4 - uses: dawidd6/action-get-tag@v1 id: get-tag - uses: actions/checkout@v2 diff --git a/.github/workflows/swift-test.yml b/.github/workflows/swift-test.yml index 6d2b5e5..4061291 100644 --- a/.github/workflows/swift-test.yml +++ b/.github/workflows/swift-test.yml @@ -7,37 +7,23 @@ on: branches: [ main ] jobs: - validate-linux-tests: - runs-on: macos-latest - steps: - - run: sudo xcode-select -s /Applications/Xcode_12.3.app/Contents/Developer - - uses: actions/checkout@v2 - - uses: actions/cache@v2.1.5 - with: - path: .build - key: ${{runner.os}}-${{github.repository}}-spm-${{hashFiles('**/Package.resolved')}} - restore-keys: | - ${{runner.os}}-${{github.repository}}-spm- - - name: Generate Linux Tests - run: swift test --generate-linuxmain - - name: Check for git differences - run: git diff --exit-code - test-spm: strategy: matrix: - os: [macos-latest] + os: [ macos-latest ] runs-on: ${{matrix.os}} steps: - - run: sudo xcode-select -s /Applications/Xcode_12.3.app/Contents/Developer - if: runner.os == 'macOS' + - if: runner.os == 'macOS' + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: ^12.4 - name: Install Swift if: runner.os == 'Linux' uses: sersoft-gmbh/SwiftyActions@v1 with: - release-version: 5.3.2 + release-version: 5.4 platform: ${{matrix.os}} - uses: actions/checkout@v2 - uses: actions/cache@v2.1.5 @@ -64,7 +50,7 @@ jobs: runs-on: macos-latest strategy: matrix: - action: [test] + action: [ test ] destination: - platform=macOS - platform=iOS Simulator,OS=latest,name=iPhone 11 Pro @@ -79,7 +65,9 @@ jobs: # parallel-testing-enabled: false # enable-code-coverage: false steps: - - run: sudo xcode-select -s /Applications/Xcode_12.3.app/Contents/Developer + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: ^12.4 - uses: actions/checkout@v2 - uses: sersoft-gmbh/xcodebuild-action@v1 with: diff --git a/Package.swift b/Package.swift index ea51577..b25919b 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.3 +// swift-tools-version:5.4 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription diff --git a/Package@swift-5.3.swift b/Package@swift-5.3.swift new file mode 100644 index 0000000..ea51577 --- /dev/null +++ b/Package@swift-5.3.swift @@ -0,0 +1,32 @@ +// swift-tools-version:5.3 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "apple-device-information", + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "DeviceInformation", + targets: ["DeviceInformation"]), + ], + dependencies: [ + .package(url: "https://github.com/sersoft-gmbh/swift-sysctl.git", from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "DeviceInformation", + dependencies: [ + .product(name: "Sysctl", package: "swift-sysctl"), + ]), + .testTarget( + name: "DeviceInformationTests", + dependencies: [ + .product(name: "Sysctl", package: "swift-sysctl"), + "DeviceInformation", + ]), + ] +)