From d3a1cf54e2f81ffd5f77250115df312ffddc02cb Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Wed, 30 Dec 2020 13:56:07 +0100 Subject: [PATCH 1/7] Write generated file to current working directory --- Sources/LibMakeColors/MakeColors.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/LibMakeColors/MakeColors.swift b/Sources/LibMakeColors/MakeColors.swift index b125ec4..8dfa743 100644 --- a/Sources/LibMakeColors/MakeColors.swift +++ b/Sources/LibMakeColors/MakeColors.swift @@ -76,7 +76,8 @@ public final class MakeColors: ParsableCommand, Context { if let output = output { return URL(fileURLWithPath: output) } else { - return URL(fileURLWithPath: input).deletingPathExtension().appendingPathExtension(`extension`) + let basename = URL(fileURLWithPath: input).deletingPathExtension().lastPathComponent + return URL(fileURLWithPath: basename).appendingPathExtension(`extension`) } } } -- 2.45.3 From 87c52e97f6fa6dacb5e8016e25e05bafb01b1d78 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Wed, 30 Dec 2020 14:10:46 +0100 Subject: [PATCH 2/7] Add action to run tests --- .github/workflows/test.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a505bd4 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,15 @@ +name: Test + +on: + pull_request: + paths: + - '.github/workflows/test.yml' + - '**/*.swift' + +jobs: + SwiftLint: + runs-on: macos-latest + steps: + - uses: actions/checkout@v1 + - name: Run tests + run: swift test -- 2.45.3 From 0de2e94d570e563e6d656290536d4832c9e20560 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Wed, 30 Dec 2020 14:22:56 +0100 Subject: [PATCH 3/7] Cache packages --- .github/workflows/test.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a505bd4..106752a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,5 +11,17 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v1 + + - name: Cache Swift packages + uses: actions/cache@v2 + env: + cache-name: cache-swift-packages + with: + path: + - .build/checkouts + - .build/repositories + - .build/workspace-state.json + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Package.resolved') }} + - name: Run tests run: swift test -- 2.45.3 From 390c5880262a66e4cf18299dcde25199c5e77429 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Wed, 30 Dec 2020 14:27:02 +0100 Subject: [PATCH 4/7] Fix cache path. Also build --- .github/workflows/test.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 106752a..9de2c7c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,14 +14,15 @@ jobs: - name: Cache Swift packages uses: actions/cache@v2 - env: - cache-name: cache-swift-packages with: - path: - - .build/checkouts - - .build/repositories - - .build/workspace-state.json - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Package.resolved') }} + path: | + .build/checkouts + .build/repositories + .build/workspace-state.json + key: ${{ runner.os }}-${{ hashFiles('Package.resolved') }} + + - name: Build + run: swift build - name: Run tests run: swift test -- 2.45.3 From 2e13ed67587e8e0212322f5ed65e16efa85aa612 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Wed, 30 Dec 2020 14:30:21 +0100 Subject: [PATCH 5/7] Fix names --- .github/workflows/test.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9de2c7c..be00eaa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,13 +1,10 @@ -name: Test +name: Build and run tests on: pull_request: - paths: - - '.github/workflows/test.yml' - - '**/*.swift' jobs: - SwiftLint: + BuildAndTest: runs-on: macos-latest steps: - uses: actions/checkout@v1 -- 2.45.3 From b7a93fc1de1d66cfb84a93025d81b57b2e1495ad Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Wed, 30 Dec 2020 14:34:48 +0100 Subject: [PATCH 6/7] Add something swiftlint can complain about --- Sources/LibMakeColors/MakeColors.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/LibMakeColors/MakeColors.swift b/Sources/LibMakeColors/MakeColors.swift index 8dfa743..16e76ca 100644 --- a/Sources/LibMakeColors/MakeColors.swift +++ b/Sources/LibMakeColors/MakeColors.swift @@ -76,8 +76,8 @@ public final class MakeColors: ParsableCommand, Context { if let output = output { return URL(fileURLWithPath: output) } else { - let basename = URL(fileURLWithPath: input).deletingPathExtension().lastPathComponent - return URL(fileURLWithPath: basename).appendingPathExtension(`extension`) + let b = URL(fileURLWithPath: input).deletingPathExtension().lastPathComponent + return URL(fileURLWithPath: b).appendingPathExtension(`extension`) } } } -- 2.45.3 From a23ccc82847c744294ec7c310ae57d4ca1d3e310 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Wed, 30 Dec 2020 14:37:46 +0100 Subject: [PATCH 7/7] Revert "Add something swiftlint can complain about" This reverts commit b7a93fc1de1d66cfb84a93025d81b57b2e1495ad. --- Sources/LibMakeColors/MakeColors.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/LibMakeColors/MakeColors.swift b/Sources/LibMakeColors/MakeColors.swift index 16e76ca..8dfa743 100644 --- a/Sources/LibMakeColors/MakeColors.swift +++ b/Sources/LibMakeColors/MakeColors.swift @@ -76,8 +76,8 @@ public final class MakeColors: ParsableCommand, Context { if let output = output { return URL(fileURLWithPath: output) } else { - let b = URL(fileURLWithPath: input).deletingPathExtension().lastPathComponent - return URL(fileURLWithPath: b).appendingPathExtension(`extension`) + let basename = URL(fileURLWithPath: input).deletingPathExtension().lastPathComponent + return URL(fileURLWithPath: basename).appendingPathExtension(`extension`) } } } -- 2.45.3