Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 90 additions & 47 deletions .github/workflows/Options.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: macOS

on:
push:
branches-ignore:
- '*WIP'

env:
PACKAGE_NAME: Options
jobs:
build-ubuntu:
name: Build on Ubuntu
Expand All @@ -16,34 +16,36 @@ jobs:
strategy:
matrix:
runs-on: [ubuntu-20.04, ubuntu-22.04]
swift-version: ["5.9.2", "5.10"]
swift-version: ["5.7.1", "5.8.1", "5.9", "5.9.2", "5.10"]
steps:
- uses: actions/checkout@v4
- name: Set Ubuntu Release DOT
run: echo "RELEASE_DOT=$(lsb_release -sr)" >> $GITHUB_ENV
- name: Set Ubuntu Release NUM
run: echo "RELEASE_NUM=${RELEASE_DOT//[-._]/}" >> $GITHUB_ENV
- name: Set Ubuntu Codename
run: echo "RELEASE_NAME=$(lsb_release -sc)" >> $GITHUB_ENV
- name: Cache swift package modules
id: cache-spm-linux
uses: actions/cache@v4
env:
cache-name: SPM
cache-name: cache-spm
with:
path: .build
key: ${{ env.cache-name }}-${{ runner.os }}-${{ env.SWIFT_VER }}-${{ hashFiles('Package.resolved') }}-${{ env.RELEASE_DOT }}
key: ${{ runner.os }}-${{ env.RELEASE_DOT }}-${{ env.cache-name }}-${{ matrix.swift-version }}-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ env.cache-name }}-${{ runner.os }}-${{ env.SWIFT_VER }}-${{ hashFiles('Package.resolved') }}
${{ env.cache-name }}-${{ runner.os }}-${{ env.SWIFT_VER }}
- name: Set Ubuntu Release DOT
run: echo "RELEASE_DOT=$(lsb_release -sr)" >> $GITHUB_ENV
- name: Set Ubuntu Release NUM
run: echo "RELEASE_NUM=${RELEASE_DOT//[-._]/}" >> $GITHUB_ENV
- name: Set Ubuntu Codename
run: echo "RELEASE_NAME=$(lsb_release -sc)" >> $GITHUB_ENV
${{ runner.os }}-${{ env.RELEASE_DOT }}-${{ env.cache-name }}-${{ matrix.swift-version }}-
${{ runner.os }}-${{ env.RELEASE_DOT }}-${{ env.cache-name }}-
- name: Cache swift
id: cache-swift-linux
uses: actions/cache@v4
env:
cache-name: swift
cache-name: cache-swift
with:
path: swift-${{ env.SWIFT_VER }}-RELEASE-ubuntu${{ env.RELEASE_DOT }}
key: ${{ env.cache-name }}-${{ runner.os }}-${{ env.SWIFT_VER }}-${{ env.RELEASE_DOT }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.swift-version }}-${{ env.RELEASE_DOT }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ matrix.swift-version }}-
- name: Download Swift
if: steps.cache-swift-linux.outputs.cache-hit != 'true'
run: curl -O https://download.swift.org/swift-${SWIFT_VER}-release/ubuntu${RELEASE_NUM}/swift-${SWIFT_VER}-RELEASE/swift-${SWIFT_VER}-RELEASE-ubuntu${RELEASE_DOT}.tar.gz
Expand All @@ -52,29 +54,65 @@ jobs:
run: tar xzf swift-${SWIFT_VER}-RELEASE-ubuntu${RELEASE_DOT}.tar.gz
- name: Add Path
run: echo "$GITHUB_WORKSPACE/swift-${SWIFT_VER}-RELEASE-ubuntu${RELEASE_DOT}/usr/bin" >> $GITHUB_PATH
- name: Build
run: swift build
- name: Test
run: swift test --enable-code-coverage
run: swift test --enable-code-coverage
- uses: sersoft-gmbh/swift-coverage-action@v4
id: coverage-files
with:
fail-on-empty-output: true
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: spm,${{ env.RELEASE_NAME }},${{ env.SWIFT_VER }}
fail_ci_if_error: true
flags: swift-${{ matrix.swift-version }},ubuntu-${{ matrix.RELEASE_DOT }}
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }}
build-macos:
name: Build on macOS
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, 'ci skip')"
env:
PACKAGE_NAME: Options
SWIFT_VER: ${{ matrix.swift-version }}
runs-on: ${{ matrix.runs-on }}
if: "!contains(github.event.head_commit.message, 'ci skip')"
strategy:
matrix:
runs-on: ["macos-12"]
xcode: ["/Applications/Xcode_14.1.app","/Applications/Xcode_14.2.app"]
include:
- xcode: "/Applications/Xcode_14.1.app"
os: macos-12
iOSVersion: "16.1"
watchOSVersion: "9.0"
watchName: "Apple Watch Series 5 - 40mm"
iPhoneName: "iPhone 12 mini"
- xcode: "/Applications/Xcode_14.2.app"
os: macos-12
iOSVersion: "16.2"
watchOSVersion: "9.1"
watchName: "Apple Watch Ultra (49mm)"
iPhoneName: "iPhone 14"
- xcode: "/Applications/Xcode_15.0.1.app"
os: macos-13
iOSVersion: "17.0.1"
watchOSVersion: "10.0"
watchName: "Apple Watch Series 9 (41mm)"
iPhoneName: "iPhone 15"
- xcode: "/Applications/Xcode_15.1.app"
os: macos-13
iOSVersion: "17.2"
watchOSVersion: "10.2"
watchName: "Apple Watch Series 9 (45mm)"
iPhoneName: "iPhone 15 Plus"
- xcode: "/Applications/Xcode_15.2.app"
os: macos-14
iOSVersion: "17.2"
watchOSVersion: "10.2"
watchName: "Apple Watch Ultra (49mm)"
iPhoneName: "iPhone 15 Pro"
- xcode: "/Applications/Xcode_15.3.app"
os: macos-14
iOSVersion: "17.4"
watchOSVersion: "10.4"
watchName: "Apple Watch Ultra 2 (49mm)"
iPhoneName: "iPhone 15 Pro Max"
steps:
- uses: actions/checkout@v4
- name: Cache swift package modules
Expand All @@ -84,13 +122,11 @@ jobs:
cache-name: cache-spm
with:
path: .build
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Package.resolved') }}
key: ${{ matrix.os }}-build-${{ env.cache-name }}-${{ matrix.xcode }}-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
${{ matrix.os }}-build-${{ env.cache-name }}-${{ matrix.xcode }}-
- name: Cache mint
if: ${{ github.event_name == 'pull_request' && ( github.base_ref == 'main' || endsWith( github.ref_name , 'Prep') ) && matrix.xcode == '/Applications/Xcode_15.2.app' }}
if: startsWith(matrix.xcode,'/Applications/Xcode_15.3')
id: cache-mint
uses: actions/cache@v4
env:
Expand All @@ -107,7 +143,7 @@ jobs:
- name: Setup Xcode
run: sudo xcode-select -s ${{ matrix.xcode }}/Contents/Developer
- name: Install mint
if: ${{ github.event_name == 'pull_request' && ( github.base_ref == 'main' || endsWith( github.ref_name , 'Prep') ) && matrix.xcode == '/Applications/Xcode_15.2.app' }}
if: startsWith(matrix.xcode,'/Applications/Xcode_15.3')
run: |
brew update
brew install mint
Expand All @@ -116,41 +152,48 @@ jobs:
- name: Run Swift Package tests
run: swift test --enable-code-coverage
- uses: sersoft-gmbh/swift-coverage-action@v4
id: coverage-files-spm
with:
fail-on-empty-output: true
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
files: ${{ join(fromJSON(steps.coverage-files-spm.outputs.files), ',') }}
token: ${{ secrets.CODECOV_TOKEN }}
flags: macOS,${{ env.XCODE_NAME }},${{ matrix.runs-on }}
- name: Clean up spm build directory
run: rm -rf .build
- name: Lint
run: ./scripts/lint.sh
if: ${{ github.event_name == 'pull_request' && ( github.base_ref == 'main' || endsWith( github.ref_name , 'Prep') ) && matrix.xcode == '/Applications/Xcode_15.2.app' }}
if: startsWith(matrix.xcode,'/Applications/Xcode_15.3')
# - name: Run iOS target tests
# run: xcodebuild test -scheme ${{ env.PACKAGE_NAME }} -sdk iphonesimulator -destination 'platform=iOS Simulator,name=${{ matrix.iPhoneName }},OS=${{ matrix.iOSVersion }}' -enableCodeCoverage YES build test
# run: xcodebuild test -scheme ${{ env.PACKAGE_NAME }} -sdk "iphonesimulator" -destination 'platform=iOS Simulator,name=${{ matrix.iPhoneName }},OS=${{ matrix.iOSVersion }}' -enableCodeCoverage YES build test
# - uses: sersoft-gmbh/swift-coverage-action@v4
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v4
# env:
# token: ${{ secrets.CODECOV_TOKEN }}
# id: coverage-files-iOS
# with:
# fail-on-empty-output: true
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# fail_ci_if_error: true
# verbose: true
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ${{ join(fromJSON(steps.coverage-files-iOS.outputs.files), ',') }}
# flags: iOS,iOS${{ matrix.iOSVersion }},macOS,${{ env.XCODE_NAME }}
# - name: Run watchOS target tests
# run: xcodebuild test -scheme ${{ env.PACKAGE_NAME }} -sdk watchsimulator -destination 'platform=watchOS Simulator,name=${{ matrix.watchName }},OS=${{ matrix.watchOSVersion }}' -enableCodeCoverage YES build test
# run: xcodebuild test -scheme ${{ env.PACKAGE_NAME }} -sdk "watchsimulator" -destination 'platform=watchOS Simulator,name=${{ matrix.watchName }},OS=${{ matrix.watchOSVersion }}' -enableCodeCoverage YES build test
# - uses: sersoft-gmbh/swift-coverage-action@v4
# id: coverage-files-watchOS
# with:
# fail-on-empty-output: true
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v4
# env:
# token: ${{ secrets.CODECOV_TOKEN }}
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: true
# verbose: true
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ${{ join(fromJSON(steps.coverage-files-watchOS.outputs.files), ',') }}
# flags: watchOS,watchOS${{ matrix.watchOSVersion }},macOS,${{ env.XCODE_NAME }}
# - name: Test Again
# run: swift test
build-self:
name: Build on Self-Hosting macOS
runs-on: [self-hosted, macOS]
Expand Down
14 changes: 0 additions & 14 deletions Package.resolved

