From f3d2d3e5605644c6837004cf5726646e286e5e5f Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 17:11:13 +0900 Subject: [PATCH 01/52] Changes to use composite --- ...er-build.yml => docker-build.yml.disabled} | 0 ...cker-lint.yml => docker-lint.yml.disabled} | 0 .github/workflows/tests.yml | 45 ++++++++++++ action.yml | 73 ++++++++++++++++++- 4 files changed, 115 insertions(+), 3 deletions(-) rename .github/workflows/{docker-build.yml => docker-build.yml.disabled} (100%) rename .github/workflows/{docker-lint.yml => docker-lint.yml.disabled} (100%) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml.disabled similarity index 100% rename from .github/workflows/docker-build.yml rename to .github/workflows/docker-build.yml.disabled diff --git a/.github/workflows/docker-lint.yml b/.github/workflows/docker-lint.yml.disabled similarity index 100% rename from .github/workflows/docker-lint.yml rename to .github/workflows/docker-lint.yml.disabled diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..7659f5e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,45 @@ +name: Tests + +on: + push: + paths: + - '.github/workflows/test.yml' + - 'action.yml' + pull_request: + paths: + - '.github/workflows/test.yml' + - 'action.yml' + +jobs: + test-errors: + name: Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: sinoru/actions-setup-swift + with: + swift-version: '5.6.1' + - uses: ./ + working-directory: ./test/errors + + test-no-lintable-files: + name: Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: sinoru/actions-setup-swift + with: + swift-version: '5.6.1' + - uses: ./ + working-directory: ./test/no-lintable-files + + test-Warnings: + name: Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: sinoru/actions-setup-swift + with: + swift-version: '5.6.1' + - uses: ./ + working-directory: ./test/Warnings diff --git a/action.yml b/action.yml index bb303d6..5f9fe82 100644 --- a/action.yml +++ b/action.yml @@ -1,9 +1,76 @@ name: 'GitHub Actions for SwiftLint' description: 'A tool to enforce Swift style and conventions' author: 'Jaehong Kang ' -runs: - using: 'docker' - image: 'Dockerfile' branding: icon: 'shield' color: 'orange' +inputs: + swiftlint-version: + description: "A SwiftLint version to use." + required: true + default: '0.47.1' +runs: + using: "composite" + steps: + - run: echo "{SWIFTLINT_PATH}={${{ github.action_path }}/SwiftLint}" >> $GITHUB_ENV + - uses: actions/checkout@v3 + with: + repository: 'realm/SwiftLint' + ref: '${{ inputs.swiftlint-version }}' + path: '${{ github.env.SWIFTLINT_PATH }}' + - run: swift build --package-path '${{ github.env.SWIFTLINT_PATH }}' + - name: SwiftLint + run: | + # Copyright (c) 2018 Norio Nomura + # + # Permission is hereby granted, free of charge, to any person obtaining a copy + # of this software and associated documentation files (the "Software"), to deal + # in the Software without restriction, including without limitation the rights + # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + # copies of the Software, and to permit persons to whom the Software is + # furnished to do so, subject to the following conditions: + # + # The above copyright notice and this permission notice shall be included in all + # copies or substantial portions of the Software. + # + # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + # SOFTWARE. + # + # convert swiftlint's output into GitHub Actions Logging commands + # https://help.github.com/en/github/automating-your-workflow-with-github-actions/development-tools-for-github-actions#logging-commands + + function stripPWD() { + if ! ${WORKING_DIRECTORY+false}; + then + cd - > /dev/null + fi + sed -E "s/$(pwd|sed 's/\//\\\//g')\///" + } + + function convertToGitHubActionsLoggingCommands() { + sed -E 's/^(.*):([0-9]+):([0-9]+): (warning|error|[^:]+): (.*)/::\4 file=\1,line=\2,col=\3::\5/' + } + + if ! ${WORKING_DIRECTORY+false}; + then + cd ${WORKING_DIRECTORY} + fi + + if ! ${DIFF_BASE+false}; + then + changedFiles=$(git --no-pager diff --name-only --relative FETCH_HEAD $(git merge-base FETCH_HEAD $DIFF_BASE) -- '*.swift') + + if [ -z "$changedFiles" ] + then + echo "No Swift file changed" + exit + fi + fi + + set -o pipefail && swift run --package-path '${{ github.env.SWIFTLINT_PATH }}' swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands + shell: bash From 6be380f1c890944d58a7a40e05a159ec6d84fa9b Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 17:12:37 +0900 Subject: [PATCH 02/52] Fixes tests.yml --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7659f5e..cbc65ec 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - uses: sinoru/actions-setup-swift + - uses: sinoru/actions-setup-swift@master with: swift-version: '5.6.1' - uses: ./ @@ -27,7 +27,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - uses: sinoru/actions-setup-swift + - uses: sinoru/actions-setup-swift@master with: swift-version: '5.6.1' - uses: ./ @@ -38,7 +38,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - uses: sinoru/actions-setup-swift + - uses: sinoru/actions-setup-swift@master with: swift-version: '5.6.1' - uses: ./ From ed619c0fbfaa776301a5af7c43eb080f8f1465b6 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 17:13:03 +0900 Subject: [PATCH 03/52] Fixes wrong paths on tests.yml --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cbc65ec..abd9954 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,11 +3,11 @@ name: Tests on: push: paths: - - '.github/workflows/test.yml' + - '.github/workflows/tests.yml' - 'action.yml' pull_request: paths: - - '.github/workflows/test.yml' + - '.github/workflows/tests.yml' - 'action.yml' jobs: From 2ba7d393e4f79dac4d511c2508ef0dc318992077 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 17:18:29 +0900 Subject: [PATCH 04/52] Adds working-directory as actions input --- .github/workflows/tests.yml | 9 ++++++--- action.yml | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index abd9954..c0b5f45 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,7 +20,8 @@ jobs: with: swift-version: '5.6.1' - uses: ./ - working-directory: ./test/errors + with: + working-directory: ./test/errors test-no-lintable-files: name: Tests @@ -31,7 +32,8 @@ jobs: with: swift-version: '5.6.1' - uses: ./ - working-directory: ./test/no-lintable-files + with: + working-directory: ./test/no-lintable-files test-Warnings: name: Tests @@ -42,4 +44,5 @@ jobs: with: swift-version: '5.6.1' - uses: ./ - working-directory: ./test/Warnings + with: + working-directory: ./test/Warnings diff --git a/action.yml b/action.yml index 5f9fe82..8b8ce3c 100644 --- a/action.yml +++ b/action.yml @@ -9,6 +9,9 @@ inputs: description: "A SwiftLint version to use." required: true default: '0.47.1' + working-directory: + required: true + default: ${{ github.workspace }} runs: using: "composite" steps: @@ -74,3 +77,4 @@ runs: set -o pipefail && swift run --package-path '${{ github.env.SWIFTLINT_PATH }}' swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands shell: bash + working-directory: '${{ inputs.working-directory }}' From d42df622c80accf8621d8cba5654a86ab46efa2f Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 17:19:08 +0900 Subject: [PATCH 05/52] Using main instead of master --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c0b5f45..a2a180a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - uses: sinoru/actions-setup-swift@master + - uses: sinoru/actions-setup-swift@main with: swift-version: '5.6.1' - uses: ./ @@ -28,7 +28,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - uses: sinoru/actions-setup-swift@master + - uses: sinoru/actions-setup-swift@main with: swift-version: '5.6.1' - uses: ./ @@ -40,7 +40,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - uses: sinoru/actions-setup-swift@master + - uses: sinoru/actions-setup-swift@main with: swift-version: '5.6.1' - uses: ./ From de369b463767bf3e39086a30c204068d61370299 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 17:21:25 +0900 Subject: [PATCH 06/52] Adds shell --- action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/action.yml b/action.yml index 8b8ce3c..5392aea 100644 --- a/action.yml +++ b/action.yml @@ -16,12 +16,14 @@ runs: using: "composite" steps: - run: echo "{SWIFTLINT_PATH}={${{ github.action_path }}/SwiftLint}" >> $GITHUB_ENV + shell: bash - uses: actions/checkout@v3 with: repository: 'realm/SwiftLint' ref: '${{ inputs.swiftlint-version }}' path: '${{ github.env.SWIFTLINT_PATH }}' - run: swift build --package-path '${{ github.env.SWIFTLINT_PATH }}' + shell: bash - name: SwiftLint run: | # Copyright (c) 2018 Norio Nomura From fa45bae797db0166a47d3266c7394429f553b5ab Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 17:27:18 +0900 Subject: [PATCH 07/52] Update working-directory value --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 5392aea..a9aa60f 100644 --- a/action.yml +++ b/action.yml @@ -11,7 +11,7 @@ inputs: default: '0.47.1' working-directory: required: true - default: ${{ github.workspace }} + default: '' runs: using: "composite" steps: @@ -79,4 +79,4 @@ runs: set -o pipefail && swift run --package-path '${{ github.env.SWIFTLINT_PATH }}' swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands shell: bash - working-directory: '${{ inputs.working-directory }}' + working-directory: '${{ github.workspace }}/${{ inputs.working-directory }}' From 9a76ab5484f2e663c70047a643353b84a226ff74 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 17:27:42 +0900 Subject: [PATCH 08/52] Uses release configurations --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index a9aa60f..f3ea08e 100644 --- a/action.yml +++ b/action.yml @@ -22,7 +22,7 @@ runs: repository: 'realm/SwiftLint' ref: '${{ inputs.swiftlint-version }}' path: '${{ github.env.SWIFTLINT_PATH }}' - - run: swift build --package-path '${{ github.env.SWIFTLINT_PATH }}' + - run: swift build --package-path '${{ github.env.SWIFTLINT_PATH }}' -c 'release' shell: bash - name: SwiftLint run: | @@ -77,6 +77,6 @@ runs: fi fi - set -o pipefail && swift run --package-path '${{ github.env.SWIFTLINT_PATH }}' swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands + set -o pipefail && swift run --package-path '${{ github.env.SWIFTLINT_PATH }}' -c 'release' swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands shell: bash working-directory: '${{ github.workspace }}/${{ inputs.working-directory }}' From fd1f809f169ef1ba9c51c75400c5eb75a8753a61 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 17:34:29 +0900 Subject: [PATCH 09/52] Update to uses cache --- action.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index f3ea08e..72ba309 100644 --- a/action.yml +++ b/action.yml @@ -15,14 +15,22 @@ inputs: runs: using: "composite" steps: - - run: echo "{SWIFTLINT_PATH}={${{ github.action_path }}/SwiftLint}" >> $GITHUB_ENV + - run: | + echo "{SWIFTLINT_PATH}={${{ github.action_path }}/SwiftLint}" >> $GITHUB_ENV + echo "{SWIFTLINT_PACKAGE_ARGS}={--package-path '$SWIFTLINT_PATH' -c release --manifest-cache local}" shell: bash - uses: actions/checkout@v3 with: repository: 'realm/SwiftLint' ref: '${{ inputs.swiftlint-version }}' path: '${{ github.env.SWIFTLINT_PATH }}' - - run: swift build --package-path '${{ github.env.SWIFTLINT_PATH }}' -c 'release' + - uses: actions/cache@v3 + with: + path: '${{ github.env.SWIFTLINT_PATH }}/.build' + key: swiftlint-${{ runner.os }}-spm-${{ inputs.swiftlint-version }}-${{ hashFiles('${{ github.env.SWIFTLINT_PATH }}/Package.*') }} + restore-keys: | + ${{ runner.os }}-spm-${{ inputs.swiftlint-version }}- + - run: swift build $SWIFTLINT_PACKAGE_ARGS shell: bash - name: SwiftLint run: | @@ -77,6 +85,6 @@ runs: fi fi - set -o pipefail && swift run --package-path '${{ github.env.SWIFTLINT_PATH }}' -c 'release' swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands + set -o pipefail && swift run $SWIFTLINT_PACKAGE_ARGS swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands shell: bash working-directory: '${{ github.workspace }}/${{ inputs.working-directory }}' From 750b4bdef10a029afffae179f75a72ea3a165d8d Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 17:37:16 +0900 Subject: [PATCH 10/52] Update envs --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 72ba309..713dd46 100644 --- a/action.yml +++ b/action.yml @@ -16,8 +16,8 @@ runs: using: "composite" steps: - run: | - echo "{SWIFTLINT_PATH}={${{ github.action_path }}/SwiftLint}" >> $GITHUB_ENV - echo "{SWIFTLINT_PACKAGE_ARGS}={--package-path '$SWIFTLINT_PATH' -c release --manifest-cache local}" + echo "{SWIFTLINT_PATH}={${{ github.action_path }}SwiftLint}" >> $GITHUB_ENV + echo "{SWIFTLINT_PACKAGE_ARGS}={--package-path '${{ github.action_path }}SwiftLint' -c release --manifest-cache local}" shell: bash - uses: actions/checkout@v3 with: From 311434d31a6e46e2596f59171a1852eeaa1c4c15 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 17:46:02 +0900 Subject: [PATCH 11/52] Minor changes on path calc --- .github/workflows/tests.yml | 6 +++--- action.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a2a180a..14060dd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,7 @@ jobs: swift-version: '5.6.1' - uses: ./ with: - working-directory: ./test/errors + working-directory: test/errors test-no-lintable-files: name: Tests @@ -33,7 +33,7 @@ jobs: swift-version: '5.6.1' - uses: ./ with: - working-directory: ./test/no-lintable-files + working-directory: test/no-lintable-files test-Warnings: name: Tests @@ -45,4 +45,4 @@ jobs: swift-version: '5.6.1' - uses: ./ with: - working-directory: ./test/Warnings + working-directory: test/Warnings diff --git a/action.yml b/action.yml index 713dd46..fef1218 100644 --- a/action.yml +++ b/action.yml @@ -87,4 +87,4 @@ runs: set -o pipefail && swift run $SWIFTLINT_PACKAGE_ARGS swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands shell: bash - working-directory: '${{ github.workspace }}/${{ inputs.working-directory }}' + working-directory: '${{ github.workspace }}${{ inputs.working-directory }}' From 97dffa42e9b63d232e609919973a5bedf3f7d20b Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 17:47:55 +0900 Subject: [PATCH 12/52] Using shell file --- action.yml | 55 +---------------------------------- entrypoint.sh => swiftlint.sh | 2 +- 2 files changed, 2 insertions(+), 55 deletions(-) rename entrypoint.sh => swiftlint.sh (93%) diff --git a/action.yml b/action.yml index fef1218..2f95f62 100644 --- a/action.yml +++ b/action.yml @@ -32,59 +32,6 @@ runs: ${{ runner.os }}-spm-${{ inputs.swiftlint-version }}- - run: swift build $SWIFTLINT_PACKAGE_ARGS shell: bash - - name: SwiftLint - run: | - # Copyright (c) 2018 Norio Nomura - # - # Permission is hereby granted, free of charge, to any person obtaining a copy - # of this software and associated documentation files (the "Software"), to deal - # in the Software without restriction, including without limitation the rights - # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - # copies of the Software, and to permit persons to whom the Software is - # furnished to do so, subject to the following conditions: - # - # The above copyright notice and this permission notice shall be included in all - # copies or substantial portions of the Software. - # - # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - # SOFTWARE. - # - # convert swiftlint's output into GitHub Actions Logging commands - # https://help.github.com/en/github/automating-your-workflow-with-github-actions/development-tools-for-github-actions#logging-commands - - function stripPWD() { - if ! ${WORKING_DIRECTORY+false}; - then - cd - > /dev/null - fi - sed -E "s/$(pwd|sed 's/\//\\\//g')\///" - } - - function convertToGitHubActionsLoggingCommands() { - sed -E 's/^(.*):([0-9]+):([0-9]+): (warning|error|[^:]+): (.*)/::\4 file=\1,line=\2,col=\3::\5/' - } - - if ! ${WORKING_DIRECTORY+false}; - then - cd ${WORKING_DIRECTORY} - fi - - if ! ${DIFF_BASE+false}; - then - changedFiles=$(git --no-pager diff --name-only --relative FETCH_HEAD $(git merge-base FETCH_HEAD $DIFF_BASE) -- '*.swift') - - if [ -z "$changedFiles" ] - then - echo "No Swift file changed" - exit - fi - fi - - set -o pipefail && swift run $SWIFTLINT_PACKAGE_ARGS swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands + - run: swiftlint.sh shell: bash working-directory: '${{ github.workspace }}${{ inputs.working-directory }}' diff --git a/entrypoint.sh b/swiftlint.sh similarity index 93% rename from entrypoint.sh rename to swiftlint.sh index 66e194a..cfa9cbf 100755 --- a/entrypoint.sh +++ b/swiftlint.sh @@ -50,4 +50,4 @@ then fi fi -set -o pipefail && swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands +set -o pipefail && swift run $SWIFTLINT_PACKAGE_ARGS swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands From 48c24b8159d355f4e6eb5671c440d1b67b63bd9a Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 17:48:22 +0900 Subject: [PATCH 13/52] Adds shellfile on github actions push paths --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 14060dd..cc5ee48 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,10 +5,12 @@ on: paths: - '.github/workflows/tests.yml' - 'action.yml' + - 'swiftlint.sh' pull_request: paths: - '.github/workflows/tests.yml' - 'action.yml' + - 'swiftlint.sh' jobs: test-errors: From 86991fd8d052feb9e403c0b863bfc51f07f067be Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 17:49:42 +0900 Subject: [PATCH 14/52] Update path calc. --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 2f95f62..cffafbd 100644 --- a/action.yml +++ b/action.yml @@ -16,8 +16,8 @@ runs: using: "composite" steps: - run: | - echo "{SWIFTLINT_PATH}={${{ github.action_path }}SwiftLint}" >> $GITHUB_ENV - echo "{SWIFTLINT_PACKAGE_ARGS}={--package-path '${{ github.action_path }}SwiftLint' -c release --manifest-cache local}" + echo "{SWIFTLINT_PATH}={${{ github.action_path }}/SwiftLint}" >> $GITHUB_ENV + echo "{SWIFTLINT_PACKAGE_ARGS}={--package-path '${{ github.action_path }}/SwiftLint' -c release --manifest-cache local}" shell: bash - uses: actions/checkout@v3 with: @@ -34,4 +34,4 @@ runs: shell: bash - run: swiftlint.sh shell: bash - working-directory: '${{ github.workspace }}${{ inputs.working-directory }}' + working-directory: '${{ github.workspace }}/${{ inputs.working-directory }}' From 02885c804a14b8547c9586d97ac917aa71236d0e Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 17:49:58 +0900 Subject: [PATCH 15/52] Remove docker related files --- .dockerfilelintrc | 2 - .dockerignore | 1 - .github/workflows/docker-build.yml.disabled | 87 --------------------- .github/workflows/docker-lint.yml.disabled | 46 ----------- Dockerfile | 13 --- 5 files changed, 149 deletions(-) delete mode 100644 .dockerfilelintrc delete mode 100644 .dockerignore delete mode 100644 .github/workflows/docker-build.yml.disabled delete mode 100644 .github/workflows/docker-lint.yml.disabled delete mode 100644 Dockerfile diff --git a/.dockerfilelintrc b/.dockerfilelintrc deleted file mode 100644 index d429d77..0000000 --- a/.dockerfilelintrc +++ /dev/null @@ -1,2 +0,0 @@ -rules: - latest_tag: off diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 6b8710a..0000000 --- a/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -.git diff --git a/.github/workflows/docker-build.yml.disabled b/.github/workflows/docker-build.yml.disabled deleted file mode 100644 index 4f4c99d..0000000 --- a/.github/workflows/docker-build.yml.disabled +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright (c) 2018 Norio Nomura -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -name: Docker Build - -on: - push: - paths: - - '.dockerignore' - - '.github/workflows/docker-build.yml' - - 'Dockerfile' - - 'entrypoint.sh' - pull_request: - paths: - - '.dockerignore' - - '.github/workflows/docker-build.yml' - - 'Dockerfile' - - 'entrypoint.sh' - -jobs: - DockerBuild: - name: Docker Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Docker Build - run: docker build -t action-swiftlint . - - - name: Exit Status on Errors - run: | - STATUS=$(docker run -v $(pwd):$(pwd) -w $(pwd) --rm action-swiftlint &>/dev/null; echo $?) - [[ $STATUS == "2" ]] - working-directory: ./test/errors - shell: bash - - - name: Exit Status on No lintable files - run: | - STATUS=$(docker run -v $(pwd):$(pwd) -w $(pwd) --rm action-swiftlint &>/dev/null; echo $?) - [[ $STATUS == "1" ]] - working-directory: ./test/no-lintable-files - shell: bash - - - name: Exit Status on Warnings - run: | - STATUS=$(docker run -v $(pwd):$(pwd) -w $(pwd) --rm action-swiftlint &>/dev/null; echo $?) - [[ $STATUS == "0" ]] - working-directory: ./test/Warnings - shell: bash - - - name: Exit Status on Warnings with `--strict` - run: | - STATUS=$(docker run -v $(pwd):$(pwd) -w $(pwd) --rm action-swiftlint --strict &>/dev/null; echo $?) - [[ $STATUS == "2" ]] - working-directory: ./test/Warnings - shell: bash - - - name: Output on Errors - run: diff <(docker run -v $(pwd):$(pwd) -w $(pwd) --rm action-swiftlint|sort) expected.txt - working-directory: ./test/errors - shell: bash - - - name: Output on Warnings - run: diff <(docker run -v $(pwd):$(pwd) -w $(pwd) --rm action-swiftlint|sort) expected.txt - working-directory: ./test/Warnings - shell: bash - - - name: Output on Warnings with WORKING_DIRECTORY environment variable - run: diff <(docker run -v $(pwd):$(pwd) -w $(pwd) --rm --env WORKING_DIRECTORY=Warnings action-swiftlint|sort) <(cat Warnings/expected.txt | sed -E 's/^(.*)file=(.*),(.*)/\1file=Warnings\/\2,\3/') - working-directory: ./test - shell: bash diff --git a/.github/workflows/docker-lint.yml.disabled b/.github/workflows/docker-lint.yml.disabled deleted file mode 100644 index 6049d52..0000000 --- a/.github/workflows/docker-lint.yml.disabled +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (c) 2018 Norio Nomura -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -name: Docker Lint - -on: - push: - paths: - - '.github/workflows/docker-lint.yml' - - '.dockerfilelintrc' - - '.dockerignore' - - 'Dockerfile' - pull_request: - paths: - - '.github/workflows/docker-lint.yml' - - '.dockerfilelintrc' - - '.dockerignore' - - 'Dockerfile' - -jobs: - DockerLint: - name: Docker Lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Docker Lint - uses: docker://replicated/dockerfilelint - with: - args: Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 6d49f7b..0000000 --- a/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM ghcr.io/realm/swiftlint:latest -LABEL version="5.0.0" -LABEL repository="https://github.com/sinoru/actions-swiftlint" -LABEL homepage="https://github.com/sinoru/actions-swiftlint" -LABEL maintainer="Jaehong Kang " - -LABEL "com.github.actions.name"="GitHub Action for SwiftLint" -LABEL "com.github.actions.description"="A tool to enforce Swift style and conventions." -LABEL "com.github.actions.icon"="shield" -LABEL "com.github.actions.color"="orange" - -COPY entrypoint.sh / -ENTRYPOINT ["/entrypoint.sh"] From d447d7ea6c4f241ef3f225b61634ca8c26462c1a Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 09:09:01 +0000 Subject: [PATCH 16/52] Update to use as actions not other than paths. --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cc5ee48..3f98520 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,7 @@ jobs: - uses: sinoru/actions-setup-swift@main with: swift-version: '5.6.1' - - uses: ./ + - uses: sinoru/actions-swiftlint@${{ github.ref }} with: working-directory: test/errors @@ -33,7 +33,7 @@ jobs: - uses: sinoru/actions-setup-swift@main with: swift-version: '5.6.1' - - uses: ./ + - uses: sinoru/actions-swiftlint@${{ github.ref }} with: working-directory: test/no-lintable-files @@ -45,6 +45,6 @@ jobs: - uses: sinoru/actions-setup-swift@main with: swift-version: '5.6.1' - - uses: ./ + - uses: sinoru/actions-swiftlint@${{ github.ref }} with: working-directory: test/Warnings From 0a43fd93df166c51750b86e31ef1839af7668dae Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 13:10:28 +0000 Subject: [PATCH 17/52] Revert "Update to use as actions not other than paths." This reverts commit d447d7ea6c4f241ef3f225b61634ca8c26462c1a. --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3f98520..cc5ee48 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,7 @@ jobs: - uses: sinoru/actions-setup-swift@main with: swift-version: '5.6.1' - - uses: sinoru/actions-swiftlint@${{ github.ref }} + - uses: ./ with: working-directory: test/errors @@ -33,7 +33,7 @@ jobs: - uses: sinoru/actions-setup-swift@main with: swift-version: '5.6.1' - - uses: sinoru/actions-swiftlint@${{ github.ref }} + - uses: ./ with: working-directory: test/no-lintable-files @@ -45,6 +45,6 @@ jobs: - uses: sinoru/actions-setup-swift@main with: swift-version: '5.6.1' - - uses: sinoru/actions-swiftlint@${{ github.ref }} + - uses: ./ with: working-directory: test/Warnings From f673a1c1d13190720b95ebfed30c7f54cbada8f4 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 13:23:06 +0000 Subject: [PATCH 18/52] Adds debug codes --- action.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/action.yml b/action.yml index cffafbd..8adb9b2 100644 --- a/action.yml +++ b/action.yml @@ -32,6 +32,12 @@ runs: ${{ runner.os }}-spm-${{ inputs.swiftlint-version }}- - run: swift build $SWIFTLINT_PACKAGE_ARGS shell: bash + - run: | + pwd + ls -la + ls -la $SWITLINT_PATH + ls -la ${{ github.workspace }} + ls -la ${{ github.workspace }}/${{ inputs.working-directory }} - run: swiftlint.sh shell: bash working-directory: '${{ github.workspace }}/${{ inputs.working-directory }}' From 6a7fa8a5c6e01a73b572b9d5b06be0727f3effa4 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 13:24:49 +0000 Subject: [PATCH 19/52] Forgot to add shell --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 8adb9b2..3c9ccf3 100644 --- a/action.yml +++ b/action.yml @@ -38,6 +38,7 @@ runs: ls -la $SWITLINT_PATH ls -la ${{ github.workspace }} ls -la ${{ github.workspace }}/${{ inputs.working-directory }} + shell: bash - run: swiftlint.sh shell: bash working-directory: '${{ github.workspace }}/${{ inputs.working-directory }}' From f315a632b33517407f9c4219ef7ce3556abc9895 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 13:31:41 +0000 Subject: [PATCH 20/52] Add Debug codes --- action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/action.yml b/action.yml index 3c9ccf3..171cd27 100644 --- a/action.yml +++ b/action.yml @@ -19,6 +19,10 @@ runs: echo "{SWIFTLINT_PATH}={${{ github.action_path }}/SwiftLint}" >> $GITHUB_ENV echo "{SWIFTLINT_PACKAGE_ARGS}={--package-path '${{ github.action_path }}/SwiftLint' -c release --manifest-cache local}" shell: bash + - run: | + echo ${{ github.env.SWIFTLINT_PATH }} + echo $SWIFTLINT_PATH + shell: bash - uses: actions/checkout@v3 with: repository: 'realm/SwiftLint' From d3ddfe750d9b052fa7b68cdcc79d875908356010 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 13:37:49 +0000 Subject: [PATCH 21/52] Fixes wrong env set --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 171cd27..88d9653 100644 --- a/action.yml +++ b/action.yml @@ -16,11 +16,11 @@ runs: using: "composite" steps: - run: | - echo "{SWIFTLINT_PATH}={${{ github.action_path }}/SwiftLint}" >> $GITHUB_ENV - echo "{SWIFTLINT_PACKAGE_ARGS}={--package-path '${{ github.action_path }}/SwiftLint' -c release --manifest-cache local}" + echo "SWIFTLINT_PATH=${{ github.action_path }}/SwiftLint" >> $GITHUB_ENV + echo "SWIFTLINT_PACKAGE_ARGS=--package-path '${{ github.action_path }}/SwiftLint' -c release --manifest-cache local" shell: bash - run: | - echo ${{ github.env.SWIFTLINT_PATH }} + echo ${{ env.SWIFTLINT_PATH }} echo $SWIFTLINT_PATH shell: bash - uses: actions/checkout@v3 From 7cee76090d943282f3d1c966b1f5694275b74aa1 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 13:43:06 +0000 Subject: [PATCH 22/52] Fixes using env instead of github.env --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 88d9653..7f61e28 100644 --- a/action.yml +++ b/action.yml @@ -27,11 +27,11 @@ runs: with: repository: 'realm/SwiftLint' ref: '${{ inputs.swiftlint-version }}' - path: '${{ github.env.SWIFTLINT_PATH }}' + path: '${{ env.SWIFTLINT_PATH }}' - uses: actions/cache@v3 with: - path: '${{ github.env.SWIFTLINT_PATH }}/.build' - key: swiftlint-${{ runner.os }}-spm-${{ inputs.swiftlint-version }}-${{ hashFiles('${{ github.env.SWIFTLINT_PATH }}/Package.*') }} + path: '${{ env.SWIFTLINT_PATH }}/.build' + key: swiftlint-${{ runner.os }}-spm-${{ inputs.swiftlint-version }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} restore-keys: | ${{ runner.os }}-spm-${{ inputs.swiftlint-version }}- - run: swift build $SWIFTLINT_PACKAGE_ARGS From df0364601149629c28c39edca9e6460ddb94e10d Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 13:45:58 +0000 Subject: [PATCH 23/52] Fixes SWIFTLINT_PACKAGE_ARGS --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 7f61e28..035b809 100644 --- a/action.yml +++ b/action.yml @@ -16,8 +16,8 @@ runs: using: "composite" steps: - run: | - echo "SWIFTLINT_PATH=${{ github.action_path }}/SwiftLint" >> $GITHUB_ENV - echo "SWIFTLINT_PACKAGE_ARGS=--package-path '${{ github.action_path }}/SwiftLint' -c release --manifest-cache local" + echo 'SWIFTLINT_PATH=${{ github.action_path }}/SwiftLint' >> $GITHUB_ENV + echo 'SWIFTLINT_PACKAGE_ARGS=--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local' shell: bash - run: | echo ${{ env.SWIFTLINT_PATH }} From 6261b57c4c8f0502d23afbed19a67ce1ec9f29d1 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 13:47:37 +0000 Subject: [PATCH 24/52] Fixes wrong SWIFTLINT_PACKAGE_ARGS --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 035b809..af75d2d 100644 --- a/action.yml +++ b/action.yml @@ -17,7 +17,7 @@ runs: steps: - run: | echo 'SWIFTLINT_PATH=${{ github.action_path }}/SwiftLint' >> $GITHUB_ENV - echo 'SWIFTLINT_PACKAGE_ARGS=--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local' + echo 'SWIFTLINT_PACKAGE_ARGS=--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local' >> $GITHUB_ENV shell: bash - run: | echo ${{ env.SWIFTLINT_PATH }} From 61d0ee4b6997a3c6b555c5ae7fb69ac3c16fcc21 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 13:49:51 +0000 Subject: [PATCH 25/52] Fixes SWIFTLINT_PACKAGE_ARGS --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index af75d2d..1e402cd 100644 --- a/action.yml +++ b/action.yml @@ -17,7 +17,7 @@ runs: steps: - run: | echo 'SWIFTLINT_PATH=${{ github.action_path }}/SwiftLint' >> $GITHUB_ENV - echo 'SWIFTLINT_PACKAGE_ARGS=--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local' >> $GITHUB_ENV + echo 'SWIFTLINT_PACKAGE_ARGS=--package-path "${{ github.action_path }}/SwiftLint" -c release --manifest-cache local' >> $GITHUB_ENV shell: bash - run: | echo ${{ env.SWIFTLINT_PATH }} From ea628f140074dd57e1f1c865d4cf5b4b2c2fa36e Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 13:53:39 +0000 Subject: [PATCH 26/52] Using dot --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cc5ee48..48be8fe 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,7 @@ jobs: - uses: sinoru/actions-setup-swift@main with: swift-version: '5.6.1' - - uses: ./ + - uses: . with: working-directory: test/errors @@ -33,7 +33,7 @@ jobs: - uses: sinoru/actions-setup-swift@main with: swift-version: '5.6.1' - - uses: ./ + - uses: . with: working-directory: test/no-lintable-files @@ -45,6 +45,6 @@ jobs: - uses: sinoru/actions-setup-swift@main with: swift-version: '5.6.1' - - uses: ./ + - uses: . with: working-directory: test/Warnings From b6eabc36303aee7a0dca7f278302538dbfef8828 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 13:54:43 +0000 Subject: [PATCH 27/52] Revert "Using dot" This reverts commit ea628f140074dd57e1f1c865d4cf5b4b2c2fa36e. --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 48be8fe..cc5ee48 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,7 @@ jobs: - uses: sinoru/actions-setup-swift@main with: swift-version: '5.6.1' - - uses: . + - uses: ./ with: working-directory: test/errors @@ -33,7 +33,7 @@ jobs: - uses: sinoru/actions-setup-swift@main with: swift-version: '5.6.1' - - uses: . + - uses: ./ with: working-directory: test/no-lintable-files @@ -45,6 +45,6 @@ jobs: - uses: sinoru/actions-setup-swift@main with: swift-version: '5.6.1' - - uses: . + - uses: ./ with: working-directory: test/Warnings From 843d431d833179d036a3192097dc2afab4797a03 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 13:56:55 +0000 Subject: [PATCH 28/52] Using realpath to path normalization --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 1e402cd..d14f6b9 100644 --- a/action.yml +++ b/action.yml @@ -16,8 +16,8 @@ runs: using: "composite" steps: - run: | - echo 'SWIFTLINT_PATH=${{ github.action_path }}/SwiftLint' >> $GITHUB_ENV - echo 'SWIFTLINT_PACKAGE_ARGS=--package-path "${{ github.action_path }}/SwiftLint" -c release --manifest-cache local' >> $GITHUB_ENV + echo 'SWIFTLINT_PATH=$(realpath ${{ github.action_path }}/SwiftLint)' >> $GITHUB_ENV + echo 'SWIFTLINT_PACKAGE_ARGS=--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local' >> $GITHUB_ENV shell: bash - run: | echo ${{ env.SWIFTLINT_PATH }} From 3fadfb972a49764ef8e40a3a90e63c7489dea57a Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 13:59:31 +0000 Subject: [PATCH 29/52] Fixes env set --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index d14f6b9..afa1995 100644 --- a/action.yml +++ b/action.yml @@ -16,8 +16,8 @@ runs: using: "composite" steps: - run: | - echo 'SWIFTLINT_PATH=$(realpath ${{ github.action_path }}/SwiftLint)' >> $GITHUB_ENV - echo 'SWIFTLINT_PACKAGE_ARGS=--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local' >> $GITHUB_ENV + echo SWIFTLINT_PATH="$(realpath ${{ github.action_path }}/SwiftLint)" >> $GITHUB_ENV + echo SWIFTLINT_PACKAGE_ARGS="--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local" >> $GITHUB_ENV shell: bash - run: | echo ${{ env.SWIFTLINT_PATH }} From ee2fc7f4434d6444a0e0aa34936f9387a2d3158a Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 14:01:30 +0000 Subject: [PATCH 30/52] Fixes env set --- action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index afa1995..ec859a3 100644 --- a/action.yml +++ b/action.yml @@ -16,7 +16,9 @@ runs: using: "composite" steps: - run: | - echo SWIFTLINT_PATH="$(realpath ${{ github.action_path }}/SwiftLint)" >> $GITHUB_ENV + export SWIFTLINT_PATH="$(realpath ${{ github.action_path }}/SwiftLint)" + + echo SWIFTLINT_PATH="$SWIFTLINT_PATH" >> $GITHUB_ENV echo SWIFTLINT_PACKAGE_ARGS="--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local" >> $GITHUB_ENV shell: bash - run: | From ee651a82b5e8b3506a6d5849f98d4bed83de4b81 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 23:44:03 +0900 Subject: [PATCH 31/52] Fixes to use right swiftlint --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index ec859a3..4382bb3 100644 --- a/action.yml +++ b/action.yml @@ -45,6 +45,6 @@ runs: ls -la ${{ github.workspace }} ls -la ${{ github.workspace }}/${{ inputs.working-directory }} shell: bash - - run: swiftlint.sh + - run: ${{ github.action_path }}/swiftlint.sh shell: bash working-directory: '${{ github.workspace }}/${{ inputs.working-directory }}' From ce63993b96fbd1da8a6bd91e11cb6bef5973f834 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Sun, 8 May 2022 23:54:58 +0900 Subject: [PATCH 32/52] Remove debug codes, adds some name on action.yml --- action.yml | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/action.yml b/action.yml index 4382bb3..0278553 100644 --- a/action.yml +++ b/action.yml @@ -15,16 +15,13 @@ inputs: runs: using: "composite" steps: - - run: | + - name: + run: | export SWIFTLINT_PATH="$(realpath ${{ github.action_path }}/SwiftLint)" echo SWIFTLINT_PATH="$SWIFTLINT_PATH" >> $GITHUB_ENV echo SWIFTLINT_PACKAGE_ARGS="--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local" >> $GITHUB_ENV shell: bash - - run: | - echo ${{ env.SWIFTLINT_PATH }} - echo $SWIFTLINT_PATH - shell: bash - uses: actions/checkout@v3 with: repository: 'realm/SwiftLint' @@ -36,15 +33,10 @@ runs: key: swiftlint-${{ runner.os }}-spm-${{ inputs.swiftlint-version }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} restore-keys: | ${{ runner.os }}-spm-${{ inputs.swiftlint-version }}- - - run: swift build $SWIFTLINT_PACKAGE_ARGS - shell: bash - - run: | - pwd - ls -la - ls -la $SWITLINT_PATH - ls -la ${{ github.workspace }} - ls -la ${{ github.workspace }}/${{ inputs.working-directory }} + - name: swift build + run: swift build $SWIFTLINT_PACKAGE_ARGS shell: bash - - run: ${{ github.action_path }}/swiftlint.sh + - name: swift run + run: ${{ github.action_path }}/swiftlint.sh shell: bash working-directory: '${{ github.workspace }}/${{ inputs.working-directory }}' From 817cacc8c627da202ae7b79b0a69d54c7ebdcce6 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 00:11:21 +0900 Subject: [PATCH 33/52] Adds swiftlint-args, Removes WORKING_DIRECTORY env --- README.md | 4 ++-- action.yml | 8 +++++--- swiftlint.sh | 9 --------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 01b1bb1..a403a11 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ jobs: - name: GitHub Actions for SwiftLint with --strict uses: sinoru/actions-swiftlint@v5 with: - args: --strict + swiftlint-args: --strict - name: GitHub Actions for SwiftLint (Only files changed in the PR) uses: sinoru/actions-swiftlint@v5 env: @@ -34,5 +34,5 @@ jobs: - name: GitHub Actions for SwiftLint (Different working directory) uses: sinoru/actions-swiftlint@v5 env: - WORKING_DIRECTORY: Source + working-directory: Source ``` diff --git a/action.yml b/action.yml index 0278553..22cb335 100644 --- a/action.yml +++ b/action.yml @@ -9,14 +9,16 @@ inputs: description: "A SwiftLint version to use." required: true default: '0.47.1' + swiftlint-args: + description: "Arguments to SwiftLint." + required: false working-directory: required: true default: '' runs: using: "composite" steps: - - name: - run: | + - run: | export SWIFTLINT_PATH="$(realpath ${{ github.action_path }}/SwiftLint)" echo SWIFTLINT_PATH="$SWIFTLINT_PATH" >> $GITHUB_ENV @@ -37,6 +39,6 @@ runs: run: swift build $SWIFTLINT_PACKAGE_ARGS shell: bash - name: swift run - run: ${{ github.action_path }}/swiftlint.sh + run: ${{ github.action_path }}/swiftlint.sh ${{ inputs.swiftlint-args }} shell: bash working-directory: '${{ github.workspace }}/${{ inputs.working-directory }}' diff --git a/swiftlint.sh b/swiftlint.sh index cfa9cbf..1b353c5 100755 --- a/swiftlint.sh +++ b/swiftlint.sh @@ -23,10 +23,6 @@ # https://help.github.com/en/github/automating-your-workflow-with-github-actions/development-tools-for-github-actions#logging-commands function stripPWD() { - if ! ${WORKING_DIRECTORY+false}; - then - cd - > /dev/null - fi sed -E "s/$(pwd|sed 's/\//\\\//g')\///" } @@ -34,11 +30,6 @@ function convertToGitHubActionsLoggingCommands() { sed -E 's/^(.*):([0-9]+):([0-9]+): (warning|error|[^:]+): (.*)/::\4 file=\1,line=\2,col=\3::\5/' } -if ! ${WORKING_DIRECTORY+false}; -then - cd ${WORKING_DIRECTORY} -fi - if ! ${DIFF_BASE+false}; then changedFiles=$(git --no-pager diff --name-only --relative FETCH_HEAD $(git merge-base FETCH_HEAD $DIFF_BASE) -- '*.swift') From 86dc1c3a2986f8fbbf69422f209c7f69f2578c51 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 00:19:33 +0900 Subject: [PATCH 34/52] Update tests.yml --- .github/workflows/tests.yml | 111 +++++++++++++++++++++++++++++++----- 1 file changed, 96 insertions(+), 15 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cc5ee48..5f44589 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,3 +1,26 @@ +# Copyright (c) 2018 Norio Nomura +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# Copyright (c) 2022 Jaehong Kang +# Licensed under Apache License v2.0 + name: Tests on: @@ -13,8 +36,8 @@ on: - 'swiftlint.sh' jobs: - test-errors: - name: Tests + test-actions: + name: Actions Tests runs-on: ubuntu-latest steps: - uses: actions/checkout@master @@ -23,28 +46,86 @@ jobs: swift-version: '5.6.1' - uses: ./ with: - working-directory: test/errors - - test-no-lintable-files: - name: Tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - uses: sinoru/actions-setup-swift@main + working-directory: test/Warnings + - uses: ./ with: - swift-version: '5.6.1' + swiftlint-args: --strict + working-directory: test/Warnings + continue-on-error: true + - uses: ./ + with: + working-directory: test/errors + continue-on-error: true - uses: ./ with: working-directory: test/no-lintable-files + continue-on-error: true - test-Warnings: - name: Tests + test-swiftlint: + name: SwiftLint Tests runs-on: ubuntu-latest steps: - uses: actions/checkout@master - uses: sinoru/actions-setup-swift@main with: swift-version: '5.6.1' - - uses: ./ + - run: | + export SWIFTLINT_PATH="$(realpath ${{ github.workspace }}/SwiftLint)" + + echo SWIFTLINT_PATH="$SWIFTLINT_PATH" >> $GITHUB_ENV + echo SWIFTLINT_PACKAGE_ARGS="--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local" >> $GITHUB_ENV + - uses: actions/checkout@v3 + with: + repository: 'realm/SwiftLint' + ref: '${{ inputs.swiftlint-version }}' + path: '${{ env.SWIFTLINT_PATH }}' + - uses: actions/cache@v3 with: - working-directory: test/Warnings + path: '${{ env.SWIFTLINT_PATH }}/.build' + key: swiftlint-${{ runner.os }}-spm-${{ inputs.swiftlint-version }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} + restore-keys: | + ${{ runner.os }}-spm-${{ inputs.swiftlint-version }}- + - name: swift build + run: swift build $SWIFTLINT_PACKAGE_ARGS + + - name: Exit Status on Errors + run: | + STATUS=$(swiftlint.sh &>/dev/null; echo $?) + [[ $STATUS == "2" ]] + working-directory: test/errors + + - name: Exit Status on No lintable files + run: | + STATUS=$(swiftlint.sh &>/dev/null; echo $?) + [[ $STATUS == "1" ]] + working-directory: test/no-lintable-files + + - name: Exit Status on Warnings + run: | + STATUS=$(swiftlint.sh &>/dev/null; echo $?) + [[ $STATUS == "0" ]] + working-directory: test/Warnings + + - name: Exit Status on Warnings with `--strict` + run: | + STATUS=$(swiftlint.sh --strict &>/dev/null; echo $?) + [[ $STATUS == "2" ]] + working-directory: test/Warnings + + - name: Output on Errors + run: | + diff <(swiftlint.sh|sort) expected.txt + [[ $STATUS == "2" ]] + working-directory: test/errors + + - name: Output on Warnings + run: | + diff <(swiftlint.sh|sort) expected.txt + [[ $STATUS == "2" ]] + working-directory: test/Warnings + + - name: Output on Warnings + run: | + diff <(swiftlint.sh|sort) expected.txt + [[ $STATUS == "2" ]] + working-directory: test/Warnings From 56ffb9cf786bd658190d0f454c78d707462abaf5 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 00:19:39 +0900 Subject: [PATCH 35/52] Adds copyright --- action.yml | 3 +++ swiftlint.sh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/action.yml b/action.yml index 22cb335..542ce73 100644 --- a/action.yml +++ b/action.yml @@ -1,3 +1,6 @@ +# Copyright (c) 2022 Jaehong Kang +# Licensed under Apache License v2.0 + name: 'GitHub Actions for SwiftLint' description: 'A tool to enforce Swift style and conventions' author: 'Jaehong Kang ' diff --git a/swiftlint.sh b/swiftlint.sh index 1b353c5..8885b6f 100755 --- a/swiftlint.sh +++ b/swiftlint.sh @@ -19,6 +19,9 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # +# Copyright (c) 2022 Jaehong Kang +# Licensed under Apache License v2.0 +# # convert swiftlint's output into GitHub Actions Logging commands # https://help.github.com/en/github/automating-your-workflow-with-github-actions/development-tools-for-github-actions#logging-commands From e618f400bff31c052c63cf6f7c1a473aaa779460 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 00:32:02 +0900 Subject: [PATCH 36/52] Minor arguments fixes --- action.yml | 4 ++-- swiftlint.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 542ce73..c5f7391 100644 --- a/action.yml +++ b/action.yml @@ -25,7 +25,7 @@ runs: export SWIFTLINT_PATH="$(realpath ${{ github.action_path }}/SwiftLint)" echo SWIFTLINT_PATH="$SWIFTLINT_PATH" >> $GITHUB_ENV - echo SWIFTLINT_PACKAGE_ARGS="--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local" >> $GITHUB_ENV + echo SWIFTLINT_PACKAGE_ARGS="--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local --disable-index-store" >> $GITHUB_ENV shell: bash - uses: actions/checkout@v3 with: @@ -39,7 +39,7 @@ runs: restore-keys: | ${{ runner.os }}-spm-${{ inputs.swiftlint-version }}- - name: swift build - run: swift build $SWIFTLINT_PACKAGE_ARGS + run: swift build $SWIFTLINT_PACKAGE_ARGS --product swiftlint shell: bash - name: swift run run: ${{ github.action_path }}/swiftlint.sh ${{ inputs.swiftlint-args }} diff --git a/swiftlint.sh b/swiftlint.sh index 8885b6f..a356881 100755 --- a/swiftlint.sh +++ b/swiftlint.sh @@ -44,4 +44,4 @@ then fi fi -set -o pipefail && swift run $SWIFTLINT_PACKAGE_ARGS swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands +set -o pipefail && swift run $SWIFTLINT_PACKAGE_ARGS --skip-build swiftlint "$@" -- $changedFiles | stripPWD | convertToGitHubActionsLoggingCommands From 3818fdcd80ee0d5531db8bd8fc0ec71ba8fcddb3 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 00:33:18 +0900 Subject: [PATCH 37/52] Update tests.yml --- .github/workflows/tests.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5f44589..180b860 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -90,42 +90,49 @@ jobs: - name: Exit Status on Errors run: | - STATUS=$(swiftlint.sh &>/dev/null; echo $?) + STATUS=$(swiftlint.sh; echo $?) [[ $STATUS == "2" ]] + shell: bash working-directory: test/errors - name: Exit Status on No lintable files run: | - STATUS=$(swiftlint.sh &>/dev/null; echo $?) + STATUS=$(swiftlint.sh; echo $?) [[ $STATUS == "1" ]] + shell: bash working-directory: test/no-lintable-files - name: Exit Status on Warnings run: | - STATUS=$(swiftlint.sh &>/dev/null; echo $?) + STATUS=$(swiftlint.sh; echo $?) [[ $STATUS == "0" ]] + shell: bash working-directory: test/Warnings - name: Exit Status on Warnings with `--strict` run: | - STATUS=$(swiftlint.sh --strict &>/dev/null; echo $?) + STATUS=$(swiftlint.sh --strict; echo $?) [[ $STATUS == "2" ]] + shell: bash working-directory: test/Warnings - name: Output on Errors run: | diff <(swiftlint.sh|sort) expected.txt [[ $STATUS == "2" ]] + shell: bash working-directory: test/errors - name: Output on Warnings run: | diff <(swiftlint.sh|sort) expected.txt [[ $STATUS == "2" ]] + shell: bash working-directory: test/Warnings - name: Output on Warnings run: | diff <(swiftlint.sh|sort) expected.txt [[ $STATUS == "2" ]] + shell: bash working-directory: test/Warnings From 0cb5be20afa266ba5ef8095d3707bbad51a47974 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 00:52:18 +0900 Subject: [PATCH 38/52] Update arguments --- .github/workflows/tests.yml | 2 +- action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 180b860..abe5aac 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -73,7 +73,7 @@ jobs: export SWIFTLINT_PATH="$(realpath ${{ github.workspace }}/SwiftLint)" echo SWIFTLINT_PATH="$SWIFTLINT_PATH" >> $GITHUB_ENV - echo SWIFTLINT_PACKAGE_ARGS="--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local" >> $GITHUB_ENV + echo SWIFTLINT_PACKAGE_ARGS="--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local --disable-index-store --use-integrated-swift-driver" >> $GITHUB_ENV - uses: actions/checkout@v3 with: repository: 'realm/SwiftLint' diff --git a/action.yml b/action.yml index c5f7391..cd2ccfd 100644 --- a/action.yml +++ b/action.yml @@ -25,7 +25,7 @@ runs: export SWIFTLINT_PATH="$(realpath ${{ github.action_path }}/SwiftLint)" echo SWIFTLINT_PATH="$SWIFTLINT_PATH" >> $GITHUB_ENV - echo SWIFTLINT_PACKAGE_ARGS="--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local --disable-index-store" >> $GITHUB_ENV + echo SWIFTLINT_PACKAGE_ARGS="--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local --disable-index-store --use-integrated-swift-driver" >> $GITHUB_ENV shell: bash - uses: actions/checkout@v3 with: From 548bd58a7459506207d0bda91c568aa6194d21b0 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 00:56:14 +0900 Subject: [PATCH 39/52] Update to use matrix --- .github/workflows/tests.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index abe5aac..4482910 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,12 +38,23 @@ on: jobs: test-actions: name: Actions Tests - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + virtual-environment: ["ubuntu-18.04", "ubuntu-20.04", "macos-11", "macos-12"] + swift-version: ["5.2.5", "5.3.3", "5.4.3", "5.5.3", "5.6.1"] + runs-on: ${{ matrix.virtual-environment }} steps: - uses: actions/checkout@master + - uses: sinoru/actions-setup-xcode@v2 + if: ${{ startsWith(matrix.operating-system, 'macos') }} + with: + xcode-version: "12.4" + apple-id: ${{ secrets.APPLE_ID }} + apple-id-password: ${{ secrets.APPLE_ID_PASSWORD }} - uses: sinoru/actions-setup-swift@main with: - swift-version: '5.6.1' + swift-version: ${{ matrix.swift-version }} - uses: ./ with: working-directory: test/Warnings From 84a86aec576b3a62172c2643b6dd386f91326fa5 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 00:59:38 +0900 Subject: [PATCH 40/52] Updates cache usage --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index cd2ccfd..1c43383 100644 --- a/action.yml +++ b/action.yml @@ -35,9 +35,9 @@ runs: - uses: actions/cache@v3 with: path: '${{ env.SWIFTLINT_PATH }}/.build' - key: swiftlint-${{ runner.os }}-spm-${{ inputs.swiftlint-version }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} + key: swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} restore-keys: | - ${{ runner.os }}-spm-${{ inputs.swiftlint-version }}- + swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}- - name: swift build run: swift build $SWIFTLINT_PACKAGE_ARGS --product swiftlint shell: bash From b6442b189256ceae2891b035daf483f9a17aeb05 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 01:01:26 +0900 Subject: [PATCH 41/52] Remove unsupported versions --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4482910..8cacdad 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -42,7 +42,7 @@ jobs: fail-fast: false matrix: virtual-environment: ["ubuntu-18.04", "ubuntu-20.04", "macos-11", "macos-12"] - swift-version: ["5.2.5", "5.3.3", "5.4.3", "5.5.3", "5.6.1"] + swift-version: ["5.5.3", "5.6.1"] runs-on: ${{ matrix.virtual-environment }} steps: - uses: actions/checkout@master From 51cb4367aaff12711783106707ff36d7882a94d0 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 01:10:00 +0900 Subject: [PATCH 42/52] Update cache --- action.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 1c43383..1ea23b9 100644 --- a/action.yml +++ b/action.yml @@ -33,15 +33,20 @@ runs: ref: '${{ inputs.swiftlint-version }}' path: '${{ env.SWIFTLINT_PATH }}' - uses: actions/cache@v3 + id: cache with: path: '${{ env.SWIFTLINT_PATH }}/.build' key: swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} restore-keys: | swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}- + swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}- + swiftlint-${{ runner.os }}-swift- - name: swift build - run: swift build $SWIFTLINT_PACKAGE_ARGS --product swiftlint + if: steps.cache.outputs.cache-hit != 'true' + run: swift package --package-path "$SWIFTLINT_PATH" reset && swift build $SWIFTLINT_PACKAGE_ARGS --product swiftlint shell: bash - name: swift run run: ${{ github.action_path }}/swiftlint.sh ${{ inputs.swiftlint-args }} shell: bash working-directory: '${{ github.workspace }}/${{ inputs.working-directory }}' + \ No newline at end of file From ae73b43fdacae47a215af7a5ec4179e6a045c22d Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 01:13:46 +0900 Subject: [PATCH 43/52] =?UTF-8?q?Uses=20=E2=80=98readlink=20-f=E2=80=99=20?= =?UTF-8?q?instead=20of=20=E2=80=98realpath=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 2 +- action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8cacdad..6675b1e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -81,7 +81,7 @@ jobs: with: swift-version: '5.6.1' - run: | - export SWIFTLINT_PATH="$(realpath ${{ github.workspace }}/SwiftLint)" + export SWIFTLINT_PATH="$(readlink -f ${{ github.workspace }}/SwiftLint)" echo SWIFTLINT_PATH="$SWIFTLINT_PATH" >> $GITHUB_ENV echo SWIFTLINT_PACKAGE_ARGS="--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local --disable-index-store --use-integrated-swift-driver" >> $GITHUB_ENV diff --git a/action.yml b/action.yml index 1ea23b9..df9b8b5 100644 --- a/action.yml +++ b/action.yml @@ -22,7 +22,7 @@ runs: using: "composite" steps: - run: | - export SWIFTLINT_PATH="$(realpath ${{ github.action_path }}/SwiftLint)" + export SWIFTLINT_PATH="$(readlink -f ${{ github.action_path }}/SwiftLint)" echo SWIFTLINT_PATH="$SWIFTLINT_PATH" >> $GITHUB_ENV echo SWIFTLINT_PACKAGE_ARGS="--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local --disable-index-store --use-integrated-swift-driver" >> $GITHUB_ENV From 5e287b1d1a4bc73297b9ba8d5daf98d506393755 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 01:15:52 +0900 Subject: [PATCH 44/52] Adds ${{ github.workspace }} --- .github/workflows/tests.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6675b1e..86be615 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -101,49 +101,49 @@ jobs: - name: Exit Status on Errors run: | - STATUS=$(swiftlint.sh; echo $?) + STATUS=$(${{ github.workspace }}/swiftlint.sh; echo $?) [[ $STATUS == "2" ]] shell: bash working-directory: test/errors - name: Exit Status on No lintable files run: | - STATUS=$(swiftlint.sh; echo $?) + STATUS=$(${{ github.workspace }}/swiftlint.sh; echo $?) [[ $STATUS == "1" ]] shell: bash working-directory: test/no-lintable-files - name: Exit Status on Warnings run: | - STATUS=$(swiftlint.sh; echo $?) + STATUS=$(${{ github.workspace }}/swiftlint.sh; echo $?) [[ $STATUS == "0" ]] shell: bash working-directory: test/Warnings - name: Exit Status on Warnings with `--strict` run: | - STATUS=$(swiftlint.sh --strict; echo $?) + STATUS=$(${{ github.workspace }}/swiftlint.sh --strict; echo $?) [[ $STATUS == "2" ]] shell: bash working-directory: test/Warnings - name: Output on Errors run: | - diff <(swiftlint.sh|sort) expected.txt + diff <(${{ github.workspace }}/swiftlint.sh|sort) expected.txt [[ $STATUS == "2" ]] shell: bash working-directory: test/errors - name: Output on Warnings run: | - diff <(swiftlint.sh|sort) expected.txt + diff <(${{ github.workspace }}/swiftlint.sh|sort) expected.txt [[ $STATUS == "2" ]] shell: bash working-directory: test/Warnings - name: Output on Warnings run: | - diff <(swiftlint.sh|sort) expected.txt + diff <(${{ github.workspace }}/swiftlint.sh|sort) expected.txt [[ $STATUS == "2" ]] shell: bash working-directory: test/Warnings From 73afd243ad803290b2b403916aaa930f967ea0f9 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 01:20:57 +0900 Subject: [PATCH 45/52] Fixes to readlink works --- .github/workflows/tests.yml | 2 +- action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 86be615..ef45fc7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -81,7 +81,7 @@ jobs: with: swift-version: '5.6.1' - run: | - export SWIFTLINT_PATH="$(readlink -f ${{ github.workspace }}/SwiftLint)" + export SWIFTLINT_PATH="$(readlink -f ${{ github.workspace }})/SwiftLint" echo SWIFTLINT_PATH="$SWIFTLINT_PATH" >> $GITHUB_ENV echo SWIFTLINT_PACKAGE_ARGS="--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local --disable-index-store --use-integrated-swift-driver" >> $GITHUB_ENV diff --git a/action.yml b/action.yml index df9b8b5..3494ba3 100644 --- a/action.yml +++ b/action.yml @@ -22,7 +22,7 @@ runs: using: "composite" steps: - run: | - export SWIFTLINT_PATH="$(readlink -f ${{ github.action_path }}/SwiftLint)" + export SWIFTLINT_PATH="$(readlink -f ${{ github.action_path }})/SwiftLint" echo SWIFTLINT_PATH="$SWIFTLINT_PATH" >> $GITHUB_ENV echo SWIFTLINT_PACKAGE_ARGS="--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local --disable-index-store --use-integrated-swift-driver" >> $GITHUB_ENV From 304672a5fe2e0ed904e70a86e1b72e1ac23ae4dc Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 01:35:46 +0900 Subject: [PATCH 46/52] =?UTF-8?q?Workarounds=20for=20macOS=2011=20which=20?= =?UTF-8?q?doesn=E2=80=99t=20have=20=E2=80=98readlink=20-f=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 2 +- action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ef45fc7..a2b6cf6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -81,7 +81,7 @@ jobs: with: swift-version: '5.6.1' - run: | - export SWIFTLINT_PATH="$(readlink -f ${{ github.workspace }})/SwiftLint" + export SWIFTLINT_PATH="$(cd ${{ github.action_path }} && pwd -L)/SwiftLint" echo SWIFTLINT_PATH="$SWIFTLINT_PATH" >> $GITHUB_ENV echo SWIFTLINT_PACKAGE_ARGS="--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local --disable-index-store --use-integrated-swift-driver" >> $GITHUB_ENV diff --git a/action.yml b/action.yml index 3494ba3..0c92eca 100644 --- a/action.yml +++ b/action.yml @@ -22,7 +22,7 @@ runs: using: "composite" steps: - run: | - export SWIFTLINT_PATH="$(readlink -f ${{ github.action_path }})/SwiftLint" + export SWIFTLINT_PATH="$(cd ${{ github.action_path }} && pwd -L)/SwiftLint" echo SWIFTLINT_PATH="$SWIFTLINT_PATH" >> $GITHUB_ENV echo SWIFTLINT_PACKAGE_ARGS="--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local --disable-index-store --use-integrated-swift-driver" >> $GITHUB_ENV From 8c1e07da8b04662f3806f787db2a2417662db492 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 01:40:38 +0900 Subject: [PATCH 47/52] Update tests.yml --- .github/workflows/tests.yml | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a2b6cf6..e2defe4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -91,38 +91,45 @@ jobs: ref: '${{ inputs.swiftlint-version }}' path: '${{ env.SWIFTLINT_PATH }}' - uses: actions/cache@v3 + id: cache with: path: '${{ env.SWIFTLINT_PATH }}/.build' - key: swiftlint-${{ runner.os }}-spm-${{ inputs.swiftlint-version }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} + key: swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} restore-keys: | - ${{ runner.os }}-spm-${{ inputs.swiftlint-version }}- + swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}- + swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}- + swiftlint-${{ runner.os }}-swift- - name: swift build run: swift build $SWIFTLINT_PACKAGE_ARGS - name: Exit Status on Errors run: | - STATUS=$(${{ github.workspace }}/swiftlint.sh; echo $?) + STATUS=$(${{ github.workspace }}/swiftlint.sh &>/dev/null; echo $?) + echo $STATUS [[ $STATUS == "2" ]] shell: bash working-directory: test/errors - name: Exit Status on No lintable files run: | - STATUS=$(${{ github.workspace }}/swiftlint.sh; echo $?) + STATUS=$(${{ github.workspace }}/swiftlint.sh &>/dev/null; echo $?) + echo $STATUS [[ $STATUS == "1" ]] shell: bash working-directory: test/no-lintable-files - name: Exit Status on Warnings run: | - STATUS=$(${{ github.workspace }}/swiftlint.sh; echo $?) + STATUS=$(${{ github.workspace }}/swiftlint.sh &>/dev/null; echo $?) + echo $STATUS [[ $STATUS == "0" ]] shell: bash working-directory: test/Warnings - name: Exit Status on Warnings with `--strict` run: | - STATUS=$(${{ github.workspace }}/swiftlint.sh --strict; echo $?) + STATUS=$(${{ github.workspace }}/swiftlint.sh --strict &>/dev/null; echo $?) + echo $STATUS [[ $STATUS == "2" ]] shell: bash working-directory: test/Warnings @@ -130,20 +137,11 @@ jobs: - name: Output on Errors run: | diff <(${{ github.workspace }}/swiftlint.sh|sort) expected.txt - [[ $STATUS == "2" ]] shell: bash working-directory: test/errors - name: Output on Warnings run: | diff <(${{ github.workspace }}/swiftlint.sh|sort) expected.txt - [[ $STATUS == "2" ]] - shell: bash - working-directory: test/Warnings - - - name: Output on Warnings - run: | - diff <(${{ github.workspace }}/swiftlint.sh|sort) expected.txt - [[ $STATUS == "2" ]] shell: bash working-directory: test/Warnings From cbaeea21e07900652ef34ed8846870a75843e171 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 01:45:56 +0900 Subject: [PATCH 48/52] Update tests.yml --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e2defe4..e140435 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -81,7 +81,7 @@ jobs: with: swift-version: '5.6.1' - run: | - export SWIFTLINT_PATH="$(cd ${{ github.action_path }} && pwd -L)/SwiftLint" + export SWIFTLINT_PATH="$(cd ${{ github.workspace }} && pwd -L)/SwiftLint" echo SWIFTLINT_PATH="$SWIFTLINT_PATH" >> $GITHUB_ENV echo SWIFTLINT_PACKAGE_ARGS="--package-path "$SWIFTLINT_PATH" -c release --manifest-cache local --disable-index-store --use-integrated-swift-driver" >> $GITHUB_ENV From 3ddfc622fd521b5744e89ab081775d81bbac5e04 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 01:52:32 +0900 Subject: [PATCH 49/52] Preventing cache key collision --- .github/workflows/tests.yml | 8 ++++---- action.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e140435..6c7da7f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -94,11 +94,11 @@ jobs: id: cache with: path: '${{ env.SWIFTLINT_PATH }}/.build' - key: swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} + key: sinoru/actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} restore-keys: | - swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}- - swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}- - swiftlint-${{ runner.os }}-swift- + sinoru/actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}- + sinoru/actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}- + sinoru/actions-swiftlint-${{ runner.os }}-swift- - name: swift build run: swift build $SWIFTLINT_PACKAGE_ARGS diff --git a/action.yml b/action.yml index 0c92eca..0e98869 100644 --- a/action.yml +++ b/action.yml @@ -36,11 +36,11 @@ runs: id: cache with: path: '${{ env.SWIFTLINT_PATH }}/.build' - key: swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} + key: sinoru/actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} restore-keys: | - swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}- - swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}- - swiftlint-${{ runner.os }}-swift- + sinoru/actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}- + sinoru/actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}- + sinoru/actions-swiftlint-${{ runner.os }}-swift- - name: swift build if: steps.cache.outputs.cache-hit != 'true' run: swift package --package-path "$SWIFTLINT_PATH" reset && swift build $SWIFTLINT_PACKAGE_ARGS --product swiftlint From 4d010ae0f2b6ca78695501d9597e1d62b42b129b Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 02:08:50 +0900 Subject: [PATCH 50/52] Update tests.yml --- .github/workflows/tests.yml | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6c7da7f..28fb18b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -58,23 +58,12 @@ jobs: - uses: ./ with: working-directory: test/Warnings - - uses: ./ - with: - swiftlint-args: --strict - working-directory: test/Warnings - continue-on-error: true - - uses: ./ - with: - working-directory: test/errors - continue-on-error: true - - uses: ./ - with: - working-directory: test/no-lintable-files - continue-on-error: true test-swiftlint: name: SwiftLint Tests runs-on: ubuntu-latest + env: + SWIFTLINT_VERSION: '0.47.1' steps: - uses: actions/checkout@master - uses: sinoru/actions-setup-swift@main @@ -88,15 +77,15 @@ jobs: - uses: actions/checkout@v3 with: repository: 'realm/SwiftLint' - ref: '${{ inputs.swiftlint-version }}' + ref: '${{ env.SWIFTLINT_VERSION }}' path: '${{ env.SWIFTLINT_PATH }}' - uses: actions/cache@v3 id: cache with: path: '${{ env.SWIFTLINT_PATH }}/.build' - key: sinoru/actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} + key: sinoru/actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ env.SWIFTLINT_VERSION }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} restore-keys: | - sinoru/actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}- + sinoru/actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ env.SWIFTLINT_VERSION }}- sinoru/actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}- sinoru/actions-swiftlint-${{ runner.os }}-swift- - name: swift build From bc09f738b9162f9c739e69c3602c46b61526e9f2 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 02:20:13 +0900 Subject: [PATCH 51/52] Update tests.yml Update README.md --- .github/workflows/tests.yml | 10 ++-------- README.md | 7 +++++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 28fb18b..09fdfef 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,7 +36,7 @@ on: - 'swiftlint.sh' jobs: - test-actions: + actions-tests: name: Actions Tests strategy: fail-fast: false @@ -46,12 +46,6 @@ jobs: runs-on: ${{ matrix.virtual-environment }} steps: - uses: actions/checkout@master - - uses: sinoru/actions-setup-xcode@v2 - if: ${{ startsWith(matrix.operating-system, 'macos') }} - with: - xcode-version: "12.4" - apple-id: ${{ secrets.APPLE_ID }} - apple-id-password: ${{ secrets.APPLE_ID_PASSWORD }} - uses: sinoru/actions-setup-swift@main with: swift-version: ${{ matrix.swift-version }} @@ -59,7 +53,7 @@ jobs: with: working-directory: test/Warnings - test-swiftlint: + swiftlint-tests: name: SwiftLint Tests runs-on: ubuntu-latest env: diff --git a/README.md b/README.md index a403a11..1921a49 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: sinoru/actions-setup-swift@v2 + with: + swift-version: '5.6.1' - name: GitHub Actions for SwiftLint uses: sinoru/actions-swiftlint@v5 - name: GitHub Actions for SwiftLint with --strict @@ -33,6 +36,6 @@ jobs: DIFF_BASE: ${{ github.base_ref }} - name: GitHub Actions for SwiftLint (Different working directory) uses: sinoru/actions-swiftlint@v5 - env: - working-directory: Source + with: + working-directory: Sources ``` From 7e2bc1db53b02f04b7801579a9a76c74938a3333 Mon Sep 17 00:00:00 2001 From: Jaehong Kang Date: Mon, 9 May 2022 02:27:14 +0900 Subject: [PATCH 52/52] Update Cache Keys --- .github/workflows/tests.yml | 8 ++++---- action.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 09fdfef..d74b8c9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -77,11 +77,11 @@ jobs: id: cache with: path: '${{ env.SWIFTLINT_PATH }}/.build' - key: sinoru/actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ env.SWIFTLINT_VERSION }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} + key: sinoru-actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ env.SWIFTLINT_VERSION }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} restore-keys: | - sinoru/actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ env.SWIFTLINT_VERSION }}- - sinoru/actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}- - sinoru/actions-swiftlint-${{ runner.os }}-swift- + sinoru-actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ env.SWIFTLINT_VERSION }}- + sinoru-actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}- + sinoru-actions-swiftlint-${{ runner.os }}-swift- - name: swift build run: swift build $SWIFTLINT_PACKAGE_ARGS diff --git a/action.yml b/action.yml index 0e98869..cc1814d 100644 --- a/action.yml +++ b/action.yml @@ -36,11 +36,11 @@ runs: id: cache with: path: '${{ env.SWIFTLINT_PATH }}/.build' - key: sinoru/actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} + key: sinoru-actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}-${{ hashFiles('${{ env.SWIFTLINT_PATH }}/Package.*') }} restore-keys: | - sinoru/actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}- - sinoru/actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}- - sinoru/actions-swiftlint-${{ runner.os }}-swift- + sinoru-actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}-${{ inputs.swiftlint-version }}- + sinoru-actions-swiftlint-${{ runner.os }}-swift-${{ env.SWIFT_VERSION }}- + sinoru-actions-swiftlint-${{ runner.os }}-swift- - name: swift build if: steps.cache.outputs.cache-hit != 'true' run: swift package --package-path "$SWIFTLINT_PATH" reset && swift build $SWIFTLINT_PACKAGE_ARGS --product swiftlint