Skip to content

Commit

Permalink
Merge pull request #15 from sp4ce-cowboy/branch-initial
Browse files Browse the repository at this point in the history
Add CI/CD pipeline and project configurations
  • Loading branch information
Vanessamae23 authored Mar 19, 2024
2 parents 4bfea71 + 0c80a06 commit c12c921
Show file tree
Hide file tree
Showing 38 changed files with 463 additions and 108 deletions.
Binary file removed .DS_Store
Binary file not shown.
54 changes: 54 additions & 0 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: iOS Starter Workflow

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
name: Xcode Build & Simulator Test
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v4 # v3 is deprecated by github
- name: Set Default Scheme
run: |
cd TowerForge
scheme_list=$(xcodebuild -list -json | tr -d "\n")
default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]")
echo $default | cat >default
echo Using default scheme: $default
- name: Build
env:
scheme: ${{ 'default' }}
platform: ${{ 'iOS Simulator' }}
run: |
cd TowerForge
# xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959)
# device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"`
device=$(xcrun simctl list devices | grep -oE 'iPad (Air|Pro \([0-9.]*-inch\)|mini) \([0-9]+(?:st|nd|rd|th) generation\)' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//")
# device=`xcrun simctl list devices 2>&1 | grep -oE 'iPad.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"`
if [ $scheme = default ]; then scheme=$(cat default); fi
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi
file_to_build=`echo $file_to_build | awk '{$1=$1;print}'`
xcodebuild build-for-testing -scheme "$scheme" -"$filetype_parameter" "$file_to_build" -destination "platform=$platform,name=$device"
- name: Test
env:
scheme: ${{ 'default' }}
platform: ${{ 'iOS Simulator' }}
run: |
cd TowerForge
# xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959)
# device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"`
# device=`xcrun simctl list devices 2>&1 | grep -oE 'iPad.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"`
device=$(xcrun simctl list devices | grep -oE 'iPad (Air|Pro \([0-9.]*-inch\)|mini) \([0-9]+(?:st|nd|rd|th) generation\)' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//")
if [ $scheme = default ]; then scheme=$(cat default); fi
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi
file_to_build=`echo $file_to_build | awk '{$1=$1;print}'`
xcodebuild test-without-building -scheme "$scheme" -"$filetype_parameter" "$file_to_build" -destination "platform=$platform,name=$device"
75 changes: 75 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
####### Global gitignore #######

# From https://github.com/github/gitignore/blob/master/Swift.gitignore
#
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

.DS_Store

## Build generated
build/
DerivedData/

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint

## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output

88 changes: 88 additions & 0 deletions TowerForge/.swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
excluded:
- Pods

opt_in_rules:
- anyobject_protocol
- array_init
- attributes
- closure_body_length
- closure_end_indentation
- closure_spacing
- collection_alignment
- conditional_returns_on_newline
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- contains_over_range_nil_comparison
- empty_collection_literal
- empty_count
- empty_string
- empty_xctest_method
- expiring_todo
- explicit_init
# - explicit_self moved to analyzer_rules section
- fallthrough
- fatal_error_message
- file_name
- first_where
- flatmap_over_map_reduce
- identical_operands
- implicit_return
- joined_default_parameter
- last_where
- legacy_multiple
- legacy_random
- lower_acl_than_parent
- modifier_order
- nimble_operator
- no_extension_access_modifier
- nslocalizedstring_key
- nslocalizedstring_require_bundle
- number_separator
- object_literal
- operator_usage_whitespace
- overridden_super_call
- override_in_extension
- pattern_matching_keywords
- private_action
- private_outlet
- prohibited_super_call
- quick_discouraged_call
- quick_discouraged_focused_test
- quick_discouraged_pending_test
- reduce_into
- redundant_nil_coalescing
- redundant_type_annotation
- required_enum_case
- single_test_class
- sorted_first_last
- static_operator
- strong_iboutlet
- switch_case_on_newline
- toggle_bool
- unavailable_function
- unneeded_parentheses_in_closure_argument
- unowned_variable_capture
- untyped_error_in_catch
# - unused_declaration moved to analyzer_rules section
# - unused_import moved to analyzer_rules section
- vertical_parameter_alignment_on_call
- xct_specific_matcher
- yoda_condition

analyzer_rules:
- explicit_self
- unused_declaration
- unused_import

disabled_rules:
- attributes
- identifier_name
- multiple_closures_with_trailing_closure # for e.g. SwiftUI buttons
- todo
- type_name
- function_default_parameter_at_end # disabled because it makes code less extensible by requiring unnecessary refactoring.

line_length:
warning: 120
error: 150
32 changes: 32 additions & 0 deletions TowerForge/TowerForceTestPlan.xctestplan
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"configurations" : [
{
"id" : "7B4B9C82-9166-4790-89DB-195C4DBD2C39",
"name" : "Configuration 1",
"options" : {

}
}
],
"defaultOptions" : {

},
"testTargets" : [
{
"target" : {
"containerPath" : "container:TowerForge.xcodeproj",
"identifier" : "52DF5FBC2BA32B2600135367",
"name" : "TowerForgeTests"
}
},
{
"enabled" : false,
"target" : {
"containerPath" : "container:TowerForge.xcodeproj",
"identifier" : "52DF5FC62BA32B2600135367",
"name" : "TowerForgeUITests"
}
}
],
"version" : 1
}
Loading

0 comments on commit c12c921

Please sign in to comment.