Skip to content

Commit

Permalink
Merge pull request #22 from playbook-ui/drop-support-for-old-xcode-ve…
Browse files Browse the repository at this point in the history
…rsions

Drop support for old xcode versions
  • Loading branch information
ra1028 authored Feb 1, 2024
2 parents 5ddd5db + 0590c2d commit 6ee953b
Show file tree
Hide file tree
Showing 14 changed files with 303 additions and 413 deletions.
54 changes: 27 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,49 @@
name: GitHub Actions
name: test

on:
pull_request:
push:
branches:
- main
workflow_dispatch:

env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app

jobs:
validation:
name: Validation
runs-on: macos-11
strategy:
matrix:
xcode_version:
- 12.5.1
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
runs-on: macos-13
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Get SwiftPM cache
uses: actions/cache@v2
with:
path: Tools/.build
key: ${{ runner.os }}-${{ matrix.xcode_version }}-1-spm-${{ hashFiles('Tools/Package.resolved') }}
restore-keys: ${{ runner.os }}-${{ matrix.xcode_version }}-1-spm-
path: .build
key: ${{ runner.os }}-0-spm-${{ hashFiles('Package.resolved') }}
restore-keys: ${{ runner.os }}-0-spm-

- name: Validation
if: matrix.xcode_version == '12.5.1'
- name: Validate format
run: |
make all && [ -z "$(git status --porcelain)" ]
make format
if [ -n "$(git status --porcelain)" ]; then echo "Make sure that the code is formated by 'make format'."; exit 1; fi
make lint
env:
SPM_FORCE_BUILD: 1

- name: Validate example project
run: |
make proj
if [ -n "$(git status --porcelain)" ]; then echo "Make sure that example project is formated by 'make proj'."; exit 1; fi
env:
SPM_FORCE_BUILD: 1

test:
name: Test on macOS
runs-on: macos-11
strategy:
matrix:
xcode_version:
- 12.4
- 12.5.1
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
runs-on: macos-13
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Show environments
run: |
Expand All @@ -61,11 +63,9 @@ jobs:
run: make npm

- name: Generate snapshots
working-directory: Example
run: xcodebuild test -scheme SampleApp -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 12 Pro' ENABLE_TESTABILITY=YES | xcpretty -c
run: set -o pipefail && xcodebuild test -project Example/Example.xcodeproj -scheme SampleApp -destination 'platform=iOS Simulator,name=iPhone 15 Pro' | xcpretty -c

- name: Visual regression test
if: matrix.xcode_version == '12.5.1'
run: npx percy upload Example/Snapshots
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
3 changes: 0 additions & 3 deletions .swift-format
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@
"AlwaysUseLowerCamelCase": false,
"AmbiguousTrailingClosureOverload": true,
"BeginDocumentationCommentWithOneLineSummary": true,
"BlankLineBetweenMembers": true,
"DoNotUseSemicolons": true,
"DontRepeatTypeInStaticProperties": true,
"FullyIndirectEnum": true,
"GroupNumericLiterals": true,
"IdentifiersMustBeASCII": true,
"MultiLineTrailingCommas": true,
"NeverForceUnwrap": false,
"NeverUseForceTry": false,
"NeverUseImplicitlyUnwrappedOptionals": true,
Expand All @@ -43,7 +41,6 @@
"OnlyOneTrailingClosureArgument": true,
"OrderedImports": true,
"ReturnVoidInsteadOfEmptyTuple": true,
"UseEnumForNamespacing": true,
"UseLetInEveryBoundCaseVariable": false,
"UseShorthandTypeNames": true,
"UseSingleLinePropertyGetter": true,
Expand Down
17 changes: 12 additions & 5 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -195,7 +195,8 @@
CA8E1E974698BC95958F017F /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1200;
BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 1430;
TargetAttributes = {
2988EB7AD33F8FCC59A8289D = {
ProvisioningStyle = Manual;
Expand All @@ -206,7 +207,7 @@
};
};
buildConfigurationList = 36FC72E69D906F48675C62BF /* Build configuration list for PBXProject "Example" */;
compatibilityVersion = "Xcode 10.0";
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Expand Down Expand Up @@ -320,6 +321,9 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGNING_REQUIRED = NO;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
Expand All @@ -332,7 +336,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.2;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -442,6 +446,9 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGNING_REQUIRED = NO;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -460,7 +467,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 14.2;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,41 @@
{
"object": {
"pins": [
{
"package": "AccessibilitySnapshot",
"repositoryURL": "https://github.com/cashapp/AccessibilitySnapshot.git",
"state": {
"branch": null,
"revision": "68f9270211893bcbb8a9b1b9d02e71303de35e26",
"version": "0.5.0"
}
},
{
"package": "Playbook",
"repositoryURL": "https://github.com/playbook-ui/playbook-ios.git",
"state": {
"branch": null,
"revision": "06a18477543aa29b950aef88555449e2e31d84af",
"version": "0.3.1"
}
},
{
"package": "SnapshotTesting",
"repositoryURL": "https://github.com/pointfreeco/swift-snapshot-testing.git",
"state": {
"branch": null,
"revision": "f8a9c997c3c1dab4e216a8ec9014e23144cbab37",
"version": "1.9.0"
}
"pins" : [
{
"identity" : "accessibilitysnapshot",
"kind" : "remoteSourceControl",
"location" : "https://github.com/cashapp/AccessibilitySnapshot.git",
"state" : {
"revision" : "482db2fd4251cce237d8106073a53ad5289ce739",
"version" : "0.6.0"
}
]
},
"version": 1
},
{
"identity" : "ios-snapshot-test-case",
"kind" : "remoteSourceControl",
"location" : "https://github.com/uber/ios-snapshot-test-case.git",
"state" : {
"revision" : "7b10770333a961be6e5a41c9ce04b8c6d3990126",
"version" : "8.0.0"
}
},
{
"identity" : "playbook-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/playbook-ui/playbook-ios.git",
"state" : {
"revision" : "0e7c312abdb4f7afeaf24369bab114cf475f573c",
"version" : "0.3.5"
}
},
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing.git",
"state" : {
"revision" : "f8a9c997c3c1dab4e216a8ec9014e23144cbab37",
"version" : "1.9.0"
}
}
],
"version" : 2
}
26 changes: 13 additions & 13 deletions Example/Example.xcodeproj/xcshareddata/xcschemes/SampleApp.xcscheme
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
version = "1.3">
LastUpgradeVersion = "1430"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
Expand All @@ -27,8 +27,17 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
onlyGenerateCoverageForSpecifiedTargets = "NO"
shouldUseLaunchSchemeArgsEnv = "NO">
shouldUseLaunchSchemeArgsEnv = "NO"
onlyGenerateCoverageForSpecifiedTargets = "NO">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2988EB7AD33F8FCC59A8289D"
BuildableName = "SampleApp.app"
BlueprintName = "SampleApp"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -41,15 +50,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2988EB7AD33F8FCC59A8289D"
BuildableName = "SampleApp.app"
BlueprintName = "SampleApp"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<CommandLineArguments>
<CommandLineArgument
argument = "-AppleLanguages (en)"
Expand Down
12 changes: 7 additions & 5 deletions Example/project.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
name: Example
options:
createIntermediateGroups: true
bundleIdPrefix: app.playbook-ui.accessibility.Example
deploymentTarget:
iOS: 14.2
iOS: 14.0

