diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 74e3a18..8e1a9c2 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -6,19 +6,20 @@ on: package_path: type: string required: false - default: '' + default: './' description: "Specifies a subpath of the checkout that the package is contained in." jobs: format: name: Format linting runs-on: ubuntu-latest + container: swift:latest steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Pull formatting docker image - run: docker pull ghcr.io/nicklockwood/swiftformat:latest - - name: Run format linting - run: docker run --rm -v ${{ github.workspace }}:/repo ghcr.io/nicklockwood/swiftformat:latest /repo/${{ inputs.package_path }} --lint + - name: Checkout + uses: actions/checkout@v4 + - name: Format + run: | + swift format lint \ + --parallel \ + --recursive \ + ${{ inputs.package_path != './' && inputs.package_path || './' }} diff --git a/WorkflowTestPackage/.swift-format b/WorkflowTestPackage/.swift-format new file mode 100644 index 0000000..1ffdbf5 --- /dev/null +++ b/WorkflowTestPackage/.swift-format @@ -0,0 +1,7 @@ +{ + "version": 1, + "indentation" : { + "spaces" : 4 + }, + "lineBreakBeforeEachArgument": true +} diff --git a/WorkflowTestPackage/Package.swift b/WorkflowTestPackage/Package.swift index 15aa85e..669dbf5 100644 --- a/WorkflowTestPackage/Package.swift +++ b/WorkflowTestPackage/Package.swift @@ -8,7 +8,7 @@ let package = Package( .library( name: "WorkflowTestPackage", targets: ["WorkflowTestPackage"] - ), + ) ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. diff --git a/WorkflowTestPackage/Tests/WorkflowTestPackageTests/WorkflowTestPackageTests.swift b/WorkflowTestPackage/Tests/WorkflowTestPackageTests/WorkflowTestPackageTests.swift index 3440d51..7486c8d 100644 --- a/WorkflowTestPackage/Tests/WorkflowTestPackageTests/WorkflowTestPackageTests.swift +++ b/WorkflowTestPackage/Tests/WorkflowTestPackageTests/WorkflowTestPackageTests.swift @@ -1,6 +1,7 @@ -@testable import WorkflowTestPackage import XCTest +@testable import WorkflowTestPackage + class WorkflowTestPackageTests: XCTestCase { func testHello() { XCTAssertEqual(WorkflowTest().hello(), "world")