Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporarily run builds as GitHub actions #5630

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions .buildkite/pipeline.yml

This file was deleted.

118 changes: 118 additions & 0 deletions .github/workflows/macos-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: macOS Tests

on:
pull_request:

env:
XCODE_VERSION: '15.0'

defaults:
run:
shell: bash
working-directory: ./SwiftLint

jobs:
bazel:
name: Bazel Test
runs-on: macos-13
steps:
- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout SwiftLint
uses: actions/checkout@v4
with:
path: SwiftLint
- name: Build
run: bazel build :swiftlint
- name: Test
run: bazel test --test_output=errors //Tests/...

bazel-tsan:
name: Bazel TSan Test
runs-on: macos-13
steps:
- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout SwiftLint
uses: actions/checkout@v4
with:
path: SwiftLint
- name: Test
run: bazel test --test_output=errors --build_tests_only --features=tsan --test_timeout=1000 //Tests/...

bazel-strict-concurrency:
name: Bazel Build With Strict Concurrency Enabled
runs-on: macos-13
steps:
- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout SwiftLint
uses: actions/checkout@v4
with:
path: SwiftLint
- name: Add @preconcurrency attribute
run: ./tools/add-preconcurrency-imports.sh
- name: Build
run: bazel build --define strict_concurrency_builtin_rules=true :swiftlint
- name: Clean up
run: git reset --hard

danger:
name: Danger
runs-on: macos-13
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DANGER_GITHUB_BEARER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout SwiftLint
uses: actions/checkout@v4
with:
path: SwiftLint
- name: Install Bundler
run: gem install bundler
- name: Bundle Install
run: bundle install
- name: Run Danger
run: bundle exec danger --verbose

sourcery:
name: No Changes in Sourcery
runs-on: macos-13
steps:
- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout SwiftLint
uses: actions/checkout@v4
with:
path: SwiftLint
- name: Install Sourcery
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install sourcery
- name: Run Sourcery
run: make --always-make sourcery

swift-package-manager:
name: Swift Package Manager Tests
runs-on: macos-13
steps:
- name: Select Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Checkout SwiftLint
uses: actions/checkout@v4
with:
path: SwiftLint
- name: Build and Test
run: swift test --parallel -Xswiftc -DDISABLE_FOCUSED_EXAMPLES
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

#### Breaking

* None.
* The deprecated `--path` argument has now been removed completely.
[Martin Redington](https://github.com/mildm8nnered)
[#5614](https://github.com/realm/SwiftLint/issues/5614)

#### Experimental

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,9 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in
analyzer_rules: # rules run by `swiftlint analyze`
- explicit_self

included: # case-sensitive paths to include during linting. `--path` is ignored if present
# Case-sensitive paths to include during linting. Directory paths supplied on the
# command line will be ignored.
included:
- Sources
excluded: # case-sensitive paths to ignore during linting. Takes precedence over `included`
- Carthage
Expand Down
16 changes: 2 additions & 14 deletions Source/swiftlint/Commands/Analyze.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ extension SwiftLint {

@OptionGroup
var common: LintOrAnalyzeArguments
@Option(help: pathOptionDescription(for: .analyze))
var path: String?
@Flag(help: quietOptionDescription(for: .analyze))
var quiet = false
@Option(help: "The path of the full xcodebuild log to use when running AnalyzerRules.")
Expand All @@ -19,18 +17,8 @@ extension SwiftLint {
var paths = [String]()

func run() async throws {
let allPaths: [String]
if let path {
// TODO: [06/14/2024] Remove deprecation warning after ~2 years.
Issue.genericWarning(
"The --path option is deprecated. Pass the path(s) to analyze last to the swiftlint command."
).print()
allPaths = [path] + paths
} else if !paths.isEmpty {
allPaths = paths
} else {
allPaths = [""] // Analyze files in current working directory if no paths were specified.
}
// Analyze files in current working directory if no paths were specified.
let allPaths = paths.isNotEmpty ? paths : [""]
let options = LintOrAnalyzeOptions(
mode: .analyze,
paths: allPaths,
Expand Down
20 changes: 2 additions & 18 deletions Source/swiftlint/Commands/Lint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ extension SwiftLint {

@OptionGroup
var common: LintOrAnalyzeArguments
@Option(help: pathOptionDescription(for: .lint))
var path: String?
@Flag(help: "Lint standard input.")
var useSTDIN = false
@Flag(help: quietOptionDescription(for: .lint))
Expand All @@ -27,26 +25,12 @@ extension SwiftLint {
func run() async throws {
Issue.printDeprecationWarnings = !silenceDeprecationWarnings

if path != nil {
// TODO: [06/14/2024] Remove deprecation warning after ~2 years.
Issue.genericWarning(
"The --path option is deprecated. Pass the path(s) to lint last to the swiftlint command."
).print()
}

if common.fix, let leniency = common.leniency {
Issue.genericWarning("The option --\(leniency) has no effect together with --fix.").print()
}

let allPaths =
if let path {
[path] + paths
} else if !paths.isEmpty {
paths
} else {
[""] // Lint files in current working directory if no paths were specified.
}

// Lint files in current working directory if no paths were specified.
let allPaths = paths.isNotEmpty ? paths : [""]
let options = LintOrAnalyzeOptions(
mode: .lint,
paths: allPaths,
Expand Down
4 changes: 0 additions & 4 deletions Source/swiftlint/Helpers/LintOrAnalyzeArguments.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ struct LintOrAnalyzeArguments: ParsableArguments {
// It'd be great to be able to parameterize an `@OptionGroup` so we could move these options into
// `LintOrAnalyzeArguments`.

func pathOptionDescription(for mode: LintOrAnalyzeMode) -> ArgumentHelp {
ArgumentHelp(visibility: .hidden)
}

func pathsArgumentDescription(for mode: LintOrAnalyzeMode) -> ArgumentHelp {
"List of paths to the files or directories to \(mode.imperative)."
}
Expand Down