Skip to content

Commit

Permalink
Настройка проекта (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
disavle committed Jul 22, 2023
1 parent a1cf483 commit 3c6c0a1
Show file tree
Hide file tree
Showing 41 changed files with 420 additions and 559 deletions.
9 changes: 9 additions & 0 deletions .github/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
curl -Ls https://install.tuist.io | bash
tuist install 3.21.1
tuist fetch
tuist generate
xcodebuild clean -quiet
xcodebuild build-for-testing\
-workspace 'Sandbox.xcworkspace' \
-scheme 'Sandbox' \
-destination 'platform=iOS Simulator,name=iPhone 14 Pro'
4 changes: 4 additions & 0 deletions .github/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
xcodebuild test-without-building\
-workspace 'Sandbox.xcworkspace' \
-scheme 'Sandbox' \
-destination 'platform=iOS Simulator,name=iPhone 14 Pro'
23 changes: 23 additions & 0 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Sandbox
on:
push:
branches:
- dev
pull_request:
branches:
- dev
jobs:
build:
runs-on: macos-13
steps:
- name: Setup Swift
uses: swift-actions/[email protected]
- name: Setup Xcode version
uses: maxim-lobanov/[email protected]
with:
xcode-version: "14.3"
- uses: actions/checkout@v3
- name: Build
run: exec ./.github/build.sh
- name: Test
run: exec ./.github/test.sh
72 changes: 72 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# OS X
.DS_Store

# Xcode
build/
.build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
*.xccheckout
profile
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcarchive
*.tar.gz

*.xcworkspace
*.xcworkspace/contents.xcworkspacedata

*.xcodeproj

*.pbxproj

# Tuist
Derived/
/Tuist/Dependencies/*
*/Tuist/Dependencies/*
Tuist/Dependencies/graph.json

# IDEA
.idea

# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

## Obj-C/Swift specific
*.hmap

## App packaging
*.ipa
*.dSYM.zip
*.dSYM
Tuist/Dependencies
111 changes: 111 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
excluded:
- ${PWD}/Carthage
- ${PWD}/Pods
- ${PWD}/DerivedData

disabled_rules:
- discarded_notification_center_observer
- notification_center_detachment
- orphaned_doc_comment
- todo
- unused_capture_list

analyzer_rules:
- unused_import

opt_in_rules:
- array_init
- attributes
- closure_end_indentation
- closure_spacing
- collection_alignment
- colon # promote to error
- convenience_type
- discouraged_object_literal
- empty_collection_literal
- empty_count
- empty_string
- enum_case_associated_values_count
- fatal_error_message
- first_where
- force_unwrapping
- implicitly_unwrapped_optional
- indentation_width
- last_where
- legacy_random
- literal_expression_end_indentation
- multiline_arguments
- multiline_function_chains
- multiline_literal_brackets
- multiline_parameters
- multiline_parameters_brackets
- operator_usage_whitespace
- overridden_super_call
- pattern_matching_keywords
- prefer_self_type_over_type_of_self
- redundant_nil_coalescing
- redundant_type_annotation
- strict_fileprivate
- toggle_bool
- trailing_closure
- unneeded_parentheses_in_closure_argument
- vertical_whitespace_closing_braces
- vertical_whitespace_opening_braces
- yoda_condition


custom_rules:
array_constructor:
name: "Array/Dictionary initializer"
regex: '[let,var] .+ = (\[.+\]\(\))'
capture_group: 1
message: "Use explicit type annotation when initializing empty arrays and dictionaries"
severity: warning


attributes:
always_on_same_line:
- "@IBSegueAction"
- "@IBAction"
- "@NSManaged"
- "@objc"

force_cast: warning
force_try: warning
function_body_length:
warning: 60

legacy_hashing: error

identifier_name:
excluded:
- i
- id
- x
- y
- z

indentation_width:
indentation_width: 2

line_length:
ignores_urls: true
ignores_function_declarations: true
ignores_comments: true

multiline_arguments:
first_argument_location: next_line
only_enforce_after_first_closure_on_first_line: true

private_over_fileprivate:
validate_extensions: true

trailing_whitespace:
ignores_empty_lines: false
ignores_comments: true

vertical_whitespace:
max_empty_lines: 2

included:
- Sandbox
1 change: 1 addition & 0 deletions .tuist-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.21.1
69 changes: 69 additions & 0 deletions Project.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import ProjectDescription

public var scripts: [TargetScript] {
var scripts = [TargetScript]()
let swiftLintScriptString = "SwiftLint/swiftlint --fix && SwiftLint/swiftlint"
let swiftLintScript = TargetScript.post(script: swiftLintScriptString, name: "SwiftLint", basedOnDependencyAnalysis: false)
scripts.append(swiftLintScript)
return scripts
}

let baseSettings: [String: SettingValue] = [
"MARKETING_VERSION": "1.0", // Version
"CURRENT_PROJECT_VERSION": "1", // Build
"ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS": "YES" // App Icons Source
]

let target = Target(
name: "Sandbox",
platform: .iOS,
product: .app,
productName: "Sandbox",
bundleId: "Disavle.Sandbox",
deploymentTarget: .iOS(targetVersion: "14.0", devices: .iphone),
infoPlist: "Sandbox/Configs/Info.plist",
sources: ["Sandbox/Sources/**"],
resources: ["Sandbox/Resources/**"],
scripts: scripts,
dependencies: [
.external(name: "SnapshotTesting")
],
settings: .settings(
base: baseSettings,
configurations: [.debug(name: .debug), .release(name: .release)]
)
)

let testTarget = Target(
name: "SandboxTests",
platform: .iOS,
product: .unitTests,
bundleId: "Disavle.SandboxTests",
deploymentTarget: .iOS(targetVersion: "14.0", devices: .iphone),
sources: "SandboxTests/Sources/**",
dependencies: [
.target(name: "Sandbox"),
]
)

let project = Project(
name: "Sandbox",
organizationName: "Disavle",
targets: [target, testTarget],
schemes: [
Scheme(
name: "Sandbox",
shared: true,
buildAction: .buildAction(targets: ["Sandbox"]),
testAction: .targets(["SandboxTests"]),
runAction: .runAction(executable: "Sandbox")
),
Scheme(
name: "SandboxTests",
shared: true,
buildAction: .buildAction(targets: ["SandboxTests"]),
testAction: .targets(["SandboxTests"]),
runAction: .runAction(executable: "SandboxTests")
),
]
)
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# sandbox
# Sandbox
[![Tuist badge](https://img.shields.io/badge/Powered%20by-Tuist-blue)](https://tuist.io)
Repo for studing new features.
Loading

0 comments on commit 3c6c0a1

Please sign in to comment.