Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 347c167

Browse files
authoredMay 2, 2018
Merge pull request #4 from stickytools/ci-cd
CI/CD
2 parents 5bc8dd4 + 1347f82 commit 347c167

7 files changed

+185
-7
lines changed
 

‎.codecov.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
coverage:
2+
ignore:
3+
- cmake-debug-build/*
4+
- Example/*
5+
- Scripts/*
6+
- Documentaion/*
7+
- Tests/*
8+
- Pods/*
9+
- Applications/Xcode.app/*
10+
- vendor/*
11+
- Carthage/*
12+
- build/*
13+
- .build/*
14+
- .vagrant/*
15+

‎.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,8 @@ cmake-build-debug
131131
# Python
132132
#==============================================================================#
133133
*.pyc
134+
135+
#==============================================================================#
136+
# Ruby
137+
#==============================================================================#
138+
Gemfile.lock

‎.travis.yml

+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
language: generic
2+
3+
git:
4+
submodules: false
5+
6+
notifications:
7+
slack:
8+
secure: "kgflM3rOhAUsGm6hbs7VUJcXr+FCcslBsg8tRVre569mzI+eMUauMtJINdhRn5nGwUXGinvORbFwmHHh+2TJrYGVCg/FZzTlm3dCdziiGnJnZ+6Pj4vGCgRlpawSSpRuUEYORRzCA9p2GKMKU2hBYPGGzshUfWq5XGJtyWBJuTAqKAP3Foc2kHL7ANFgmo48Nhc2T2CCXW9uFZ98M9Vpg5pi0PRKpEIywUz//xvP6MCmtuXzpQKTVT9IsvFtDJn4R+RZ//geNyJm+u5AlX6PNrQ7y2fqW0wmPJdwAh2E9EoZE2bWD/xL0W+J27kGTeEHkyPmDo7SPsbyhD5Y/rViXOSZXi3PICFAzJ7z1WkhgpzpV2J1JEKcqPSfjq2ZQiE0ZkDUfr/HekYrHgu6IKzB4PCZn6la3c7ncEGNXUzrWmrFip60D34/xsjW8Frh2JOwzs+iQbYunxS/UVuhCH4AXfdZ9uqGBmjKfWxyj+KERYqX3AyyftmZBvLJ0gOjYhUqoD8gBcZCS1KdVXpTMBsnJpMohoyHb8wuAB6e45eQz7ayaqaLaiUBlRqmz3AwVyL6MKXvUhTYwx1YeRRfOM7WEIOnXB9FeyFyvhJuQvvRfY2Mp6LiUyfpdl3wRN18xUZqD65ThPoqe9HB/V8seg+5kfhEPqlFEXpf2WPAJf4IYW8="
9+
10+
env:
11+
global:
12+
- PROJECT=StickyLocking.xcodeproj
13+
- SCHEME=StickyLocking-Package
14+
- TEST_SDK=iphonesimulator
15+
16+
matrix:
17+
include:
18+
-
19+
os: linux
20+
dist: trusty
21+
sudo: required
22+
env:
23+
- BUILD="cmake build"
24+
-
25+
os: osx
26+
osx_image: xcode9.3
27+
env:
28+
- BUILD="cmake build"
29+
-
30+
os: linux
31+
dist: trusty
32+
sudo: required
33+
env:
34+
- BUILD="swift build"
35+
-
36+
os: osx
37+
osx_image: xcode9.3
38+
env:
39+
- BUILD="swift build"
40+
-
41+
os: osx
42+
osx_image: xcode9.3
43+
env:
44+
- BUILD="pod lint"
45+
-
46+
os: osx
47+
osx_image: xcode9.3
48+
env:
49+
- BUILD="xcodebuild"
50+
- TEST_DEST="platform=iOS Simulator,OS=11.3,name=iPhone 8"
51+
52+
53+
# don't re-build for tags so that [publish binary] is not re-run
54+
# https://github.com/travis-ci/travis-ci/issues/1532
55+
branches:
56+
except:
57+
- /^[0-9]/
58+
59+
before_install:
60+
#
61+
# If there is a Gemfile for this os, install bundler and ask bundler to install the gems
62+
#
63+
- |
64+
if [ -e Gemfile ]; then
65+
export BUNDLE_GEMFILE=Gemfile
66+
gem install bundler
67+
bundler install
68+
fi
69+
#
70+
# OSX requires swiftlint be installed
71+
#
72+
- |
73+
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
74+
brew unlink swiftlint
75+
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/b4bd27d43e3df20735e2704eaf05b37ce5a6d626/Formula/swiftlint.rb
76+
fi
77+
#
78+
# Linux requires downloading Swift and tools
79+
#
80+
- |
81+
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
82+
sudo apt-get update -y
83+
sudo apt-get -y install clang-3.8 lldb-3.8 libicu-dev
84+
85+
wget https://swift.org/builds/swift-4.1-release/ubuntu1404/swift-4.1-RELEASE/swift-4.1-RELEASE-ubuntu14.04.tar.gz
86+
tar xzvf swift-4.1-RELEASE-ubuntu14.04.tar.gz
87+
export PATH=$(pwd)/swift-4.1-RELEASE-ubuntu14.04/usr/bin:$PATH
88+
fi
89+
90+
script:
91+
- |
92+
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
93+
# Fix travis issue: https://github.com/travis-ci/travis-ci/issues/6307
94+
rvm get head --auto-dotfiles || true
95+
fi
96+
- |
97+
if [[ "$BUILD" == "cmake build" ]]; then
98+
set -e # Fail (and stop build) on first non zero exit code
99+
cmake ./
100+
make tests
101+
set +e
102+
fi
103+
- |
104+
if [[ "$BUILD" == "swift build" ]]; then
105+
set -e # Fail (and stop build) on first non zero exit code
106+
swift test
107+
set +e
108+
fi
109+
- |
110+
if [[ "$BUILD" == "pod lint" ]]; then
111+
set -e # Fail (and stop build) on first non zero exit code
112+
bundler exec pod repo update
113+
bundler exec pod lib lint
114+
set +e
115+
fi
116+
- |
117+
if [[ "$BUILD" == "xcodebuild" ]]; then
118+
set -e # Fail (and stop build) on first non zero exit code
119+
cmake ./
120+
make xcode-project
121+
set -o pipefail
122+
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -destination "$TEST_DEST" -sdk "$TEST_SDK" -enableCodeCoverage YES build-for-testing | bundler exec xcpretty
123+
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -destination "$TEST_DEST" -sdk "$TEST_SDK" -enableCodeCoverage YES test | bundler exec xcpretty
124+
set +o pipefail
125+
set +e
126+
fi
127+
128+
after_success:
129+
- bash <(curl -s https://codecov.io/bash)
130+

‎Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source 'https://rubygems.org'
2+
gem 'cocoapods', '~> 1.5.0'
3+
gem 'xcpretty', '~> 0.2.4'

‎Package.swift

+1-4
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,9 @@ let package = Package(
2525
products: [
2626
.library(name: "StickyLocking", type: .dynamic, targets: ["StickyLocking"])
2727
],
28-
dependencies: [
29-
.package(url: "https://github.com/stickytools/sticky-utilities.git", .branch("master"))
30-
],
3128
targets: [
3229
/// Module targets
33-
.target(name: "StickyLocking", dependencies: ["StickyUtilities"], path: "Sources/StickyLocking"),
30+
.target(name: "StickyLocking", dependencies: [], path: "Sources/StickyLocking"),
3431

3532
/// Tests
3633
.testTarget(name: "StickyLockingTests", dependencies: ["StickyLocking"], path: "Tests/StickyLockingTests")

‎StickyLocking.podspec

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Pod::Spec.new do |s|
3+
s.name = "StickyLocking"
4+
s.version = "1.0.0-beta.1"
5+
s.summary = "A general purpose embedded hierarchical lock manager used to build highly concurrent applications of all types."
6+
7+
s.homepage = "https://github.com/stickytools/sticky-locking"
8+
s.license = 'Apache License, Version 2.0'
9+
s.author = { "Tony Stone" => "https://github.com/tonystone" }
10+
s.source = { :git => "https://github.com/stickytools/sticky-locking.git", :tag => s.version.to_s }
11+
12+
s.swift_version = '4.0'
13+
14+
s.ios.deployment_target = '8.0'
15+
s.osx.deployment_target = '10.10'
16+
s.watchos.deployment_target = '2.0'
17+
s.tvos.deployment_target = '9.0'
18+
19+
s.requires_arc = true
20+
21+
s.source_files = 'Sources/StickyLocking/**/*.swift'
22+
end

