Skip to content

Commit

Permalink
Migrated ci to run on 15.4 (#17)
Browse files Browse the repository at this point in the history
* Migrated ci to run on 15.0

Adds code coverage

Enable codecov & slather

Adds code format to CI

Fixes swiftformat failing

* Adds codecov badge to readme
  • Loading branch information
mustiikhalil authored May 14, 2022
1 parent 6cf3be3 commit cfef6bc
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 7 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,25 @@ jobs:
- uses: actions/checkout@v1
- name: Setup - Xcode
run: sudo xcode-select -s /Applications/Xcode_13.1.app
- name: Setup - Slather
run: gem install slather
- name: test
run: cd DemoApp && xcodebuild test -scheme DemoApp -project DemoApp.xcodeproj -destination 'platform=iOS Simulator,name=iPhone 13,OS=15.0' | xcpretty && exit ${PIPESTATUS[0]}
run: cd DemoApp && xcodebuild -scheme DemoApp -project DemoApp.xcodeproj -destination 'platform=iOS Simulator,name=iPhone 13,OS=15.0' -enableCodeCoverage YES test | xcpretty && exit ${PIPESTATUS[0]}
- name: Slather
run: slather
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
file: cobertura.xml

format:
name: Format
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Setup - Xcode
run: sudo xcode-select -s /Applications/Xcode_13.1.app
- name: Setup format
run: brew install swiftformat
- name: Format
run: swiftformat --config swift.swiftformat . --lint
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
xcuserdata/
DerivedData/
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
Package.resolved
Package.resolved
cobertura.xml
4 changes: 4 additions & 0 deletions .slather.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage_service: cobertura_xml
xcodeproj: DemoApp/DemoApp.xcodeproj
scheme: DemoApp
output_directory: ./
16 changes: 16 additions & 0 deletions DemoApp/DemoApp.xcodeproj/xcshareddata/xcschemes/DemoApp.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@
shouldUseLaunchSchemeArgsEnv = "YES"
systemAttachmentLifetime = "keepAlways"
codeCoverageEnabled = "YES">
<CodeCoverageTargets>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "LCLabel"
BuildableName = "LCLabel"
BlueprintName = "LCLabel"
ReferencedContainer = "container:..">
</BuildableReference>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "LCLabelTests"
BuildableName = "LCLabelTests"
BlueprintName = "LCLabelTests"
ReferencedContainer = "container:..">
</BuildableReference>
</CodeCoverageTargets>
<Testables>
<TestableReference
skipped = "NO">
Expand Down
3 changes: 2 additions & 1 deletion DemoApp/LCLabelUITests/LCLabelHitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ final class LCLabelHitTests: XCTestCase {
app.launch()

XCTAssertEqual(
app.staticTexts.matching(.staticText, identifier: "lcllabel+1").firstMatch.identifier,
app.staticTexts.matching(.staticText, identifier: "lcllabel+1").firstMatch
.identifier,
"lcllabel+1")

let main = app.otherElements["main"]
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gem 'slather'
48 changes: 48 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
GEM
specs:
CFPropertyList (3.0.5)
rexml
activesupport (6.1.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
atomos (0.1.3)
claide (1.1.0)
clamp (1.3.2)
colored2 (3.1.2)
concurrent-ruby (1.1.10)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
minitest (5.15.0)
nanaimo (0.3.0)
nokogiri (1.13.6-x86_64-darwin)
racc (~> 1.4)
racc (1.6.0)
rexml (3.2.5)
slather (2.7.2)
CFPropertyList (>= 2.2, < 4)
activesupport
clamp (~> 1.3)
nokogiri (~> 1.12)
xcodeproj (~> 1.21)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
xcodeproj (1.21.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
zeitwerk (2.5.4)

PLATFORMS
ruby

DEPENDENCIES
slather

BUNDLED WITH
1.17.2
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# LCLabel

[![codecov](https://codecov.io/gh/mustiikhalil/LCLabel/branch/main/graph/badge.svg?token=KAH2KVQ5MQ)](https://codecov.io/gh/mustiikhalil/LCLabel)

LCLabel is a TextKit 2 based UIView that mimics a the behaviour of UILabel & UITextView

## Installation
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions Sources/LCLabel/LCLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ final public class LCLabel: UIView {
// Check if the current text container is still valid
// with the proper size.
if let textContainer = textContainer,
textContainer.size == bounds.size
textContainer.size == bounds.size
{
container = textContainer
} else {
Expand Down Expand Up @@ -298,7 +298,7 @@ extension LCLabel {
with event: UIEvent?)
{
if let currentlySelectedLink = currentlySelectedLink,
currentlySelectedLink != linkAt(touches)
currentlySelectedLink != linkAt(touches)
{
self.currentlySelectedLink = nil
} else {
Expand All @@ -311,7 +311,7 @@ extension LCLabel {
with event: UIEvent?)
{
if let currentSelectedLink = currentlySelectedLink {
self.currentlySelectedLink = nil
currentlySelectedLink = nil
if let touch = touches.first {
delegate?.didPress(
url: currentSelectedLink,
Expand Down
1 change: 0 additions & 1 deletion Tests/LCLabelTests/LCLabelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ final class LCLabelTests: XCTestCase {
options: [.usesLineFragmentOrigin, .usesFontLeading],
attributes: attr,
context: nil)
print(size)
let label = createLabel(
text: attStr,
frame: CGRect(x: 0, y: 0, width: width, height: size.height))
Expand Down
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ignore:
- "DemoApp"

0 comments on commit cfef6bc

Please sign in to comment.