Skip to content

Commit

Permalink
Lint PRs and show inline comments for violations (#5935)
Browse files Browse the repository at this point in the history
The long-running integration tests are no longer needed (in CI). Having
violations reported right in the PR is much more convenient.
  • Loading branch information
SimplyDanny authored Jan 4, 2025
1 parent 28ce97c commit 4f55943
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Lint

on:
pull_request:
branches:
- '*'

jobs:
lint:
runs-on: ubuntu-24.04 # "Noble Numbat"
container: swift:6.0-noble
steps:
- uses: actions/checkout@v4
- name: Lint
run: swift run swiftlint --reporter github-actions-logging --strict 2> /dev/null
12 changes: 10 additions & 2 deletions Tests/IntegrationTests/IntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ private let config: Configuration = {
}()

final class IntegrationTests: SwiftLintTestCase {
func testSwiftLintLints() {
func testSwiftLintLints() throws {
try XCTSkipUnless(
ProcessInfo.processInfo.environment["CI"] == nil,
"Will be covered by separate linting job"
)
// This is as close as we're ever going to get to a self-hosting linter.
let swiftFiles = config.lintableFiles(
inPath: "",
Expand All @@ -36,7 +40,11 @@ final class IntegrationTests: SwiftLintTestCase {
}
}

func testSwiftLintAutoCorrects() {
func testSwiftLintAutoCorrects() throws {
try XCTSkipUnless(
ProcessInfo.processInfo.environment["CI"] == nil,
"Corrections are not verified in CI"
)
let swiftFiles = config.lintableFiles(
inPath: "",
forceExclude: false,
Expand Down
3 changes: 3 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
trigger:
- main

variables:
CI: 'true'

jobs:
- job: Ubuntu
pool:
Expand Down

0 comments on commit 4f55943

Please sign in to comment.