Skip to content

Commit

Permalink
OpenHABCore swift package, Alamofire 5, remove cocoapods (openhab#647)
Browse files Browse the repository at this point in the history
* OpenHABCore swift package, Alamofire 5, remove cocoapods

- OpenHABCore swift package
- migrate to Alamofire 5 by @timbms
- move external dependencies to SPM
- remove cocoapods

Signed-off-by: weak <[email protected]>

* update github workflows

Signed-off-by: weak <[email protected]>

* cache build tools

Signed-off-by: weak <[email protected]>

* use 3.x branch of SVGKit

Signed-off-by: weak <[email protected]>

* update changelog

Signed-off-by: weak <[email protected]>

* committed version bump: 2.4.42 (1580410492)

Signed-off-by: runner <[email protected]>
Signed-off-by: weak <[email protected]>

* add minimal description in readme

Signed-off-by: weak <[email protected]>

* move relevant tests to OpenHABCore

Signed-off-by: weak <[email protected]>

* fix warnings

Signed-off-by: weak <[email protected]>

* fix connection to myopenhab.org

Signed-off-by: weak <[email protected]>

* remove obsolete if clause

Signed-off-by: weak <[email protected]>

* committed version bump: 2.4.42 (1580410493)

Signed-off-by: runner <[email protected]>
Signed-off-by: weak <[email protected]>

* send credentials for myopenhab.org subdomains

Signed-off-by: weak <[email protected]>

* fix certificate evaluation

Signed-off-by: weak <[email protected]>

* re-enable icon type setting

Signed-off-by: weak <[email protected]>

* update changelog

Signed-off-by: weak <[email protected]>

* committed version bump: 2.4.42 (1580410494)

Signed-off-by: runner <[email protected]>
Signed-off-by: weak <[email protected]>

* delete unsent crashlytics reports if permission dialog is canceled

Signed-off-by: weak <[email protected]>

* update swiftformat

Signed-off-by: weak <[email protected]>

* committed version bump: 2.4.42 (1580410495)

Signed-off-by: runner <[email protected]>
Signed-off-by: weak <[email protected]>

* fix out of bounds crash

Signed-off-by: weak <[email protected]>

* improve workflows and skip tests on draft PRs

Signed-off-by: weak <[email protected]>

Co-authored-by: openhab-bot <[email protected]>
  • Loading branch information
weakfl and openhab-bot authored Feb 11, 2022
1 parent 9c4752d commit ea027cc
Show file tree
Hide file tree
Showing 99 changed files with 1,778 additions and 2,363 deletions.
27 changes: 9 additions & 18 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,19 @@ jobs:
token: ${{ secrets.ACCESS_TOKEN }}
fetch-depth: 0

- name: Cache cocoapods dependencies
- name: Cache BuildTools
uses: actions/cache@v2
env:
cache-name: cache-cocoapods-dependencies
cache-name: cache-buildtools-dependencies
with:
path: Pods
key: ${{ runner.os }}-pods-${{ env.cache-name }}-${{ hashFiles('**/Podfile.lock') }}
path: BuildTools/.build
key: ${{ runner.os }}-buildtools-${{ env.cache-name }}-${{ hashFiles('../Package.resolved') }}
restore-keys: |
${{ runner.os }}-pods-${{ env.cache-name }}-
${{ runner.os }}-buildtools-${{ env.cache-name }}-
- name: Setup Cocoapods
uses: maxim-lobanov/setup-cocoapods@v1
with:
podfile-path: Podfile.lock

- name: Install Dependencies
run: pod install --repo-update
shell: bash
- name: Install dependencies
run: |
bundle install --redownload
- name: SSH Config
run: |
Expand All @@ -54,16 +49,12 @@ jobs:
ssh-private-key: |
${{ secrets.MATCH_GIT_PRIVATE_KEY }}
- name: Get the current branch name
run: echo "::set-output name=branch::${GITHUB_REF#refs/heads/}"
id: extract_branch

- name: Deploy on TestFlight
env:
OH_CROWDIN_PROJECT_ID: openhab-ios
OH_CROWDIN_USERNAME: ${{ secrets.OH_CROWDIN_USERNAME }}
OH_CROWDIN_ACCOUNT_KEY: ${{ secrets.OH_CROWDIN_ACCOUNT_KEY }}
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}
BRANCH_NAME: ${{ github.head_ref }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
ASC_API_KEY_ID: ${{ secrets.ASC_API_KEY_ID }}
Expand Down
36 changes: 11 additions & 25 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,38 @@ name: Run Unit Tests

on:
pull_request:
types: [opened, reopened, synchronize]
types: [opened, reopened, synchronize, ready_for_review]

jobs:
build_and_test:
runs-on: macos-11

if: ${{ github.event.pull_request.draft == false }}
steps:
- uses: maxim-lobanov/[email protected]
with:
xcode-version: latest-stable

- uses: actions/checkout@v2
with:
token: ${{ secrets.ACCESS_TOKEN }}
token: ${{ github.token }}
ref: ${{ github.event.pull_request.head.ref }}

- name: Cache cocoapods dependencies
- name: Cache BuildTools
uses: actions/cache@v2
env:
cache-name: cache-cocoapods-dependencies
cache-name: cache-buildtools-dependencies
with:
path: Pods
key: ${{ runner.os }}-pods-${{ env.cache-name }}-${{ hashFiles('**/Podfile.lock') }}
path: BuildTools/.build
key: ${{ runner.os }}-buildtools-${{ env.cache-name }}-${{ hashFiles('../Package.resolved') }}
restore-keys: |
${{ runner.os }}-pods-${{ env.cache-name }}-
- name: Setup Cocoapods
uses: maxim-lobanov/setup-cocoapods@v1
with:
podfile-path: Podfile.lock
${{ runner.os }}-buildtools-${{ env.cache-name }}-
- name: Install Dependencies
run: pod install --repo-update
shell: bash
- name: Install dependencies
run: |
bundle install --redownload
- name: Fastlane unit tests
env:
OH_CROWDIN_PROJECT_ID: openhab-ios
OH_CROWDIN_USERNAME: ${{ secrets.OH_CROWDIN_USERNAME }}
OH_CROWDIN_ACCOUNT_KEY: ${{ secrets.OH_CROWDIN_ACCOUNT_KEY }}
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
ASC_API_KEY_ID: ${{ secrets.ASC_API_KEY_ID }}
ASC_API_KEY_ISSUER_ID: ${{ secrets.ASC_API_KEY_ISSUER_ID }}
ASC_API_KEY: ${{ secrets.ASC_API_KEY }}
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 60
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ fastlane/test_output

openHAB.app.dSYM.zip
openHAB.ipa

# spm
build/
BuildTools/.build
OpenHABCore/Package.resolved
10 changes: 6 additions & 4 deletions .swiftformat → BuildTools/.swiftformat
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# file options
--swiftversion 5.5
--exclude Pods
--exclude fastlane
--exclude ../Pods
--exclude ../BuildTools
--exclude ../fastlane
--exclude ../OpenHABCore/.build
--symlinks ignore

# disabled rules
Expand Down Expand Up @@ -38,10 +40,10 @@
--patternlet hoist
--ranges spaced
--self remove
--selfrequired
--selfrequired
--semicolons inline
--stripunusedargs closure-only
--trailingclosures
--trailingclosures
--trimwhitespace always
--wraparguments before-first
--wrapcollections before-first
Expand Down
16 changes: 9 additions & 7 deletions .swiftlint.yml → BuildTools/.swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
opt_in_rules:
opt_in_rules:
- sorted_imports
- empty_count
- redundant_type_annotation
Expand All @@ -8,7 +8,7 @@ opt_in_rules:
- multiline_function_chains
- anyobject_protocol
- array_init
- attributes
- attributes
- closure_end_indentation
- closure_spacing
- reduce_boolean
Expand All @@ -26,11 +26,13 @@ disabled_rules: # rule identifiers to exclude from running
- force_cast
- todo

excluded:
- Pods
- fastlane
excluded:
- ../Pods
- ../fastlane
- ../BuildTools
- ../OpenHABCore/.build

nesting:
nesting:
type_level: 2

function_body_length:
Expand Down Expand Up @@ -61,7 +63,7 @@ line_length:
identifier_name:
allowed_symbols: "_"
min_length: 2
max_length:
max_length:
warning: 90
error: 1000
excluded:
Expand Down
Empty file added BuildTools/Empty.swift
Empty file.
70 changes: 70 additions & 0 deletions BuildTools/Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"object": {
"pins": [
{
"package": "SourceKitten",
"repositoryURL": "https://github.com/jpsim/SourceKitten.git",
"state": {
"branch": null,
"revision": "558628392eb31d37cb251cfe626c53eafd330df6",
"version": "0.31.1"
}
},
{
"package": "swift-argument-parser",
"repositoryURL": "https://github.com/apple/swift-argument-parser.git",
"state": {
"branch": null,
"revision": "e394bf350e38cb100b6bc4172834770ede1b7232",
"version": "1.0.3"
}
},
{
"package": "SwiftFormat",
"repositoryURL": "https://github.com/nicklockwood/SwiftFormat",
"state": {
"branch": null,
"revision": "f14f4f717e7e1d275acd7557d64c94cfef5723e6",
"version": "0.49.4"
}
},
{
"package": "SwiftLint",
"repositoryURL": "https://github.com/realm/SwiftLint",
"state": {
"branch": null,
"revision": "b4a54f32df66008d30f0229446831cb823576c42",
"version": "0.46.2"
}
},
{
"package": "SwiftyTextTable",
"repositoryURL": "https://github.com/scottrhoyt/SwiftyTextTable.git",
"state": {
"branch": null,
"revision": "c6df6cf533d120716bff38f8ff9885e1ce2a4ac3",
"version": "0.9.0"
}
},
{
"package": "SWXMLHash",
"repositoryURL": "https://github.com/drmohundro/SWXMLHash.git",
"state": {
"branch": null,
"revision": "9183170d20857753d4f331b0ca63f73c60764bf3",
"version": "5.0.2"
}
},
{
"package": "Yams",
"repositoryURL": "https://github.com/jpsim/Yams.git",
"state": {
"branch": null,
"revision": "9ff1cc9327586db4e0c8f46f064b6a82ec1566fa",
"version": "4.0.6"
}
}
]
},
"version": 1
}
13 changes: 13 additions & 0 deletions BuildTools/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// swift-tools-version:5.2
import PackageDescription

