From e16729ca1a44a5098a6f752558481e6156316896 Mon Sep 17 00:00:00 2001 From: Yutaka Date: Sat, 3 Sep 2022 21:46:12 +0900 Subject: [PATCH 1/5] add xcbeautify --- .gitignore | 2 +- DevTools/Dummy.swift | 0 DevTools/Package.resolved | 41 +++++++++++++++++++++++++++++++++++++++ DevTools/Package.swift | 13 +++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 DevTools/Dummy.swift create mode 100644 DevTools/Package.resolved create mode 100644 DevTools/Package.swift diff --git a/.gitignore b/.gitignore index 22eb2de..0f8ec0b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ .DS_Store -/.build +/**/.build /Packages /*.xcodeproj xcuserdata/ diff --git a/DevTools/Dummy.swift b/DevTools/Dummy.swift new file mode 100644 index 0000000..e69de29 diff --git a/DevTools/Package.resolved b/DevTools/Package.resolved new file mode 100644 index 0000000..72d67c8 --- /dev/null +++ b/DevTools/Package.resolved @@ -0,0 +1,41 @@ +{ + "pins" : [ + { + "identity" : "colorizer", + "kind" : "remoteSourceControl", + "location" : "https://github.com/getGuaka/Colorizer.git", + "state" : { + "revision" : "2ccc99bf1715e73c4139e8d40b6e6b30be975586", + "version" : "0.2.1" + } + }, + { + "identity" : "swift-argument-parser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-argument-parser.git", + "state" : { + "revision" : "9f39744e025c7d377987f30b03770805dcb0bcd1", + "version" : "1.1.4" + } + }, + { + "identity" : "xcbeautify", + "kind" : "remoteSourceControl", + "location" : "https://github.com/tuist/xcbeautify", + "state" : { + "revision" : "a3f5db18e7218a3817031b1b8227b1cb5704cb93", + "version" : "0.13.0" + } + }, + { + "identity" : "xmlcoder", + "kind" : "remoteSourceControl", + "location" : "https://github.com/MaxDesiatov/XMLCoder.git", + "state" : { + "revision" : "ca932442d7481700f5434a7b138c47dd42d9902b", + "version" : "0.14.0" + } + } + ], + "version" : 2 +} diff --git a/DevTools/Package.swift b/DevTools/Package.swift new file mode 100644 index 0000000..b37c157 --- /dev/null +++ b/DevTools/Package.swift @@ -0,0 +1,13 @@ +// swift-tools-version: 5.6 +import PackageDescription + +let package = Package( + name: "DevTools", + platforms: [.macOS(.v10_11)], + dependencies: [ + .package(url: "https://github.com/tuist/xcbeautify", from: "0.13.0"), + ], + targets: [ + .target(name: "DevTools", path: "") + ] +) From 960c92440ef2b4f32e0ff12fc855e4544f7c43c3 Mon Sep 17 00:00:00 2001 From: Yutaka Date: Sat, 3 Sep 2022 21:58:04 +0900 Subject: [PATCH 2/5] add Makefile --- Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d564aab --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +SWIFT = $(shell which swift) +DEV_TOOLS_BUILD_FLAGS = --configuration release --package-path ./DevTools + +.PHONY: dev +dev: + $(SWIFT) build $(DEV_TOOLS_BUILD_FLAGS) --product xcbeautify + +.PHONY: test +test: + $(SWIFT) test 2>&1 | xcbeautify From 67c2c2899477c0c6c40b9dd6058e15f62bbeb8f6 Mon Sep 17 00:00:00 2001 From: Yutaka Date: Sat, 3 Sep 2022 22:30:57 +0900 Subject: [PATCH 3/5] use make test --- .github/workflows/test.yml | 34 +++++++++++++++++++++++++++++++--- Makefile | 3 ++- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cd3c89e..ff4e0d1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,6 +30,20 @@ jobs: id: get-swift-version run: | echo "::set-output name=version::$(swift -version | head -n 1 | sed s/,// )" + - name: Cache DevTools + uses: actions/cache@v2 + with: + path: | + ./DevTools/.build/release + key: ${{ runner.os }}-DevTools-${{ matrix.xcode }}-${{ hashFiles('./DevTools/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-DevTools-${{ matrix.xcode }}-${{ hashFiles('./DevTools/Package.resolved') }} + ${{ runner.os }}-DevTools-${{ matrix.xcode }}- + - name: Install DevTools + run: | + if [ ! -e ./DevTools/.build/release/xcbeautify ]; then + make dev + fi - name: Cache dependencies uses: actions/cache@v2 with: @@ -37,12 +51,12 @@ jobs: .build/artifacts .build/checkouts .build/repositories - key: ${{ runner.os }}-dependencies-${{ matrix.xcode }}-${{ hashFiles('**/Package.resolved') }} + key: ${{ runner.os }}-dependencies-${{ matrix.xcode }}-${{ hashFiles('./Package.resolved') }} restore-keys: | - ${{ runner.os }}-dependencies-${{ matrix.xcode }}-${{ hashFiles('**/Package.resolved') }} + ${{ runner.os }}-dependencies-${{ matrix.xcode }}-${{ hashFiles('./Package.resolved') }} ${{ runner.os }}-dependencies-${{ matrix.xcode }}- - name: Test - run: swift test + run: make test linux: strategy: fail-fast: false @@ -66,6 +80,20 @@ jobs: run: | echo "::set-output name=version::$(swift -version | head -n 1 | sed s/,// )" shell: bash + - name: Cache DevTools + uses: actions/cache@v2 + with: + path: | + ./DevTools/.build/release + key: ${{ matrix.cache-version }}-${{ runner.os }}-${{ steps.get-swift-version.outputs.version }}}-DevTools-${{ hashFiles('./DevTools/Package.resolved') }} + restore-keys: | + ${{ matrix.cache-version }}-${{ runner.os }}-${{ steps.get-swift-version.outputs.version }}}-DevTools-${{ hashFiles('./DevTools/Package.resolved') }} + ${{ matrix.cache-version }}-${{ runner.os }}-${{ steps.get-swift-version.outputs.version }}}-DevTools- + - name: Install DevTools + run: | + if [ ! -e ./DevTools/.build/release/xcbeautify ]; then + make dev + fi - name: Cache dependencies uses: actions/cache@v2 with: diff --git a/Makefile b/Makefile index d564aab..4eeb7ef 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ SWIFT = $(shell which swift) DEV_TOOLS_BUILD_FLAGS = --configuration release --package-path ./DevTools +XCBEAUTIFY_EXECUTABLE = ./DevTools/.build/release/xcbeautify .PHONY: dev dev: @@ -7,4 +8,4 @@ dev: .PHONY: test test: - $(SWIFT) test 2>&1 | xcbeautify + $(SWIFT) test 2>&1 | $(XCBEAUTIFY_EXECUTABLE) From 3291feaff63f813c2eeb1600684783fd4981a4a9 Mon Sep 17 00:00:00 2001 From: Yutaka Date: Sat, 3 Sep 2022 22:34:34 +0900 Subject: [PATCH 4/5] fixed: swift-tools-version to 5.5 --- .github/workflows/test.yml | 2 +- DevTools/Package.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ff4e0d1..a48d5e2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -105,5 +105,5 @@ jobs: restore-keys: | ${{ matrix.cache-version }}-${{ runner.os }}-${{ steps.get-swift-version.outputs.version }}-spm-deps- - name: Test - run: swift test + run: make test diff --git a/DevTools/Package.swift b/DevTools/Package.swift index b37c157..ccd2da6 100644 --- a/DevTools/Package.swift +++ b/DevTools/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.6 +// swift-tools-version: 5.5 import PackageDescription let package = Package( From 16d3599729bb1193817121098d7bb5971b501b21 Mon Sep 17 00:00:00 2001 From: Yutaka Date: Sat, 3 Sep 2022 22:43:40 +0900 Subject: [PATCH 5/5] fixed: Package.resolved --- DevTools/Package.resolved | 78 ++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/DevTools/Package.resolved b/DevTools/Package.resolved index 72d67c8..2f4a5d6 100644 --- a/DevTools/Package.resolved +++ b/DevTools/Package.resolved @@ -1,41 +1,43 @@ { - "pins" : [ - { - "identity" : "colorizer", - "kind" : "remoteSourceControl", - "location" : "https://github.com/getGuaka/Colorizer.git", - "state" : { - "revision" : "2ccc99bf1715e73c4139e8d40b6e6b30be975586", - "version" : "0.2.1" + "object": { + "pins": [ + { + "package": "Colorizer", + "repositoryURL": "https://github.com/getGuaka/Colorizer.git", + "state": { + "branch": null, + "revision": "2ccc99bf1715e73c4139e8d40b6e6b30be975586", + "version": "0.2.1" + } + }, + { + "package": "swift-argument-parser", + "repositoryURL": "https://github.com/apple/swift-argument-parser.git", + "state": { + "branch": null, + "revision": "9f39744e025c7d377987f30b03770805dcb0bcd1", + "version": "1.1.4" + } + }, + { + "package": "xcbeautify", + "repositoryURL": "https://github.com/tuist/xcbeautify", + "state": { + "branch": null, + "revision": "a3f5db18e7218a3817031b1b8227b1cb5704cb93", + "version": "0.13.0" + } + }, + { + "package": "XMLCoder", + "repositoryURL": "https://github.com/MaxDesiatov/XMLCoder.git", + "state": { + "branch": null, + "revision": "ca932442d7481700f5434a7b138c47dd42d9902b", + "version": "0.14.0" + } } - }, - { - "identity" : "swift-argument-parser", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-argument-parser.git", - "state" : { - "revision" : "9f39744e025c7d377987f30b03770805dcb0bcd1", - "version" : "1.1.4" - } - }, - { - "identity" : "xcbeautify", - "kind" : "remoteSourceControl", - "location" : "https://github.com/tuist/xcbeautify", - "state" : { - "revision" : "a3f5db18e7218a3817031b1b8227b1cb5704cb93", - "version" : "0.13.0" - } - }, - { - "identity" : "xmlcoder", - "kind" : "remoteSourceControl", - "location" : "https://github.com/MaxDesiatov/XMLCoder.git", - "state" : { - "revision" : "ca932442d7481700f5434a7b138c47dd42d9902b", - "version" : "0.14.0" - } - } - ], - "version" : 2 + ] + }, + "version": 1 }