Skip to content

Commit

Permalink
Merge pull request #407 from mattrubin/modernize
Browse files Browse the repository at this point in the history
Update project for modern Xcode, Swift, and iOS
  • Loading branch information
mattrubin authored Feb 12, 2023
2 parents 154b44a + c8a16be commit 500c9a0
Show file tree
Hide file tree
Showing 87 changed files with 674 additions and 398 deletions.
54 changes: 54 additions & 0 deletions .github/actions/prepare-simulator/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "Prepare simulator"
description: "Creates and boots a custom simulator"
inputs:
runtime:
description: "Runtime name"
required: true
device:
description: "Device name"
required: true
outputs:
destination-id:
description: "Destination simulator ID"
value: ${{ steps.simulator.outputs.destination-id }}
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: |
RUNTIME="${{ inputs.runtime }}"
if xcrun simctl list | grep "$RUNTIME"
then
echo "$RUNTIME is already installed.";
else
echo "::group::Available runtimes:"
xcversion simulators
echo "::endgroup::"
xcversion simulators --install="$RUNTIME";
fi
- name: "Create and boot simulator"
id: simulator
shell: bash
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")
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
25 changes: 25 additions & 0 deletions .github/actions/xcode-select/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Select Xcode version"
description: "Selects the specified version of Xcode"
inputs:
version:
description: "Version number"
required: true
runs:
using: composite
steps:
- run: |
echo "::group::Selecting Xcode ${{ inputs.version }}…"
sudo xcode-select -s /Applications/Xcode_${{ inputs.version }}.app
xcode-select -p
echo "::endgroup::"
shell: bash
- run: |
echo "::group::xcodebuild -version -sdk"
xcodebuild -version -sdk
echo "::endgroup::"
shell: bash
- run: |
echo "::group::xcrun simctl list"
xcrun simctl list
echo "::endgroup::"
shell: bash
54 changes: 54 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build & Test

on:
- push
- pull_request

