Skip to content

Commit

Permalink
Merge branch 'release/6.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sinoru committed May 8, 2022
2 parents 94c7c77 + 7e2bc1d commit 9533e58
Show file tree
Hide file tree
Showing 9 changed files with 186 additions and 165 deletions.
2 changes: 0 additions & 2 deletions .dockerfilelintrc

This file was deleted.

1 change: 0 additions & 1 deletion .dockerignore

This file was deleted.

87 changes: 0 additions & 87 deletions .github/workflows/docker-build.yml

This file was deleted.

46 changes: 0 additions & 46 deletions .github/workflows/docker-lint.yml

This file was deleted.

130 changes: 130 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# 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:
push:
paths:
- '.github/workflows/tests.yml'
- 'action.yml'
- 'swiftlint.sh'
pull_request:
paths:
- '.github/workflows/tests.yml'
- 'action.yml'
- 'swiftlint.sh'

jobs:
actions-tests:
name: Actions Tests
strategy:
fail-fast: false
matrix:
virtual-environment: ["ubuntu-18.04", "ubuntu-20.04", "macos-11", "macos-12"]
swift-version: ["5.5.3", "5.6.1"]
runs-on: ${{ matrix.virtual-environment }}
steps:
- uses: actions/checkout@master
- uses: sinoru/actions-setup-swift@main
with:
swift-version: ${{ matrix.swift-version }}
- uses: ./
with:
working-directory: test/Warnings

swiftlint-tests:
name: SwiftLint Tests
runs-on: ubuntu-latest
env:
SWIFTLINT_VERSION: '0.47.1'
steps:
- uses: actions/checkout@master
- uses: sinoru/actions-setup-swift@main
with:
swift-version: '5.6.1'
- run: |
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
- uses: actions/checkout@v3
with:
repository: 'realm/SwiftLint'
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 }}-${{ 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-
- name: swift build
run: swift build $SWIFTLINT_PACKAGE_ARGS

- name: Exit Status on Errors
run: |
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 &>/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 &>/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 &>/dev/null; echo $?)
echo $STATUS
[[ $STATUS == "2" ]]
shell: bash
working-directory: test/Warnings

- name: Output on Errors
run: |
diff <(${{ github.workspace }}/swiftlint.sh|sort) expected.txt
shell: bash
working-directory: test/errors

- name: Output on Warnings
run: |
diff <(${{ github.workspace }}/swiftlint.sh|sort) expected.txt
shell: bash
working-directory: test/Warnings
13 changes: 0 additions & 13 deletions Dockerfile

This file was deleted.

9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,21 @@ 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
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:
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
```
49 changes: 46 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,52 @@
# 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 <[email protected]>'
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'
swiftlint-args:
description: "Arguments to SwiftLint."
required: false
working-directory:
required: true
default: ''
runs:
using: "composite"
steps:
- run: |
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
shell: bash
- uses: actions/checkout@v3
with:
repository: 'realm/SwiftLint'
ref: '${{ inputs.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.*') }}
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-
- 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
shell: bash
- name: swift run
run: ${{ github.action_path }}/swiftlint.sh ${{ inputs.swiftlint-args }}
shell: bash
working-directory: '${{ github.workspace }}/${{ inputs.working-directory }}'

Loading

0 comments on commit 9533e58

Please sign in to comment.