Skip to content

Commit b182a42

Browse files
Merge pull request #520 from skywinder/develop
2 parents 6cb1440 + f483098 commit b182a42

File tree

150 files changed

+6803
-3920
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+6803
-3920
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ jobs:
4242
run: sleep 1
4343
- name: Run local tests
4444
run: swift test --skip-build -c debug --filter localTests
45-
# - name: Run remote tests
46-
# run: swift test --skip-build -c debug --filter remoteTests
45+
- name: Run remote tests
46+
run: swift test --skip-build -c debug --filter remoteTests
4747
carthage:
4848
name: Carthage
4949
runs-on: macOS-11
@@ -64,7 +64,7 @@ jobs:
6464
- name: Building dependencies
6565
run: carthage build --no-use-binaries --platform iOS Simulator --use-xcframeworks
6666
- name: Building framework
67-
run: xcodebuild build-for-testing -project "web3swift.xcodeproj" -scheme "web3swift" -destination "${{matrix.destination}}" -testPlan LocalTests
67+
run: xcodebuild build-for-testing -project "web3swift.xcodeproj" -scheme "web3swift" -destination "${{matrix.destination}}"
6868
- name: Install ganache
6969
run: npm install ganache --global
7070
- name: Start ganache in background
@@ -73,5 +73,5 @@ jobs:
7373
run: sleep 1
7474
- name: Run local tests
7575
run: xcodebuild test-without-building -project "web3swift.xcodeproj" -scheme "web3swift" -destination "${{matrix.destination}}" -testPlan LocalTests
76-
# - name: Run remote tests
77-
# run: xcodebuild test-without-building -project "web3swift.xcodeproj" -scheme "web3swift" -destination "${{matrix.destination}}" -testPlan RemoteTests
76+
- name: Run remote tests
77+
run: xcodebuild test-without-building -project "web3swift.xcodeproj" -scheme "web3swift" -destination "${{matrix.destination}}" -testPlan RemoteTests

.swiftlint.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
excluded:
2+
- Carthage
3+
- Pods
4+
- .build
5+
- Build
6+
- DerivedData
7+
8+
disabled_rules:
9+
- type_name
10+
- identifier_name
11+
- line_length
12+
- multiple_closures_with_trailing_closure
13+
- todo
14+
15+
opt_in_rules:
16+
- weak_delegate
17+
- unused_import
18+
- unneeded_parentheses_in_closure_argument
19+
- trailing_closure
20+
- static_operator
21+
- redundant_nil_coalescing
22+
- override_in_extension
23+
- legacy_objc_type
24+
- implicitly_unwrapped_optional
25+
- force_unwrapping
26+
- empty_string
27+
- closure_body_length
28+
- fallthrough
29+
- indentation_width
30+
31+
# force warnings
32+
force_cast: error
33+
force_try: error
34+
35+
custom_rules:
36+
commented_out_code:
37+
included: ".*\\.swift" # regex that defines paths to include during linting. optional.
38+
excluded: ".*Test(s)?\\.swift" # regex that defines paths to exclude during linting. optional
39+
name: "Commented out code" # rule name. optional.
40+
regex: "^\\/\\/\\s*(@|\\.?([a-z]|(\\})))" # matching pattern
41+
capture_group: 0 # number of regex capture group to highlight the rule violation at. optional.
42+
match_kinds: # SyntaxKinds to match. optional.
43+
- comment
44+
message: "No commented code in devel branch allowed." # violation message. optional.
45+
severity: warning # violation severity. optional.