settings:
CODE_SIGNING_REQUIRED: NO
CODE_SIGN_IDENTITY: "-"
CODE_SIGN_STYLE: Manual

packages:
PlaybookAccessibilitySnapshot:
Expand All @@ -21,8 +27,6 @@ targets:
-AppleLanguages (en): true
environmentVariables:
SNAPSHOT_DIR: $(SOURCE_ROOT)/Snapshots
attributes:
ProvisioningStyle: Manual

SampleAccessibilitySnapshot:
type: bundle.unit-test
Expand All @@ -32,5 +36,3 @@ targets:
dependencies:
- target: SampleApp
- package: PlaybookAccessibilitySnapshot
attributes:
ProvisioningStyle: Manual
19 changes: 6 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
SWIFT_RUN := swift run -c release
GITHUB_RAW_CONTENT_PATH := https://raw.githubusercontent.com/playbook-ui/accessibility-snapshot-ios/main/
GITHUB_TREE_PATH := https://github.com/playbook-ui/accessibility-snapshot-ios/main/

.PHONY: all
all: proj format
TOOL = PLAYBOOK_DEVELOPMENT=1 swift run -c release
GITHUB_RAW_CONTENT_PATH = https://raw.githubusercontent.com/playbook-ui/accessibility-snapshot-ios/main/
GITHUB_TREE_PATH = https://github.com/playbook-ui/accessibility-snapshot-ios/main/

.PHONY: proj
proj:
$(SWIFT_RUN) --package-path Tools xcodegen --spec Example/project.yml --project Example
$(TOOL) xcodegen --spec Example/project.yml --project Example

.PHONY: format
format:
$(SWIFT_RUN) --package-path Tools swift-format -i -r -m format Sources Example/SampleAccessibilitySnapshot
$(TOOL) swift-format format -i -p -r Sources Example/SampleAccessibilitySnapshot

.PHONY: lint
lint:
$(SWIFT_RUN) --package-path Tools swift-format -r -m lint Sources Example/SampleAccessibilitySnapshot
$(TOOL) swift-format lint -s -p -r Sources Example/SampleAccessibilitySnapshot

.PHONY: npm
npm:
npm i

.PHONY: docs
docs:
$(SWIFT_RUN) --package-path Tools/Doc swift-doc generate Sources -n PlaybookAccessibilitySnapshot -f html -o docs --base-url https://playbook-ui.github.io/accessibility-snapshot-ios

.PHONY: fix-readme-links
fix-readme-links:
sed -i '' -E '/.?http/!s#(<img src=")([^"]+)#\1$(GITHUB_RAW_CONTENT_PATH)\2#g' README.md
Expand Down
Loading

0 comments on commit 6ee953b

Please sign in to comment.