‎Tests/StickyLockingTests/Locker+ExtendedLockModeTests.swift

+9-3
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ class LockerExtendedLockModeTests: XCTestCase {
601601
/// ```
602602
///
603603
func testLockConversionScenario3Example1Deadlock() {
604+
604605
let input = "database1"
605606

606607
let requester = DispatchGroup()
@@ -610,7 +611,7 @@ class LockerExtendedLockModeTests: XCTestCase {
610611
cleanup.enter()
611612
blocked.enter()
612613

613-
for _ in 0..<2 {
614+
for i in 0..<5 {
614615

615616
locked.enter()
616617
DispatchQueue.global().async(group: requester) {
@@ -620,8 +621,13 @@ class LockerExtendedLockModeTests: XCTestCase {
620621
blocked.wait()
621622

622623
/// Now upgrade the lock
623-
XCTAssertEqual(self.locker.lock(input, mode: .X, timeout: .now() + 0.2), .timeout)
624-
624+
if i <= 0 {
625+
/// the first one we send with no timeout as this will be the lock that is granted once the time out happens for the remainder of the locks.
626+
XCTAssertEqual(self.locker.lock(input, mode: .X), .granted)
627+
} else {
628+
/// These will deadlock with the first one and altimately timeout.
629+
XCTAssertEqual(self.locker.lock(input, mode: .X, timeout: .now() + 0.2), .timeout)
630+
}
625631
cleanup.wait() /// Wait to cleanup
626632

627633
XCTAssertEqual(self.locker.unlock(input), true)

0 commit comments

Comments
 (0)
Please sign in to comment.