Skip to content

Commit

Permalink
Merge branch 'release/0.1.0' into versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Aug 15, 2020
2 parents 15f012b + 335899f commit 3b61f55
Show file tree
Hide file tree
Showing 129 changed files with 112,828 additions and 0 deletions.
109 changes: 109 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: CI

on:
push:
branches: [main, versions]

pull_request:
branches: [main]

jobs:
cancel-previous-runs:
runs-on: ubuntu-latest

steps:
- name: Cancel previous runs of this workflow on same branch
uses: rokroskar/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

anylint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Export latest tool versions
run: |
latest_version() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
}
echo "::set-env name=ANYLINT_LATEST_VERSION::$( latest_version Flinesoft/AnyLint )"
echo "::set-env name=SWIFT_SH_LATEST_VERSION::$( latest_version mxcl/swift-sh )"
- name: AnyLint Cache
uses: actions/cache@v1
id: anylint-cache
with:
path: anylint-cache
key: ${{ runner.os }}-v1-anylint-${{ env.ANYLINT_LATEST_VERSION }}-swift-sh-${{ env.SWIFT_SH_LATEST_VERSION }}

- name: Copy from cache
if: steps.anylint-cache.outputs.cache-hit
run: |
sudo cp -f anylint-cache/anylint /usr/local/bin/anylint
sudo cp -f anylint-cache/swift-sh /usr/local/bin/swift-sh
- name: Install AnyLint
if: steps.anylint-cache.outputs.cache-hit != 'true'
run: |
git clone https://github.com/Flinesoft/AnyLint.git
cd AnyLint
swift build -c release
sudo cp -f .build/release/anylint /usr/local/bin/anylint
- name: Install swift-sh
if: steps.anylint-cache.outputs.cache-hit != 'true'
run: |
git clone https://github.com/mxcl/swift-sh.git
cd swift-sh
swift build -c release
sudo cp -f .build/release/swift-sh /usr/local/bin/swift-sh
- name: Copy to cache
if: steps.anylint-cache.outputs.cache-hit != 'true'
run: |
mkdir -p anylint-cache
cp -f /usr/local/bin/anylint anylint-cache/anylint
cp -f /usr/local/bin/swift-sh anylint-cache/swift-sh
- name: Cleanup checkouts
run: rm -rf AnyLint && rm -rf swift-sh

- name: Run AnyLint
run: anylint

swiftlint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Run SwiftLint
uses: norio-nomura/[email protected]
with:
args: --strict

# Turned off until there's a final Swift 5.3 release on Ubuntu 18.04.
# test-linux:
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v2
#
# - name: Run tests
# run: swift test -v

# Turned off until https://bugs.swift.org/browse/SR-12912 is fixed.
# test-macos:
# runs-on: macOS-latest
#
# steps:
# - uses: actions/checkout@v2
#
# - uses: maxim-lobanov/[email protected]
# with:
# xcode-version: 12.0
#
# - name: Run tests
# run: swift test -v
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,10 @@ fastlane/test_output
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

# SwiftPM
.DS_Store
/.build
/Packages
/*.xcodeproj
xcuserdata/
17 changes: 17 additions & 0 deletions .sourcery/LinuxMain.stencil
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@testable import PublicHolidaysTests
@testable import Utility
import XCTest

// swiftlint:disable line_length file_length

{% for type in types.classes|based:"XCTestCase" %}
extension {{ type.name }} {
static var allTests: [(String, ({{ type.name }}) -> () throws -> Void)] = [
{% for method in type.methods where method.parameters.count == 0 and method.shortName|hasPrefix:"test" and method|!annotated:"skipTestOnLinux" %} ("{{ method.shortName }}", {{ method.shortName }}){% if not forloop.last %},{% endif %}
{% endfor %}]
}

{% endfor %}
XCTMain([
{% for type in types.classes|based:"XCTestCase" %} testCase({{ type.name }}.allTests){% if not forloop.last %},{% endif %}
{% endfor %}])
121 changes: 121 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Basic Configuration
opt_in_rules:
- anyobject_protocol
- array_init
- attributes
- 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
- convenience_type
- empty_collection_literal
- empty_count
- empty_string
- empty_xctest_method
- explicit_init
- explicit_type_interface
- fallthrough
- fatal_error_message
- file_name
- file_name_no_space
- file_types_order
- first_where
- flatmap_over_map_reduce
- function_default_parameter_at_end
- identical_operands
- implicit_return
- implicitly_unwrapped_optional
- indentation_width
- joined_default_parameter
- last_where
- legacy_multiple
- legacy_random
- literal_expression_end_indentation
- lower_acl_than_parent
- missing_docs
- modifier_order
- multiline_arguments
- multiline_arguments_brackets
- multiline_literal_brackets
- multiline_parameters
- multiline_parameters_brackets
- nslocalizedstring_key
- object_literal
- operator_usage_whitespace
- optional_enum_case_matching
- override_in_extension
- pattern_matching_keywords
- prefer_self_type_over_type_of_self
- private_action
- private_outlet
- prohibited_super_call
- reduce_into
- redundant_nil_coalescing
- redundant_type_annotation
- single_test_class
- sorted_first_last
- sorted_imports
- static_operator
- strong_iboutlet
- switch_case_on_newline
- toggle_bool
- trailing_closure
- type_contents_order
- unavailable_function
- unneeded_parentheses_in_closure_argument
- untyped_error_in_catch
- unused_declaration
- unused_import
- vertical_parameter_alignment_on_call
- vertical_whitespace_between_cases
- vertical_whitespace_closing_braces
- vertical_whitespace_opening_braces
- xct_specific_matcher
- yoda_condition

included:
- Sources
- Tests

excluded:
- Tests/LinuxMain.swift

disabled_rules:
- todo
- cyclomatic_complexity

# Rule Configurations
conditional_returns_on_newline:
if_only: true

explicit_type_interface:
allow_redundancy: true
excluded:
- local

file_name:
suffix_pattern: "Ext"

identifier_name:
max_length: 60
excluded:
- id
- db
- to

line_length:
warning: 160
ignores_comments: true

nesting:
type_level: 3

trailing_comma:
mandatory_comma: true

trailing_whitespace:
ignores_comments: false
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Loading

0 comments on commit 3b61f55

Please sign in to comment.