Skip to content

Commit 366df37

Browse files
➕➖
Co-authored-by: Brandon Williams <[email protected]>
0 parents  commit 366df37

39 files changed

+5947
-0
lines changed

.github/workflows/ci.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- '*'
10+
11+
jobs:
12+
macos:
13+
name: MacOS
14+
runs-on: macOS-latest
15+
strategy:
16+
matrix:
17+
xcode:
18+
- 11.3
19+
- 11.7
20+
- 12.4
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Select Xcode ${{ matrix.xcode }}
24+
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
25+
- name: Print Swift version
26+
run: swift --version
27+
- name: Run tests
28+
run: make test-swift
29+
30+
linux:
31+
name: Ubuntu
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v2
35+
- name: Run tests
36+
run: make test-linux

.github/workflows/documentation.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Documentation
2+
on:
3+
release:
4+
types:
5+
- published
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Generate Documentation
15+
uses: SwiftDocOrg/swift-doc@master
16+
with:
17+
base-url: /swift-custom-dump/
18+
format: html
19+
inputs: Sources/CustomDump
20+
module-name: CustomDump
21+
output: Documentation
22+
- name: Update Permissions
23+
run: 'sudo chown --recursive $USER Documentation'
24+
- name: Deploy to GitHub Pages
25+
uses: JamesIves/github-pages-deploy-action@releases/v3
26+
with:
27+
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
28+
BRANCH: gh-pages
29+
FOLDER: Documentation

.github/workflows/format.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Format
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- '**'
7+
8+
jobs:
9+
swift_format:
10+
name: swift-format
11+
runs-on: macOS-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Tap
15+
run: brew tap pointfreeco/formulae
16+
- name: Install
17+
run: brew install Formulae/[email protected]
18+
- name: Format
19+
run: make format
20+
- uses: stefanzweifel/git-auto-commit-action@v4
21+
with:
22+
commit_message: Run swift-format
23+
branch: 'main'
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.DS_Store
2+
/.build
3+
/Packages
4+
/*.xcodeproj
5+
xcuserdata/
6+
DerivedData/
7+
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

CustomDump.playground/Contents.swift

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import CustomDump
2+
import Foundation
3+
4+
struct User {
5+
var favoriteNumbers: [Int]
6+
var id: Int
7+
var name: String
8+
}
9+
10+
var user = User(
11+
favoriteNumbers: [42, 1729],
12+
id: 2,
13+
name: "Blob"
14+
)
15+
16+
var users = (1...5).map {
17+
User(
18+
favoriteNumbers: [$0],
19+
id: $0,
20+
name: "Blob \($0)"
21+
)
22+
}
23+
24+
var other = users
25+
other.append(
26+
.init(
27+
favoriteNumbers: [42, 1729],
28+
id: 100,
29+
name: "Blob Sr."
30+
)
31+
)
32+
33+
print(diff(users, other)!)
34+
35+
struct MyError: Error {
36+
var id = 1
37+
var message = "asdf"
38+
}
39+
40+
let error: Error = NSError(
41+
domain: "co.pointfree",
42+
code: 42,
43+
userInfo: [NSLocalizedDescriptionKey: "Something went wrong"]
44+
)
45+
customDump(error)
46+
dump(error)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<playground version='5.0' target-platform='macos' buildActiveScheme='true' importAppTypes='true'>
3+
<timeline fileName='timeline.xctimeline'/>
4+
</playground>

CustomDump.playground/playground.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Point-Free, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
test-all: test-linux test-swift
2+
3+
test-linux:
4+
docker run \
5+
--rm \
6+
-v "$(PWD):$(PWD)" \
7+
-w "$(PWD)" \
8+
swift:5.4 \
9+
bash -c 'make test-swift'
10+
11+
test-swift:
12+
swift test \
13+
--enable-test-discovery \
14+
--parallel
15+
16+
format:
17+
swift format --in-place --recursive .
18+
19+
.PHONY: format test-all test-linux test-swift

Package.resolved

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"object": {
3+
"pins": [
4+
{
5+
"package": "xctest-dynamic-overlay",
6+
"repositoryURL": "https://github.com/pointfreeco/xctest-dynamic-overlay",
7+
"state": {
8+
"branch": null,
9+
"revision": "b9eeb1a7ea3fd6fea54ce57dee2f5794b667c8df",
10+
"version": "0.2.0"
11+
}
12+
}
13+
]
14+
},
15+
"version": 1
16+
}

Package.swift

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// swift-tools-version:5.3
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "swift-custom-dump",
7+
products: [
8+
.library(
9+
name: "CustomDump",
10+
targets: ["CustomDump"]
11+
)
12+
],
13+
dependencies: [
14+
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "0.2.0")
15+
],
16+
targets: [
17+
.target(
18+
name: "CustomDump",
19+
dependencies: [
20+
.product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay")
21+
]
22+
),
23+
.testTarget(
24+
name: "CustomDumpTests",
25+
dependencies: [
26+
"CustomDump"
27+
]
28+
),
29+
]
30+
)

0 commit comments

Comments
 (0)