jobs:
ios:
name: "Build & Test (Xcode ${{ matrix.env.xcode }}, ${{ matrix.env.runtime }}, ${{ matrix.env.device }})"
runs-on: macOS-12
strategy:
matrix:
env:
- xcode: 14.2
runtime: "iOS 13.7"
device: "iPhone 6s"
- xcode: 14.2
runtime: "iOS 14.5"
device: "iPhone 8 Plus"
- xcode: 14.2
runtime: "iOS 15.4"
device: "iPhone 12 mini"
- xcode: 14.2
runtime: "iOS 16.2"
device: "iPhone 14 Pro Max"
steps:
- uses: actions/checkout@v3
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
with:
path: ~/Library/Caches/XcodeInstall/*.dmg
key: Xcode ${{ matrix.env.xcode }}+${{ matrix.env.runtime }}
- name: "Prepare simulator"
id: prepare-simulator
uses: ./.github/actions/prepare-simulator
with:
runtime: ${{ matrix.env.runtime }}
device: ${{ matrix.env.device }}
- name: "Build and test"
run: |
set -o pipefail
xcodebuild test -workspace "Authenticator.xcworkspace" -scheme "Authenticator" -destination "id=${{ steps.prepare-simulator.outputs.destination-id }}" | xcpretty -c
- uses: sersoft-gmbh/swift-coverage-action@v3
with:
target-name-filter: ^Authenticator$
- uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
url = https://github.com/mattrubin/OneTimePassword.git
[submodule "Carthage/Checkouts/xcconfigs"]
path = Carthage/Checkouts/xcconfigs
url = https://github.com/jspahrsummers/xcconfigs.git
url = https://github.com/xcconfigs/xcconfigs.git
[submodule "Carthage/Checkouts/Base32"]
path = Carthage/Checkouts/Base32
url = https://github.com/mattrubin/Base32.git
Expand Down
27 changes: 12 additions & 15 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ excluded:
- Carthage
- fastlane

analyzer_rules:
- unused_declaration
- unused_import

disabled_rules:
- for_where
- identifier_name
- line_length
- todo

opt_in_rules:
- array_init
- attributes
Expand All @@ -28,7 +38,6 @@ opt_in_rules:
- file_header
- first_where
- force_unwrapping
- implicit_return
- implicitly_unwrapped_optional
- joined_default_parameter
- last_where
Expand All @@ -50,7 +59,6 @@ opt_in_rules:
- prohibited_super_call
- reduce_into
- redundant_nil_coalescing
- redundant_type_annotation
- single_test_class
- sorted_first_last
- static_operator
Expand All @@ -60,28 +68,17 @@ opt_in_rules:
- unavailable_function
- unowned_variable_capture
- untyped_error_in_catch
- unused_declaration
- unused_import
- vertical_parameter_alignment_on_call
- vertical_whitespace_closing_braces
- vertical_whitespace_opening_braces
- xct_specific_matcher
- yoda_condition

disabled_rules:
- identifier_name
- line_length
- todo

cyclomatic_complexity:
warning: 15
warning: 16

function_body_length:
warning: 50

line_length:
ignores_function_declarations: true
ignores_interpolated_strings: true
warning: 55

nesting:
type_level:
Expand Down
34 changes: 0 additions & 34 deletions .travis.yml

This file was deleted.

23 changes: 14 additions & 9 deletions Authenticator.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -46,6 +46,7 @@
C9B7328F1C0A8AE60076F77E /* TokenListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9B7328E1C0A8AE60076F77E /* TokenListViewModel.swift */; };
C9BA64EA1C0C4FBC00610C7C /* UITableView+ReusableCells.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9BA64E91C0C4FBC00610C7C /* UITableView+ReusableCells.swift */; };
C9BEAE6019C67FD800533385 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C9BEAE5F19C67FD800533385 /* LaunchScreen.xib */; };
C9C27228299946190067D723 /* ViewHierarchyHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9C27227299946190067D723 /* ViewHierarchyHelpers.swift */; };
C9C6CCA21842E331000100C2 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C9C6CCA11842E331000100C2 /* Images.xcassets */; };
C9CC09511BA903B7008C54FE /* TokenFormViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9CC09501BA903B7008C54FE /* TokenFormViewController.swift */; };
C9CC09531BA9133B008C54FE /* FocusCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9CC09521BA9133B008C54FE /* FocusCell.swift */; };
Expand Down Expand Up @@ -117,7 +118,6 @@
C92708AB19CFB0750033128B /* TokenListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenListViewController.swift; sourceTree = "<group>"; };
C931A5FC1BFF6F9D00706A1C /* .hound.yml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .hound.yml; sourceTree = "<group>"; };
C931A5FE1BFF6FA600706A1C /* .swiftlint.yml */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = text; path = .swiftlint.yml; sourceTree = "<group>"; usesTabs = 0; };
C931A5FF1BFF6FA600706A1C /* .travis.yml */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = text; path = .travis.yml; sourceTree = "<group>"; usesTabs = 0; };
C931A6021BFF707E00706A1C /* Cartfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cartfile; sourceTree = "<group>"; };
C93AD15119CD51BE007480E9 /* Colors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Colors.swift; sourceTree = "<group>"; };
C93BD6221C167CD100FFFB8F /* Root.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Root.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -169,6 +169,7 @@
C9B7328E1C0A8AE60076F77E /* TokenListViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenListViewModel.swift; sourceTree = "<group>"; };
C9BA64E91C0C4FBC00610C7C /* UITableView+ReusableCells.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITableView+ReusableCells.swift"; sourceTree = "<group>"; };
C9BEAE5F19C67FD800533385 /* LaunchScreen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LaunchScreen.xib; sourceTree = "<group>"; };
C9C27227299946190067D723 /* ViewHierarchyHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewHierarchyHelpers.swift; sourceTree = "<group>"; };
C9C6CCA11842E331000100C2 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
C9CC09501BA903B7008C54FE /* TokenFormViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenFormViewController.swift; sourceTree = "<group>"; };
C9CC09521BA9133B008C54FE /* FocusCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FocusCell.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -298,7 +299,6 @@
C96E60561DBC5F1B00484823 /* .codecov.yml */,
C931A5FC1BFF6F9D00706A1C /* .hound.yml */,
C931A5FE1BFF6FA600706A1C /* .swiftlint.yml */,
C931A5FF1BFF6FA600706A1C /* .travis.yml */,
);
name = Tools;
sourceTree = "<group>";
Expand Down Expand Up @@ -425,6 +425,7 @@
CC471EEC1DC1377F006858AC /* MockTableView.swift */,
CCCD668A1E1C74B4005FE96E /* OneTimePasswordExtensions.swift */,
C99112691E2073710006A6C0 /* UITableViewUpdateTests.swift */,
C9C27227299946190067D723 /* ViewHierarchyHelpers.swift */,
);
path = AuthenticatorTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -633,6 +634,7 @@
/* Begin PBXShellScriptBuildPhase section */
C910ADBF1BF00ABF00C988F5 /* Lint */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -702,6 +704,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C9C27228299946190067D723 /* ViewHierarchyHelpers.swift in Sources */,
C9E3FB9C1E2860DD00EFA8BB /* TokenScannerTests.swift in Sources */,
CCCD668B1E1C74B4005FE96E /* OneTimePasswordExtensions.swift in Sources */,
C991126A1E2073710006A6C0 /* UITableViewUpdateTests.swift in Sources */,
Expand Down Expand Up @@ -746,7 +749,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
BUNDLE_DISPLAY_NAME = "${PRODUCT_NAME} ∆";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 0;
DEVELOPMENT_TEAM = WD7ETSN9J9;
INFOPLIST_FILE = Authenticator/Resources/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = me.mattrubin.authenticator.dev;
Expand All @@ -764,7 +766,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
BUNDLE_DISPLAY_NAME = "${PRODUCT_NAME}";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 0;
DEVELOPMENT_TEAM = WD7ETSN9J9;
INFOPLIST_FILE = Authenticator/Resources/Info.plist;
PRODUCT_BUNDLE_IDENTIFIER = me.mattrubin.authenticator;
Expand All @@ -780,13 +781,15 @@
baseConfigurationReference = C944A56A1A7F772600E08B1E /* Debug.xcconfig */;
buildSettings = {
CLANG_MODULES_AUTOLINK = YES;
CURRENT_PROJECT_VERSION = 0;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(BUILT_PRODUCTS_DIR)",
);
GCC_DYNAMIC_NO_PIC = NO;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
SWIFT_VERSION = 4.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 2023.1;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -795,13 +798,15 @@
baseConfigurationReference = C944A56C1A7F772600E08B1E /* Release.xcconfig */;
buildSettings = {
CLANG_MODULES_AUTOLINK = YES;
CURRENT_PROJECT_VERSION = 0;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(BUILT_PRODUCTS_DIR)",
);
GCC_DYNAMIC_NO_PIC = NO;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
SWIFT_VERSION = 4.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 2023.1;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Loading

0 comments on commit 500c9a0

Please sign in to comment.