This file was deleted.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.7.1
// swift-tools-version: 5.7.1

// swiftlint:disable explicit_top_level_acl
// swiftlint:disable prefixed_toplevel_constant
Expand Down
14 changes: 10 additions & 4 deletions Package@swift-5.9.swift → Package@swift-5.10.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.9
// swift-tools-version: 5.10

// swiftlint:disable explicit_top_level_acl
// swiftlint:disable prefixed_toplevel_constant
Expand All @@ -15,13 +15,19 @@ let swiftSettings = [
SwiftSetting.enableUpcomingFeature("ImplicitOpenExistentials"),
SwiftSetting.enableUpcomingFeature("StrictConcurrency"),
SwiftSetting.enableUpcomingFeature("DisableOutwardActorInference"),
SwiftSetting.enableExperimentalFeature("StrictConcurrency"),
SwiftSetting.unsafeFlags(["-warn-concurrency", "-enable-actor-data-race-checks"])
SwiftSetting.enableExperimentalFeature("StrictConcurrency")
]

let package = Package(
name: "Options",
platforms: [.macOS(.v10_15)],
platforms: [
.macOS(.v10_15),
.iOS(.v13),
.tvOS(.v13),
.watchOS(.v6),
.macCatalyst(.v13),
.visionOS(.v1)
],
products: [
.library(
name: "Options",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// MappedValueCollectionRepresented.swift
// Array.swift
// SimulatorServices
//
// Created by Leo Dion.
Expand Down Expand Up @@ -30,9 +30,7 @@
// swiftlint:disable:next line_length
@available(*, deprecated, renamed: "MappedValueGenericRepresented", message: "Use MappedValueGenericRepresented instead.")
public protocol MappedValueCollectionRepresented: MappedValueGenericRepresented
where MappedValueType: Sequence {
/// An array of the mapped values which lines up with each case.
}
where MappedValueType: Sequence {}

extension Array: MappedValues where Element: Equatable {
public func key(value: Element) throws -> Int {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// MappedValueDictionaryRepresented.swift
// Dictionary.swift
// SimulatorServices
//
// Created by Leo Dion.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Options/Macro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import Foundation

#if swift(>=5.9)
#if swift(>=5.10)
@attached(
extension,
conformances: MappedValueRepresentable, MappedValueGenericRepresented,
Expand Down
4 changes: 2 additions & 2 deletions Sources/Options/MappedValueRepresentableError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
import Foundation

// swiftlint:disable file_types_order
#if swift(>=5.9)
#if swift(>=5.10)
/// An Error thrown when the `MappedType` value or `RawType` value
/// are invalid for an `Enum`.
public enum MappedValueRepresentableError: Error {
public enum MappedValueRepresentableError: Error, Sendable {
case valueNotFound
}
#else
Expand Down
37 changes: 0 additions & 37 deletions Tests/LinuxMain.swift

This file was deleted.

Loading