Skip to content

Commit 500c9a0

Browse files
authored
Merge pull request #407 from mattrubin/modernize
Update project for modern Xcode, Swift, and iOS
2 parents 154b44a + c8a16be commit 500c9a0

File tree

87 files changed

+674
-398
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+674
-398
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "Prepare simulator"
2+
description: "Creates and boots a custom simulator"
3+
inputs:
4+
runtime:
5+
description: "Runtime name"
6+
required: true
7+
device:
8+
description: "Device name"
9+
required: true
10+
outputs:
11+
destination-id:
12+
description: "Destination simulator ID"
13+
value: ${{ steps.simulator.outputs.destination-id }}
14+
runs:
15+
using: composite
16+
steps:
17+
- name: "Print bundled runtimes"
18+
shell: bash
19+
run: |
20+
echo "::group::Bundled runtimes:"
21+
for xcode in /Applications/Xcode*.app; do \
22+
echo $xcode | grep -o "Xcode.*\.app"; \
23+
for plist in $xcode/Contents/Developer/Platforms/*.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/*.simruntime/Contents/Info.plist; do \
24+
defaults read $plist CFBundleName; \
25+
done; \
26+
echo ""; \
27+
done
28+
echo "::endgroup::"
29+
30+
- name: "Install runtime"
31+
shell: bash
32+
run: |
33+
RUNTIME="${{ inputs.runtime }}"
34+
if xcrun simctl list | grep "$RUNTIME"
35+
then
36+
echo "$RUNTIME is already installed.";
37+
else
38+
echo "::group::Available runtimes:"
39+
xcversion simulators
40+
echo "::endgroup::"
41+
xcversion simulators --install="$RUNTIME";
42+
fi
43+
44+
- name: "Create and boot simulator"
45+
id: simulator
46+
shell: bash
47+
run: |
48+
RUNTIME="${{ inputs.runtime }}"
49+
DEVICE="${{ inputs.device }}"
50+
DEVICE_ID=com.apple.CoreSimulator.SimDeviceType.$(echo $DEVICE | sed -E -e "s/[ \-]+/ /g" -e "s/[^[:alnum:]]/-/g")
51+
RUNTIME_ID=com.apple.CoreSimulator.SimRuntime.$(echo $RUNTIME | sed -E -e "s/[ \-]+/ /g" -e "s/[^[:alnum:]]/-/g")
52+
DESTINATION_ID=$(xcrun simctl create "Custom: $DEVICE, $RUNTIME" $DEVICE_ID $RUNTIME_ID)
53+
xcrun simctl boot $DESTINATION_ID
54+
echo "destination-id=$(echo $DESTINATION_ID)" >> $GITHUB_OUTPUT
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "Select Xcode version"
2+
description: "Selects the specified version of Xcode"
3+
inputs:
4+
version:
5+
description: "Version number"
6+
required: true
7+
runs:
8+
using: composite
9+
steps:
10+
- run: |
11+
echo "::group::Selecting Xcode ${{ inputs.version }}…"
12+
sudo xcode-select -s /Applications/Xcode_${{ inputs.version }}.app
13+
xcode-select -p
14+
echo "::endgroup::"
15+
shell: bash
16+
- run: |
17+
echo "::group::xcodebuild -version -sdk"
18+
xcodebuild -version -sdk
19+
echo "::endgroup::"
20+
shell: bash
21+
- run: |
22+
echo "::group::xcrun simctl list"
23+
xcrun simctl list
24+
echo "::endgroup::"
25+
shell: bash

.github/workflows/test.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build & Test
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
ios:
9+
name: "Build & Test (Xcode ${{ matrix.env.xcode }}, ${{ matrix.env.runtime }}, ${{ matrix.env.device }})"
10+
runs-on: macOS-12
11+
strategy:
12+
matrix:
13+
env:
14+
- xcode: 14.2
15+
runtime: "iOS 13.7"
16+
device: "iPhone 6s"
17+
- xcode: 14.2
18+
runtime: "iOS 14.5"
19+
device: "iPhone 8 Plus"
20+
- xcode: 14.2
21+
runtime: "iOS 15.4"
22+
device: "iPhone 12 mini"
23+
- xcode: 14.2
24+
runtime: "iOS 16.2"
25+
device: "iPhone 14 Pro Max"
26+
steps:
27+
- uses: actions/checkout@v3
28+
with:
29+
submodules: recursive
30+
- name: "Select Xcode ${{ matrix.env.xcode }}"
31+
uses: ./.github/actions/xcode-select
32+
with:
33+
version: ${{ matrix.env.xcode }}
34+
- name: "Cache downloaded simulator runtimes"
35+
uses: actions/cache@v3
36+
with:
37+
path: ~/Library/Caches/XcodeInstall/*.dmg
38+
key: Xcode ${{ matrix.env.xcode }}+${{ matrix.env.runtime }}
39+
- name: "Prepare simulator"
40+
id: prepare-simulator
41+
uses: ./.github/actions/prepare-simulator
42+
with:
43+
runtime: ${{ matrix.env.runtime }}
44+
device: ${{ matrix.env.device }}
45+
- name: "Build and test"
46+
run: |
47+
set -o pipefail
48+
xcodebuild test -workspace "Authenticator.xcworkspace" -scheme "Authenticator" -destination "id=${{ steps.prepare-simulator.outputs.destination-id }}" | xcpretty -c
49+
- uses: sersoft-gmbh/swift-coverage-action@v3
50+
with:
51+
target-name-filter: ^Authenticator$
52+
- uses: codecov/codecov-action@v3
53+
with:
54+
fail_ci_if_error: true

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
url = https://github.com/mattrubin/OneTimePassword.git
44
[submodule "Carthage/Checkouts/xcconfigs"]
55
path = Carthage/Checkouts/xcconfigs
6-
url = https://github.com/jspahrsummers/xcconfigs.git
6+
url = https://github.com/xcconfigs/xcconfigs.git
77
[submodule "Carthage/Checkouts/Base32"]
88
path = Carthage/Checkouts/Base32
99
url = https://github.com/mattrubin/Base32.git

.swiftlint.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ excluded:
55
- Carthage
66
- fastlane
77

8+
analyzer_rules:
9+
- unused_declaration
10+
- unused_import
11+
12+
disabled_rules:
13+
- for_where
14+
- identifier_name
15+
- line_length
16+
- todo
17+
818
opt_in_rules:
919
- array_init
1020
- attributes
@@ -28,7 +38,6 @@ opt_in_rules:
2838
- file_header
2939
- first_where
3040
- force_unwrapping
31-
- implicit_return
3241
- implicitly_unwrapped_optional
3342
- joined_default_parameter
3443
- last_where
@@ -50,7 +59,6 @@ opt_in_rules:
5059
- prohibited_super_call
5160
- reduce_into
5261
- redundant_nil_coalescing
53-
- redundant_type_annotation
5462
- single_test_class
5563
- sorted_first_last
5664
- static_operator
@@ -60,28 +68,17 @@ opt_in_rules:
6068
- unavailable_function
6169
- unowned_variable_capture
6270
- untyped_error_in_catch
63-
- unused_declaration
64-
- unused_import
6571
- vertical_parameter_alignment_on_call
6672
- vertical_whitespace_closing_braces
6773
- vertical_whitespace_opening_braces
6874
- xct_specific_matcher
6975
- yoda_condition
7076

71-
disabled_rules:
72-
- identifier_name
73-
- line_length
74-
- todo
75-
7677
cyclomatic_complexity:
77-
warning: 15
78+
warning: 16
7879

7980
function_body_length:
80-
warning: 50
81-
82-
line_length:
83-
ignores_function_declarations: true
84-
ignores_interpolated_strings: true
81+
warning: 55
8582

8683
nesting:
8784
type_level:

.travis.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

Authenticator.xcodeproj/project.pbxproj

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 46;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -46,6 +46,7 @@
4646
C9B7328F1C0A8AE60076F77E /* TokenListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9B7328E1C0A8AE60076F77E /* TokenListViewModel.swift */; };
4747
C9BA64EA1C0C4FBC00610C7C /* UITableView+ReusableCells.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9BA64E91C0C4FBC00610C7C /* UITableView+ReusableCells.swift */; };
4848
C9BEAE6019C67FD800533385 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C9BEAE5F19C67FD800533385 /* LaunchScreen.xib */; };
49+
C9C27228299946190067D723 /* ViewHierarchyHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9C27227299946190067D723 /* ViewHierarchyHelpers.swift */; };
4950
C9C6CCA21842E331000100C2 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C9C6CCA11842E331000100C2 /* Images.xcassets */; };
5051
C9CC09511BA903B7008C54FE /* TokenFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9CC09501BA903B7008C54FE /* TokenFormViewController.swift */; };
5152
C9CC09531BA9133B008C54FE /* FocusCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9CC09521BA9133B008C54FE /* FocusCell.swift */; };
@@ -117,7 +118,6 @@
117118
C92708AB19CFB0750033128B /* TokenListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenListViewController.swift; sourceTree = "<group>"; };
118119
C931A5FC1BFF6F9D00706A1C /* .hound.yml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .hound.yml; sourceTree = "<group>"; };
119120
C931A5FE1BFF6FA600706A1C /* .swiftlint.yml */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = text; path = .swiftlint.yml; sourceTree = "<group>"; usesTabs = 0; };
120-
C931A5FF1BFF6FA600706A1C /* .travis.yml */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = text; path = .travis.yml; sourceTree = "<group>"; usesTabs = 0; };
121121
C931A6021BFF707E00706A1C /* Cartfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cartfile; sourceTree = "<group>"; };
122122
C93AD15119CD51BE007480E9 /* Colors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Colors.swift; sourceTree = "<group>"; };
123123
C93BD6221C167CD100FFFB8F /* Root.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Root.swift; sourceTree = "<group>"; };
@@ -169,6 +169,7 @@
169169
C9B7328E1C0A8AE60076F77E /* TokenListViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenListViewModel.swift; sourceTree = "<group>"; };
170170
C9BA64E91C0C4FBC00610C7C /* UITableView+ReusableCells.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITableView+ReusableCells.swift"; sourceTree = "<group>"; };
171171
C9BEAE5F19C67FD800533385 /* LaunchScreen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LaunchScreen.xib; sourceTree = "<group>"; };
172+
C9C27227299946190067D723 /* ViewHierarchyHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewHierarchyHelpers.swift; sourceTree = "<group>"; };
172173
C9C6CCA11842E331000100C2 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
173174
C9CC09501BA903B7008C54FE /* TokenFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenFormViewController.swift; sourceTree = "<group>"; };
174175
C9CC09521BA9133B008C54FE /* FocusCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FocusCell.swift; sourceTree = "<group>"; };
@@ -298,7 +299,6 @@
298299
C96E60561DBC5F1B00484823 /* .codecov.yml */,
299300
C931A5FC1BFF6F9D00706A1C /* .hound.yml */,
300301
C931A5FE1BFF6FA600706A1C /* .swiftlint.yml */,
301-
C931A5FF1BFF6FA600706A1C /* .travis.yml */,
302302
);
303303
name = Tools;
304304
sourceTree = "<group>";
@@ -425,6 +425,7 @@
425425
CC471EEC1DC1377F006858AC /* MockTableView.swift */,
426426
CCCD668A1E1C74B4005FE96E /* OneTimePasswordExtensions.swift */,
427427
C99112691E2073710006A6C0 /* UITableViewUpdateTests.swift */,
428+
C9C27227299946190067D723 /* ViewHierarchyHelpers.swift */,
428429
);
429430
path = AuthenticatorTests;
430431
sourceTree = "<group>";
@@ -633,6 +634,7 @@
633634
/* Begin PBXShellScriptBuildPhase section */
634635
C910ADBF1BF00ABF00C988F5 /* Lint */ = {
635636
isa = PBXShellScriptBuildPhase;
637+
alwaysOutOfDate = 1;
636638
buildActionMask = 2147483647;
637639
files = (
638640
);
@@ -702,6 +704,7 @@
702704
isa = PBXSourcesBuildPhase;
703705
buildActionMask = 2147483647;
704706
files = (
707+
C9C27228299946190067D723 /* ViewHierarchyHelpers.swift in Sources */,
705708
C9E3FB9C1E2860DD00EFA8BB /* TokenScannerTests.swift in Sources */,
706709
CCCD668B1E1C74B4005FE96E /* OneTimePasswordExtensions.swift in Sources */,
707710
C991126A1E2073710006A6C0 /* UITableViewUpdateTests.swift in Sources */,
@@ -746,7 +749,6 @@
746749
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
747750
BUNDLE_DISPLAY_NAME = "${PRODUCT_NAME} ∆";
748751
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
749-
CURRENT_PROJECT_VERSION = 0;
750752
DEVELOPMENT_TEAM = WD7ETSN9J9;
751753
INFOPLIST_FILE = Authenticator/Resources/Info.plist;
752754
PRODUCT_BUNDLE_IDENTIFIER = me.mattrubin.authenticator.dev;
@@ -764,7 +766,6 @@
764766
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
765767
BUNDLE_DISPLAY_NAME = "${PRODUCT_NAME}";
766768
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
767-
CURRENT_PROJECT_VERSION = 0;
768769
DEVELOPMENT_TEAM = WD7ETSN9J9;
769770
INFOPLIST_FILE = Authenticator/Resources/Info.plist;
770771
PRODUCT_BUNDLE_IDENTIFIER = me.mattrubin.authenticator;
@@ -780,13 +781,15 @@
780781
baseConfigurationReference = C944A56A1A7F772600E08B1E /* Debug.xcconfig */;
781782
buildSettings = {
782783
CLANG_MODULES_AUTOLINK = YES;
784+
CURRENT_PROJECT_VERSION = 0;
783785
FRAMEWORK_SEARCH_PATHS = (
784786
"$(inherited)",
785787
"$(BUILT_PRODUCTS_DIR)",
786788
);
787789
GCC_DYNAMIC_NO_PIC = NO;
788-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
789-
SWIFT_VERSION = 4.0;
790+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
791+
MARKETING_VERSION = 2023.1;
792+
SWIFT_VERSION = 5.0;
790793
};
791794
name = Debug;
792795
};
@@ -795,13 +798,15 @@
795798
baseConfigurationReference = C944A56C1A7F772600E08B1E /* Release.xcconfig */;
796799
buildSettings = {
797800
CLANG_MODULES_AUTOLINK = YES;
801+
CURRENT_PROJECT_VERSION = 0;
798802
FRAMEWORK_SEARCH_PATHS = (
799803
"$(inherited)",
800804
"$(BUILT_PRODUCTS_DIR)",
801805
);
802806
GCC_DYNAMIC_NO_PIC = NO;
803-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
804-
SWIFT_VERSION = 4.0;
807+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
808+
MARKETING_VERSION = 2023.1;
809+
SWIFT_VERSION = 5.0;
805810
};
806811
name = Release;
807812
};

0 commit comments

Comments
 (0)