Skip to content

Commit

Permalink
Makefile, swiftlint, github ci, license
Browse files Browse the repository at this point in the history
  • Loading branch information
chojnac committed Jun 1, 2021
1 parent 65d7576 commit 586136e
Show file tree
Hide file tree
Showing 12 changed files with 158 additions and 16 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/ci-linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "ci-linux"
on:
push:
branches:
- main
paths:
- "Sources/**"
- "Tests/**"
pull_request:
branches:
- '*'

jobs:
ubuntu:
name: Linux Tests
runs-on: ubuntu-latest
container: swift:5.3
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Tests Linux
run: make test-swift
29 changes: 29 additions & 0 deletions .github/workflows/ci-mac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "ci-mac"
on:
push:
branches:
- main
paths:
- "Sources/**"
- "Tests/**"
pull_request:
branches:
- '*'

jobs:
build:
name: MacOS Tests
runs-on: macos-latest
env:
DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Tests iOS
run: make test-ios
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v2
with:
name: test_results
path: .build/DerivedData/Logs/Test/
32 changes: 32 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
included:
- Sources
- Tests
excluded:
disabled_rules:
- trailing_whitespace
- trailing_comma
- nesting
- cyclomatic_complexity
- file_length
- todo
- function_parameter_count
- opening_brace
- function_body_length
- large_tuple
line_length:
ignores_interpolated_strings: true
ignores_comments: true
warning: 120
error: 170
identifier_name:
min_length:
error: 1
warning: 1
inclusive_language:
override_allowed_terms:
- masterKey
type_name:
min_length:
error: 1
warning: 1
allowed_symbols: ["_"]
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2021 Wojciech Chojnacki <me@chojnac.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
48 changes: 48 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
IOS_SIMULATOR = "iOS Simulator,name=iPhone 12 Pro,OS=14.4"
DERIVED_DATA_DIR=$(ROOT_DIR)/.build/DerivedData

.PHONY: pre_checks_macos default

default:

pre_checks_macos:
# ifeq (, $(shell which xcpretty))
# $(error "No xcpretty in PATH, consider doing gem install xcpretty")
# endif

build:
swift build

test:
swift test

test-swift:
swift test --enable-test-discovery

test-ios: pre_checks_macos
set -o pipefail && \
xcodebuild test \
-derivedDataPath $(DERIVED_DATA_DIR) \
-scheme NotionSwift \
-destination platform=$(IOS_SIMULATOR) | xcpretty

test-macos: pre_checks_macos
set -o pipefail && \
xcodebuild test \
-derivedDataPath $(DERIVED_DATA_DIR) \
-scheme NotionSwift \
-destination platform="macOS" | xcpretty

test-linux:
docker run \
--rm \
-v "$(PWD):$(PWD)" \
-w "$(PWD)" \
swift:5.3 \
bash -c 'make test-swift'

test-all: test-macos test-ios

clean:
swift package clean
1 change: 0 additions & 1 deletion Sources/NotionSwift/AccessKeyProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public protocol AccessKeyProvider {
var accessKey: String? { get }
}


public struct StringAccessKeyProvider: AccessKeyProvider, ExpressibleByStringLiteral {

public let accessKey: String?
Expand Down
3 changes: 0 additions & 3 deletions Sources/NotionSwift/Models/Page.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,3 @@ extension Page: Decodable {
case properties
}
}



1 change: 0 additions & 1 deletion Sources/NotionSwift/Models/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,4 @@ extension User: Decodable {
}
}


}
12 changes: 6 additions & 6 deletions Sources/NotionSwift/NotionClient+Pages.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Foundation
// MARK: - Pages

// WIP
//extension NotionClient {
// extension NotionClient {
//
// public func page(pageId: Page.Identifier, completed: @escaping (Result<Page, Network.Errors>) -> Void) {
// networkClient.get(
Expand All @@ -34,10 +34,10 @@ import Foundation
// completed: completed
// )
// }
//}
// }
//
//#warning("TODO: PageCreateRequest")
//public struct PageCreateRequest: Encodable {}
// #warning("TODO: PageCreateRequest")
// public struct PageCreateRequest: Encodable {}
//
//#warning("TODO: PageUpdateParams")
//public struct PageUpdateParams: Encodable {}
// #warning("TODO: PageUpdateParams")
// public struct PageUpdateParams: Encodable {}
4 changes: 2 additions & 2 deletions Sources/NotionSwift/NotionClient+Search.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import Foundation
// MARK: - Search

// WIP
//extension NotionClient {
// extension NotionClient {
// public func search(params: Any, completed: @escaping (Result<[Any], Error>) -> Void) {
//
// }
//}
// }
1 change: 0 additions & 1 deletion Sources/NotionSwift/NotionClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ public final class NotionClient {
return headers
}
}

2 changes: 0 additions & 2 deletions Sources/NotionSwift/Request/Filter+types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ extension DatabasePropertyFilter {
}
}


extension DatabasePropertyFilter {
public enum NumberCondition {
case equals(Int)
Expand All @@ -106,4 +105,3 @@ extension DatabasePropertyFilter {
case isNotEmpty
}
}

0 comments on commit 586136e

Please sign in to comment.