Skip to content

Commit

Permalink
[platform][tooling] Use SPM to manage swiftlint (#38)
Browse files Browse the repository at this point in the history
* Remove unused snapshots from deleted tests

* Use swift pm to run swiftlint

* Enclose in single quotes and run with eval

* Use explicit path for swiftlint binary

* Move mkdir into Lint step
  • Loading branch information
namolnad committed Feb 1, 2019
1 parent fcaf33e commit 41927f3
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 14 deletions.
28 changes: 24 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,32 @@
version: 2
jobs:
swiftlint:
docker:
- image: dantoml/swiftlint:latest
macos:
xcode: "10.1.0"
steps:
- checkout
- run: mkdir -p build/reports/lint
- run: swiftlint lint --strict --reporter junit | tee build/reports/lint/junit.xml
- restore_cache:
keys:
- v{{ .Environment.CACHE_VERSION }}-build-cache-{{ arch }}-{{ checksum "Package.resolved" }}
- v{{ .Environment.CACHE_VERSION }}-build-cache-{{ arch }}
- v{{ .Environment.CACHE_VERSION }}-build-cache
name: Restore swiftlint cache
- run:
command: |-
mkdir -p build/reports/lint
executable=.build/debug/swiftlint
if ! [ $(command -v $executable) ]; then
executable='swift run swiftlint'
fi
eval $executable lint --strict --reporter junit | tee build/reports/lint/junit.xml
name: Lint
- save_cache:
key: v{{ .Environment.CACHE_VERSION }}-build-cache-{{ arch }}-{{ checksum "Package.resolved" }}
paths:
- .build/debug/swiftlint
name: Save swiftlint cache
- store_test_results:
path: build/reports/lint
test:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ install: build symlink config_template
install $(APP_EXECUTABLE) $(BIN_DIR)/

lint:
swiftlint --strict
swift run swiftlint --strict

prefix_install:
@NO_UPDATE_BUILD_NUMBER=1 $(MAKE) build_with_disable_sandbox
Expand Down
81 changes: 81 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@
{
"object": {
"pins": [
{
"package": "Commandant",
"repositoryURL": "https://github.com/Carthage/Commandant.git",
"state": {
"branch": null,
"revision": "07cad52573bad19d95844035bf0b25acddf6b0f6",
"version": "0.15.0"
}
},
{
"package": "Nimble",
"repositoryURL": "https://github.com/Quick/Nimble.git",
"state": {
"branch": null,
"revision": "9a281b1cfa1c53d1e8bd92e1798e4e473af8d263",
"version": "7.3.3"
}
},
{
"package": "Quick",
"repositoryURL": "https://github.com/Quick/Quick.git",
"state": {
"branch": null,
"revision": "f2b5a06440ea87eba1a167cab37bf6496646c52e",
"version": "1.3.4"
}
},
{
"package": "Result",
"repositoryURL": "https://github.com/antitypical/Result.git",
"state": {
"branch": null,
"revision": "2ca499ba456795616fbc471561ff1d963e6ae160",
"version": "4.1.0"
}
},
{
"package": "SourceKitten",
"repositoryURL": "https://github.com/jpsim/SourceKitten.git",
"state": {
"branch": null,
"revision": "176f04295a09324673245d8ec0afcce21ace8722",
"version": "0.22.0"
}
},
{
"package": "SwiftPM",
"repositoryURL": "git@github.com:apple/swift-package-manager.git",
Expand All @@ -18,6 +63,42 @@
"revision": "129e393c6d17f7f6490fa212f19ae0d558bbd5dc",
"version": "1.1.0"
}
},
{
"package": "SwiftLint",
"repositoryURL": "git@github.com:realm/SwiftLint.git",
"state": {
"branch": null,
"revision": "b2d428a4e24abd4f7cfeb0cd610b1656fb48c4a9",
"version": "0.30.1"
}
},
{
"package": "SwiftyTextTable",
"repositoryURL": "https://github.com/scottrhoyt/SwiftyTextTable.git",
"state": {
"branch": null,
"revision": "7b8661865f0d9590a4b7c146237fecd99f3d8406",
"version": "0.8.2"
}
},
{
"package": "SWXMLHash",
"repositoryURL": "https://github.com/drmohundro/SWXMLHash.git",
"state": {
"branch": null,
"revision": "9ba116841126f6c63435beef21a4cd247c32d2e7",
"version": "4.7.6"
}
},
{
"package": "Yams",
"repositoryURL": "https://github.com/jpsim/Yams.git",
"state": {
"branch": null,
"revision": "26ab35f50ea891e8edefcc9d975db2f6b67e1d68",
"version": "1.0.1"
}
}
]
},
Expand Down
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ let package = Package(
],
dependencies: [
.package(url: "git@github.com:pointfreeco/swift-snapshot-testing", from: "1.1.0"),
.package(url: "git@github.com:apple/swift-package-manager.git", from: "0.3.0")
.package(url: "git@github.com:apple/swift-package-manager.git", from: "0.3.0"),
.package(url: "git@github.com:realm/SwiftLint.git", from: "0.30.1")
],
targets: [
.target(
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 41927f3

Please sign in to comment.