let package = Package(
name: "BuildTools",
dependencies: [
// Define any tools you want available from your build phases
// Here's an example with SwiftFormat
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.46.2"),
.package(url: "https://github.com/realm/SwiftLint", from: "0.40.1")
],
targets: [.target(name: "BuildTools", path: "")]
)
Binary file added BuildTools/upload-symbols
Binary file not shown.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

- Delete unsent crashlytics reports if permission dialog is canceled
- Re-enable icon type setting
- Fix certificate issues
- Fixed connection to myopenhab.org
- OpenHABCore swift package
- Migrate to Alamofire 5
- Move external dependencies to SPM
- Remove cocoapods

## [Version 2.4.15, Build 1580410464] - 2020-12-04

### Added
Expand Down
7 changes: 7 additions & 0 deletions OpenHABCore/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.DS_Store
/.build
/Packages
/*.xcodeproj
xcuserdata/
DerivedData/
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
41 changes: 41 additions & 0 deletions OpenHABCore/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "OpenHABCore",
platforms: [.iOS(.v12), .watchOS(.v6)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "OpenHABCore",
targets: ["OpenHABCore"]
)
],
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(name: "Alamofire", url: "https://github.com/Alamofire/Alamofire.git", from: "5.0.0"),
.package(name: "Fuzi", url: "https://github.com/cezheng/Fuzi.git", from: "3.0.0"),
.package(name: "Kingfisher", url: "https://github.com/onevcat/Kingfisher.git", from: "7.0.0")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "OpenHABCore",
dependencies: [
.product(name: "Alamofire", package: "Alamofire", condition: .when(platforms: [.iOS, .watchOS])),
.product(name: "Fuzi", package: "Fuzi", condition: .when(platforms: [.iOS, .watchOS])),
.product(name: "Kingfisher", package: "Kingfisher", condition: .when(platforms: [.iOS, .watchOS]))
]
),
.testTarget(
name: "OpenHABCoreTests",
dependencies: ["OpenHABCore"],
resources: [
.process("Resources")
]
)
]
)
3 changes: 3 additions & 0 deletions OpenHABCore/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# OpenHABCore

This package contains code shared between the main openHAB app and its extensions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import CoreLocation
import Fuzi
import os.log
import UIKit

public final class OpenHABItem: NSObject, CommItem {
public enum ItemType: String {
case color = "Color"
Expand Down
Loading

0 comments on commit ea027cc

Please sign in to comment.