CONTRIBUTION.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Contribution guide
2+
## Version convention
3+
We’re conforming [default versions convention](https://semver.org/).
4+
So in the `1.0.0` version each position means follow:
5+
- 1.\*.***major release**, includes API groundbreaking changes (ie: your old code will not work).
6+
- \*.1.***minor release**, we’ve added some new feature to the lib, but we didn’t break something in anyway (ie: everything will work as expected without any moves after update).
7+
- \*.*.1 — **patch release**, we’re haven’t add any breaking changes or even new features for the user, but we’ve fixed some bugs or rewrote something internal (ie: you should not event mention that anything were changed in the lib).
8+
9+
This library yet living within **three weeks minor release** schedule. Also please keep in mind that in sake of avoiding complex merge conflicts, we’re currently taking only **one big feature** in release, so if you want to take some, please drop us a message somewhere to avoiding reworking it after it’ll be broken by some massive merge.
10+
11+
Critical bug fixes are should be marked with appropriate label in PR and should be proceed **within one week** till patch ’ll be released (at least we’ll try our best to made that).
12+
13+
## What task to choose
14+
Please take it from the [roadmap](https://hackmd.io/G5znP3xAQY-BVc1X8Y1jSg) or from the [opened issues](https://github.com/skywinder/web3swift/issues?q=is:issue+is:open+sort:updated-desc "").
15+
16+
> If you want to make something completely new and purely magical, please drop us a message somewhere before, since it could ends up that this is what we planning to do a lot later or that we not planning at all.
17+
18+
## Codestyle guideline
19+
- `swiftlint` check should goes with no warnings.
20+
- Here’s some more detailed and human readable code style [guidelines](https://hackmd.io/8bACoAnTSsKc55Os596yCg "") (you can add there some suggestion if you’d like to).
21+
- We use [swift](https://www.swift.org/documentation/api-design-guidelines/ "") name convention.
22+
## Tests guideline
23+
1. Cover each new public method with tests.
24+
2. If you’re implementing some big feature encapsulate it in Separate file.
25+
3. Choose one of the two directory to add test case:
26+
* `localTests` — tests which could be ran without needing to connecting to real Ethereum network.
27+
* `remoteTests` — tests which needing connection to real Ethereum network to be ran.
28+
4. Exclude added file from opposite `*.xctestplan` file (e.g. if you’re adding file to `localTests` please exclude it from `RemoteTests.xctestplan`.
29+
5. Add test file to `web3swift.xcodeproj` to make it working within Carthage building system.
30+
31+
## Hacks & tricks & magic
32+
### TestPlans
33+
In ci/cd we’re using Xcode test plans feature to spread tests to local and remote one. So any time you’re adding any new test suit (file) please exclude it from `LocalTests.xctestplan` rather `RemoteTests.xctestplan` depends on what tests group it included.
34+
### Swift package manager
35+
Please add any files unused due build process to `excludeFiles` array in `Package.swift`.
36+
### Carthage
37+
Please do not forget to add & remove all new or dropped files and dependencies in carthage `.xcodeproj` file if you’re working with project anywhere but carthage project.
38+
### Cocoapods
39+
Please do not forget to add & remove all dependencies within `web3swift.podspec` file.
40+
### GitHub actions
41+
You’re able to use our github actions checks in your fork without needing to make PR to this repo. To get that just add your branch name to the branch list in file on path `.github/actions/ci.yml` to let the magic happening like follow:
42+
43+
```yml
44+
on:
45+
push:
46+
branches:
47+
- master
48+
- develop
49+
- hotfix
50+
- #YOUR_REPO_NAME#
51+
```
52+
53+
> Please remove your branch from this list before making PR.
54+
55+
## Good PR checklist
56+
### Code
57+
- [ ] All new functionality covered by unit tests.
58+
- [ ] Ci/cd green.
59+
- [ ] No redundant files are added (build cache, Xcode breakpoints settings and so on).
60+
61+
### Info
62+
- [ ] Relative and concrete PR title.
63+
- [ ] Issue or roadmap goal attached.
64+
- [ ] PR description filled with detail explanation of what it is and what’s its specific.
65+
66+
### Codestyle
67+
- [ ] All public method have `///` styled comments.
68+
- [ ] All magic or nonintuitive internal code parts are clearly explained in inline comments.
69+
- [ ] `swiftlint` ran have no warnings.
70+
- [ ] No commented out code lefts in PR.

Package.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
// swift-tools-version:5.4
1+
// swift-tools-version: 5.4
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
55

6-
76
#if os(macOS)
87
let excludeFiles = [
9-
"./Browser/BrowserViewController.swift", // Because of inheriting iOS only class failed to build on macOS.
8+
"./Browser/BrowserViewController.swift" // Because of inheriting iOS only class failed to build on macOS.
109
]
1110
#elseif os(iOS)
1211
let excludeFiles: String = []
@@ -20,7 +19,7 @@ let package = Package(
2019
products: [
2120
.library(name: "web3swift", targets: ["web3swift"])
2221
],
23-
22+
2423
dependencies: [
2524
.package(url: "https://github.com/attaswift/BigInt.git", from: "5.3.0"),
2625
.package(url: "https://github.com/mxcl/PromiseKit.git", from: "6.16.2"),
@@ -60,6 +59,6 @@ let package = Package(
6059
.copy("../../../TestToken/Helpers/TokenBasics/IERC20.sol"),
6160
.copy("../../../TestToken/Token/Web3SwiftToken.sol")
6261
]
63-
),
62+
)
6463
]
6564
)

Package@5.0.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
// swift-tools-version:5.0
1+
// swift-tools-version: 5.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
55

66
let package = Package(
77
name: "Web3swift",
88
platforms: [
9-
.macOS(.v10_12), .iOS(.v11),
9+
.macOS(.v10_12), .iOS(.v11)
1010
],
1111
products: [
1212
// Products define the executables and libraries produced by a package, and make them visible to other packages.
1313
.library(name: "web3swift", targets: ["web3swift"]),
1414
],
15-
15+
1616
dependencies: [
1717
.package(url: "https://github.com/attaswift/BigInt.git", from: "5.3.0"),
1818
.package(url: "https://github.com/mxcl/PromiseKit.git", from: "6.15.4"),
1919
.package(url: "https://github.com/daltoniam/Starscream.git", from: "4.0.4"),
20-
.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", from: "1.4.2"),
20+
.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", from: "1.4.2")
2121
],
2222
targets: [
2323
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
@@ -30,6 +30,6 @@ let package = Package(
3030
]),
3131
.testTarget(
3232
name: "web3swiftTests",
33-
dependencies: ["web3swift"]),
33+
dependencies: ["web3swift"])
3434
]
3535
)

0 commit comments

Comments
 (0)