Skip to content

Commit

Permalink
Merge pull request #271 from mattrubin/modernize
Browse files Browse the repository at this point in the history
Modernize for Xcode 15.4 and Swift 5.10
  • Loading branch information
mattrubin authored Aug 19, 2024
2 parents 66f284e + 79a812f commit b00df04
Show file tree
Hide file tree
Showing 20 changed files with 90 additions and 102 deletions.
21 changes: 4 additions & 17 deletions .github/actions/prepare-simulator/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,6 @@ outputs:
runs:
using: composite
steps:
- name: "Print bundled runtimes"
shell: bash
run: |
echo "::group::Bundled runtimes:"
for xcode in /Applications/Xcode*.app; do \
echo $xcode | grep -o "Xcode.*\.app"; \
for plist in $xcode/Contents/Developer/Platforms/*.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/*.simruntime/Contents/Info.plist; do \
defaults read $plist CFBundleName; \
done; \
echo ""; \
done
echo "::endgroup::"
- name: "Install runtime"
shell: bash
run: |
Expand All @@ -36,9 +23,9 @@ runs:
echo "$RUNTIME is already installed.";
else
echo "::group::Available runtimes:"
xcversion simulators
xcodes runtimes
echo "::endgroup::"
xcversion simulators --install="$RUNTIME";
sudo xcodes runtimes install "$RUNTIME" --keep-archive;
fi
- name: "Create and boot simulator"
Expand All @@ -47,8 +34,8 @@ runs:
run: |
RUNTIME="${{ inputs.runtime }}"
DEVICE="${{ inputs.device }}"
DEVICE_ID=com.apple.CoreSimulator.SimDeviceType.$(echo $DEVICE | sed -E -e "s/[ \-]+/ /g" -e "s/[^[:alnum:]]/-/g")
RUNTIME_ID=com.apple.CoreSimulator.SimRuntime.$(echo $RUNTIME | sed -E -e "s/[ \-]+/ /g" -e "s/[^[:alnum:]]/-/g")
DEVICE_ID=com.apple.CoreSimulator.SimDeviceType.$(echo $DEVICE | sed -E -e "s/[ \-]+/ /g" -e "s/[\(\)]//g" -e "s/[^[:alnum:]]/-/g")
RUNTIME_ID=com.apple.CoreSimulator.SimRuntime.$(echo $RUNTIME | sed -E -e "s/[ \-]+/ /g" -e "s/[\(\)]//g" -e "s/[^[:alnum:]]/-/g")
DESTINATION_ID=$(xcrun simctl create "Custom: $DEVICE, $RUNTIME" $DEVICE_ID $RUNTIME_ID)
xcrun simctl boot $DESTINATION_ID
echo "destination-id=$(echo $DESTINATION_ID)" >> $GITHUB_OUTPUT
6 changes: 3 additions & 3 deletions .github/workflows/carthage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ on: [push]
jobs:
carthage:
name: "Xcode ${{ matrix.env.xcode }}"
runs-on: macOS-12
runs-on: macOS-14
strategy:
matrix:
env:
- xcode: 13.4
- xcode: 15.4
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- name: "Upgrade Carthage"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/spm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ on: [push]
jobs:
spm:
name: "Xcode ${{ matrix.env.xcode }}"
runs-on: macOS-12
runs-on: macOS-14
strategy:
matrix:
env:
- xcode: 13.4
- xcode: 15.4
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: "Select Xcode ${{ matrix.env.xcode }}"
uses: ./.github/actions/xcode-select
with:
Expand Down
57 changes: 29 additions & 28 deletions .github/workflows/xcode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ on: [push]
jobs:
ios:
name: "Xcode ${{ matrix.env.xcode }}, ${{ matrix.env.runtime }}, ${{ matrix.env.device }}"
runs-on: macOS-12
runs-on: macOS-14
strategy:
matrix:
env:
- xcode: 13.4
- xcode: 15.4
runtime: "iOS 17.5"
device: "iPhone 15 Pro Max"
- xcode: 15.4
runtime: "iOS 16.4"
device: "iPhone 12 mini"
- xcode: 15.4
runtime: "iOS 15.5"
device: "iPhone 13 Pro"
- xcode: 13.4
runtime: "iOS 14.5"
device: "iPhone 12 Pro Max"
- xcode: 13.4
runtime: "iOS 13.7"
device: "iPhone 11"
device: "iPhone SE"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- name: "Select Xcode ${{ matrix.env.xcode }}"
uses: ./.github/actions/xcode-select
with:
version: ${{ matrix.env.xcode }}
- name: "Cache downloaded simulator runtimes"
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/Library/Caches/XcodeInstall/*.dmg
path: ~/Downloads/*.dmg
key: Xcode ${{ matrix.env.xcode }}+${{ matrix.env.runtime }}
- name: "Prepare simulator"
id: prepare-simulator
Expand All @@ -40,41 +40,42 @@ jobs:
- name: "Build and test"
run: |
set -o pipefail
xcodebuild test -workspace "OneTimePassword.xcworkspace" -scheme "OneTimePassword (iOS)" -destination "id=${{ steps.prepare-simulator.outputs.destination-id }}" | xcpretty -c
- uses: sersoft-gmbh/swift-coverage-action@v3
xcodebuild test -project "OneTimePassword.xcodeproj" -scheme "OneTimePassword (iOS)" -destination "id=${{ steps.prepare-simulator.outputs.destination-id }}" | xcpretty -c
- uses: sersoft-gmbh/swift-coverage-action@v4
with:
target-name-filter: ^OneTimePassword$
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true

watchos:
name: "Xcode ${{ matrix.env.xcode }}, ${{ matrix.env.runtime }}, ${{ matrix.env.device }}"
runs-on: macOS-12
runs-on: macOS-14
strategy:
matrix:
env:
- xcode: 13.4
- xcode: 15.4
runtime: "watchOS 10.5"
device: "Apple Watch Ultra 2 (49mm)"
- xcode: 15.4
runtime: "watchOS 9.4"
device: "Apple Watch SE (44mm) (2nd generation)"
- xcode: 15.4
runtime: "watchOS 8.5"
device: "Apple Watch Series 7 - 45mm"
- xcode: 13.4
runtime: "watchOS 7.4"
device: "Apple Watch Series 6 - 44mm"
- xcode: 13.4
runtime: "watchOS 6.2"
device: "Apple Watch Series 4 - 40mm"
device: "Apple Watch Series 3 (38mm)"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- name: "Select Xcode ${{ matrix.env.xcode }}"
uses: ./.github/actions/xcode-select
with:
version: ${{ matrix.env.xcode }}
- name: "Cache downloaded simulator runtimes"
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/Library/Caches/XcodeInstall/*.dmg
path: ~/Downloads/*.dmg
key: Xcode ${{ matrix.env.xcode }}+${{ matrix.env.runtime }}
- name: "Prepare simulator"
id: prepare-simulator
Expand All @@ -85,4 +86,4 @@ jobs:
- name: "Build"
run: |
set -o pipefail
xcodebuild build -workspace "OneTimePassword.xcworkspace" -scheme "OneTimePassword (watchOS)" -destination "id=${{ steps.prepare-simulator.outputs.destination-id }}" | xcpretty -c
xcodebuild build -project "OneTimePassword.xcodeproj" -scheme "OneTimePassword (watchOS)" -destination "id=${{ steps.prepare-simulator.outputs.destination-id }}" | xcpretty -c
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "Carthage/Checkouts/Base32"]
path = Carthage/Checkouts/Base32
url = https://github.com/mattrubin/Base32.git
[submodule "Carthage/Checkouts/xcconfigs"]
path = Carthage/Checkouts/xcconfigs
url = https://github.com/xcconfigs/xcconfigs.git
8 changes: 5 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ Please note that this project is released with a [Contributor Code of Conduct][c
git submodule update --init --recursive
```

3. Open the `OneTimePassword.xcworkspace` file.
> If you open the `.xcodeproj` instead, the project will not be able to find its dependencies.
3. Open the `OneTimePassword.xcodeproj` file.

4. Build and run the "OneTimePassword" scheme.


## Managing Dependencies

OneTimePassword uses [Carthage][] to manage its dependencies, but it does not currently use Carthage to build those dependencies. The dependent projects are checked out as submodules, are included in `OneTimePassword.xcworkspace`, and are built by Xcode as target dependencies of the OneTimePassword framework.
OneTimePassword's source dependencies are [Xcode-managed package dependencies][package dependencies].

Additionally, [Carthage][] is used to manage the project's dependency on shared build configuration files. The dependent project is checked out as a submodule.

To check out the dependencies, simply follow the "Getting Started" instructions above.

Expand All @@ -46,5 +47,6 @@ To update the dependencies, modify the [Cartfile][] and run:
carthage update --no-build --use-submodules
```

[package dependencies]: https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app
[Carthage]: https://github.com/Carthage/Carthage
[Cartfile]: https://github.com/mattrubin/OneTimePassword/blob/develop/Cartfile
3 changes: 0 additions & 3 deletions Cartfile

This file was deleted.

1 change: 0 additions & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
github "mattrubin/Base32" "1.2.0"
github "xcconfigs/xcconfigs" "1.1"
1 change: 0 additions & 1 deletion Carthage/Checkouts/Base32
Submodule Base32 deleted from 638954
1 change: 1 addition & 0 deletions Configuration/OneTimePassword.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ INFOPLIST_FILE = Sources/Info.plist;

DEAD_CODE_STRIPPING = YES;
SWIFT_INSTALL_OBJC_HEADER = NO;
DEFINES_MODULE = NO;
53 changes: 37 additions & 16 deletions OneTimePassword.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
5B39F49F1DBD06F500CD2DAB /* Token+URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC7EC3196BD5DF00B50C82 /* Token+URL.swift */; };
5B39F4A01DBD06F900CD2DAB /* PersistentToken.swift in Sources */ = {isa = PBXBuildFile; fileRef = C95F9FB81C03D6BC00CEA286 /* PersistentToken.swift */; };
5B39F4A11DBD06FC00CD2DAB /* Keychain.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9003417196F7046009733E8 /* Keychain.swift */; };
5B39F4A51DBD08A900CD2DAB /* Base32.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C944A55E1A7EDAE200E08B1E /* Base32.framework */; };
C9003418196F7046009733E8 /* Keychain.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9003417196F7046009733E8 /* Keychain.swift */; };
C9290C301947D104008AE4DE /* TokenSerializationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9290C2F1947D104008AE4DE /* TokenSerializationTests.swift */; };
C93A251A196B1BA400F86892 /* Token.swift in Sources */ = {isa = PBXBuildFile; fileRef = C93A2519196B1BA400F86892 /* Token.swift */; };
C944A55F1A7EDAE200E08B1E /* Base32.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C944A55E1A7EDAE200E08B1E /* Base32.framework */; };
C94B2007197774A20014A202 /* TokenTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C94B2006197774A20014A202 /* TokenTests.swift */; };
C95B10CC196D22B9000840AA /* GeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C95B10CB196D22B9000840AA /* GeneratorTests.swift */; };
C95F9FB91C03D6BC00CEA286 /* PersistentToken.swift in Sources */ = {isa = PBXBuildFile; fileRef = C95F9FB81C03D6BC00CEA286 /* PersistentToken.swift */; };
C97C82441946E51D00FD9F4C /* OneTimePassword.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C97C82381946E51D00FD9F4C /* OneTimePassword.framework */; };
C99262CC29558ABA00C96BDF /* Base32 in Frameworks */ = {isa = PBXBuildFile; productRef = C99262CB29558ABA00C96BDF /* Base32 */; };
C99262CE29558AE600C96BDF /* Base32 in Frameworks */ = {isa = PBXBuildFile; productRef = C99262CD29558AE600C96BDF /* Base32 */; };
C9B2A19C199A7F1B00BC4A8A /* EquatableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9B2A19B199A7F1B00BC4A8A /* EquatableTests.swift */; };
C9B77D771C03078B00BAF6BF /* KeychainTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C93A2514196AFE1100F86892 /* KeychainTests.swift */; };
C9DC7EC4196BD5DF00B50C82 /* Token+URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9DC7EC3196BD5DF00B50C82 /* Token+URL.swift */; };
Expand Down Expand Up @@ -94,7 +94,6 @@
C93CC01C1DCBB875006255FA /* OneTimePasswordTests-iOS.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "OneTimePasswordTests-iOS.xcconfig"; sourceTree = "<group>"; };
C93CC01E1DCBBDE7006255FA /* OneTimePassword.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = OneTimePassword.xcconfig; sourceTree = "<group>"; };
C93CC0211DCBC189006255FA /* OneTimePasswordTests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = OneTimePasswordTests.xcconfig; sourceTree = "<group>"; };
C944A55E1A7EDAE200E08B1E /* Base32.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Base32.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C94765061C64587800C7527E /* Cartfile.private */ = {isa = PBXFileReference; lastKnownFileType = text; path = Cartfile.private; sourceTree = "<group>"; };
C94B2006197774A20014A202 /* TokenTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenTests.swift; sourceTree = "<group>"; };
C94B9BC81BD7270E0073D7C5 /* LICENSE.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = LICENSE.md; sourceTree = "<group>"; };
Expand All @@ -114,7 +113,6 @@
C9B2A19B199A7F1B00BC4A8A /* EquatableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EquatableTests.swift; sourceTree = "<group>"; };
C9B84D1C1C015EC0002EE631 /* .hound.yml */ = {isa = PBXFileReference; indentWidth = 2; lastKnownFileType = text; path = .hound.yml; sourceTree = "<group>"; };
C9B84D1D1C015EC0002EE631 /* .swiftlint.yml */ = {isa = PBXFileReference; indentWidth = 2; lastKnownFileType = text; path = .swiftlint.yml; sourceTree = "<group>"; };
C9B84D1F1C015EC8002EE631 /* Cartfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Cartfile; sourceTree = "<group>"; };
C9DC7EC3196BD5DF00B50C82 /* Token+URL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Token+URL.swift"; sourceTree = "<group>"; };
C9DC7EC7196BDF3B00B50C82 /* Generator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Generator.swift; sourceTree = "<group>"; };
C9E829531C62DFDA003F5FC9 /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = CHANGELOG.md; sourceTree = "<group>"; };
Expand All @@ -132,15 +130,15 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
5B39F4A51DBD08A900CD2DAB /* Base32.framework in Frameworks */,
C99262CE29558AE600C96BDF /* Base32 in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
C97C82341946E51D00FD9F4C /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C944A55F1A7EDAE200E08B1E /* Base32.framework in Frameworks */,
C99262CC29558ABA00C96BDF /* Base32 in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -155,14 +153,6 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
746E7166AD60449882DD84C7 /* Frameworks */ = {
isa = PBXGroup;
children = (
C944A55E1A7EDAE200E08B1E /* Base32.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
C9307A8619A8522F00609B02 /* Serialization */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -202,7 +192,6 @@
children = (
C97C823A1946E51D00FD9F4C /* Sources */,
C97C82471946E51D00FD9F4C /* Tests */,
746E7166AD60449882DD84C7 /* Frameworks */,
C996EC281A74D5830076B105 /* Configuration */,
C97C82391946E51D00FD9F4C /* Products */,
C9B84D1B1C015EA2002EE631 /* Tools */,
Expand Down Expand Up @@ -299,7 +288,6 @@
isa = PBXGroup;
children = (
49403AEA23D3778400539BD3 /* Package.swift */,
C9B84D1F1C015EC8002EE631 /* Cartfile */,
C94765061C64587800C7527E /* Cartfile.private */,
C9619C5C1D73FB3500757587 /* .codecov.yml */,
C9B84D1C1C015EC0002EE631 /* .hound.yml */,
Expand Down Expand Up @@ -334,6 +322,9 @@
dependencies = (
);
name = "OneTimePassword (watchOS)";
packageProductDependencies = (
C99262CD29558AE600C96BDF /* Base32 */,
);
productName = "OneTimePassword (watchOS)";
productReference = 5B39F4941DBD06BA00CD2DAB /* OneTimePassword.framework */;
productType = "com.apple.product-type.framework";
Expand All @@ -350,6 +341,9 @@
dependencies = (
);
name = "OneTimePassword (iOS)";
packageProductDependencies = (
C99262CB29558ABA00C96BDF /* Base32 */,
);
productName = "OneTimePassword (iOS)";
productReference = C97C82381946E51D00FD9F4C /* OneTimePassword.framework */;
productType = "com.apple.product-type.framework";
Expand Down Expand Up @@ -436,6 +430,9 @@
Base,
);
mainGroup = C97C822E1946E51D00FD9F4C;
packageReferences = (
C99262CA29558ABA00C96BDF /* XCRemoteSwiftPackageReference "Base32" */,
);
productRefGroup = C97C82391946E51D00FD9F4C /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -700,6 +697,30 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
C99262CA29558ABA00C96BDF /* XCRemoteSwiftPackageReference "Base32" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/mattrubin/Base32.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.2.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
C99262CB29558ABA00C96BDF /* Base32 */ = {
isa = XCSwiftPackageProductDependency;
package = C99262CA29558ABA00C96BDF /* XCRemoteSwiftPackageReference "Base32" */;
productName = Base32;
};
C99262CD29558AE600C96BDF /* Base32 */ = {
isa = XCSwiftPackageProductDependency;
package = C99262CA29558ABA00C96BDF /* XCRemoteSwiftPackageReference "Base32" */;
productName = Base32;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = C97C822F1946E51D00FD9F4C /* Project object */;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1540"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Loading

0 comments on commit b00df04

Please sign in to comment.