diff --git a/.azure/templates/run-make.yml b/.azure/templates/run-make.yml new file mode 100644 index 0000000000..651568a78f --- /dev/null +++ b/.azure/templates/run-make.yml @@ -0,0 +1,16 @@ +# Run the commands in the Makefile for the specified rule. + +parameters: + - name: rule + type: string + +steps: + - script: >- + awk ' + $0 ~ "${{ parameters.rule }}:" { in_rule = 1; next } + in_rule && /^\t/ { print $0 } + in_rule && !/^\t/ { in_rule = 0 } + ' Makefile | while IFS= read -r command; do + eval "$command" + done + displayName: make ${{ parameters.rule }} diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index e3c492c64d..4b14922990 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -4,23 +4,21 @@ steps: - echo "+++ Build" - bazel build :swiftlint - echo "+++ Test" - - bazel test --test_output=errors //Tests/... + - make bazel_test - label: "SwiftPM" commands: - echo "+++ Test" - - swift test --parallel -Xswiftc -DDISABLE_FOCUSED_EXAMPLES + - make spm_test - label: "Danger" commands: - - echo "--- Install Bundler" + - echo "+++ Install Bundler" - gem install bundler -v 2.4.22 - - echo "--- Bundle Install" - - bundle install - - echo "+++ Run Danger" - - bundle exec danger --verbose + - echo "+++ Run OSS Scan" + - make oss_scan - label: "TSan Tests" commands: - echo "+++ Test" - - bazel test --test_output=errors --build_tests_only --features=tsan --test_timeout=1000 //Tests/... + - make bazel_test_tsan - label: "Sourcery" commands: - echo "+++ Run Sourcery" diff --git a/.gitignore b/.gitignore index 8e3b6a8960..05b0f8961a 100644 --- a/.gitignore +++ b/.gitignore @@ -60,8 +60,7 @@ Packages/ .DS_Store # Bundler -.bundle/ -bundle/ +.bundler/ # Bazel bazel-* diff --git a/Gemfile b/Gemfile index e19d589da9..a2aefc1272 100644 --- a/Gemfile +++ b/Gemfile @@ -2,4 +2,4 @@ source 'https://rubygems.org' gem 'cocoapods' gem 'danger' -gem 'jazzy', '~> 0.15.1' +gem 'jazzy', '~> 0.15.3' diff --git a/Gemfile.lock b/Gemfile.lock index dd8ed0f55a..0ab99fef2c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,30 +1,42 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.6) + CFPropertyList (3.0.7) + base64 + nkf rexml - activesupport (7.0.7.2) - concurrent-ruby (~> 1.0, >= 1.0.2) + activesupport (7.2.2.1) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - tzinfo (~> 2.0) - addressable (2.8.4) - public_suffix (>= 2.0.2, < 6.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) atomos (0.1.3) + base64 (0.2.0) + benchmark (0.4.0) + bigdecimal (3.1.9) claide (1.1.0) claide-plugins (0.9.2) cork nap open4 (~> 1.3) - cocoapods (1.12.1) + cocoapods (1.16.2) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.12.1) + cocoapods-core (= 1.16.2) cocoapods-deintegrate (>= 1.0.3, < 2.0) - cocoapods-downloader (>= 1.6.0, < 2.0) + cocoapods-downloader (>= 2.1, < 3.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-trunk (>= 1.6.0, < 2.0) @@ -36,8 +48,8 @@ GEM molinillo (~> 0.8.0) nap (~> 1.0) ruby-macho (>= 2.3.0, < 3.0) - xcodeproj (>= 1.21.0, < 2.0) - cocoapods-core (1.12.1) + xcodeproj (>= 1.27.0, < 2.0) + cocoapods-core (1.16.2) activesupport (>= 5.0, < 8) addressable (~> 2.8) algoliasearch (~> 1.0) @@ -48,7 +60,7 @@ GEM public_suffix (~> 4.0) typhoeus (~> 1.0) cocoapods-deintegrate (1.0.5) - cocoapods-downloader (1.6.3) + cocoapods-downloader (2.1) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.1) @@ -57,42 +69,48 @@ GEM netrc (~> 0.11) cocoapods-try (1.2.0) colored2 (3.1.2) - concurrent-ruby (1.2.2) + concurrent-ruby (1.3.5) + connection_pool (2.5.0) cork (0.3.0) colored2 (~> 3.1) - danger (9.2.0) + danger (9.5.1) + base64 (~> 0.2) claide (~> 1.0) claide-plugins (>= 0.9.2) colored2 (~> 3.1) cork (~> 0.1) faraday (>= 0.9.0, < 3.0) faraday-http-cache (~> 2.0) - git (~> 1.7) + git (~> 1.13) kramdown (~> 2.3) kramdown-parser-gfm (~> 1.0) - no_proxy_fix - octokit (~> 5.0) + octokit (>= 4.0) + pstore (~> 0.1) terminal-table (>= 1, < 4) + drb (2.2.1) escape (0.0.4) ethon (0.16.0) ffi (>= 1.15.0) - faraday (2.7.4) - faraday-net_http (>= 2.0, < 3.1) - ruby2_keywords (>= 0.0.4) - faraday-http-cache (2.4.1) + faraday (2.12.2) + faraday-net_http (>= 2.0, < 3.5) + json + logger + faraday-http-cache (2.5.1) faraday (>= 0.8) - faraday-net_http (3.0.2) - ffi (1.15.5) + faraday-net_http (3.4.0) + net-http (>= 0.5.0) + ffi (1.17.1-arm64-darwin) + ffi (1.17.1-x86_64-linux-gnu) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) - git (1.18.0) + git (1.19.1) addressable (~> 2.8) rchardet (~> 1.8) httpclient (2.8.3) - i18n (1.14.1) + i18n (1.14.7) concurrent-ruby (~> 1.0) - jazzy (0.15.1) + jazzy (0.15.3) cocoapods (~> 1.5) mustache (~> 1.1) open4 (~> 1.3) @@ -102,54 +120,59 @@ GEM sassc (~> 2.1) sqlite3 (~> 1.3) xcinvoke (~> 0.3.0) - json (2.6.3) - kramdown (2.4.0) - rexml + json (2.9.1) + kramdown (2.5.1) + rexml (>= 3.3.9) kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) liferaft (0.0.6) + logger (1.6.5) mini_portile2 (2.8.8) - minitest (5.19.0) + minitest (5.25.4) molinillo (0.8.0) mustache (1.1.1) - nanaimo (0.3.0) + nanaimo (0.4.0) nap (1.1.0) + net-http (0.6.0) + uri netrc (0.11.0) - no_proxy_fix (0.1.2) - octokit (5.6.1) + nkf (0.2.0) + octokit (9.2.0) faraday (>= 1, < 3) sawyer (~> 0.9) open4 (1.3.4) + pstore (0.1.4) public_suffix (4.0.7) - rchardet (1.8.0) + rchardet (1.9.0) redcarpet (3.6.0) - rexml (3.3.9) - rouge (4.3.0) + rexml (3.4.0) + rouge (4.5.1) ruby-macho (2.5.1) - ruby2_keywords (0.0.5) sassc (2.4.0) ffi (~> 1.9) sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) + securerandom (0.4.1) sqlite3 (1.7.3) mini_portile2 (~> 2.8.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - typhoeus (1.4.0) + typhoeus (1.4.1) ethon (>= 0.9.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.4.2) + unicode-display_width (2.6.0) + uri (1.0.2) xcinvoke (0.3.0) liferaft (~> 0.0.6) - xcodeproj (1.25.0) + xcodeproj (1.27.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) - nanaimo (~> 0.3.0) - rexml (>= 3.3.2, < 4.0) + nanaimo (~> 0.4.0) + rexml (>= 3.3.6, < 4.0) PLATFORMS arm64-darwin-21 @@ -161,7 +184,7 @@ PLATFORMS DEPENDENCIES cocoapods danger - jazzy (~> 0.15.1) + jazzy (~> 0.15.3) BUNDLED WITH 2.4.12 diff --git a/Makefile b/Makefile index f0b09ff520..2296621325 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,13 @@ test_tsan: swift build --build-tests $(TSAN_SWIFT_BUILD_FLAGS) DYLD_INSERT_LIBRARIES=$(TSAN_LIB) $(TSAN_XCTEST) $(TSAN_TEST_BUNDLE) +spm_build_plugins: + swift build -c release --product SwiftLintCommandPlugin + swift build -c release --product SwiftLintBuildToolPlugin + +spm_test: + swift test --parallel -Xswiftc -DDISABLE_FOCUSED_EXAMPLES + write_xcodebuild_log: xcodebuild -scheme swiftlint clean build-for-testing -destination "platform=macOS" > xcodebuild.log @@ -147,6 +154,9 @@ package: $(SWIFTLINT_EXECUTABLE) bazel_test: bazel test --test_output=errors //Tests/... +bazel_test_tsan: + bazel test --test_output=errors --build_tests_only --features=tsan --test_timeout=1000 //Tests/... + bazel_release: $(SWIFTLINT_EXECUTABLE) bazel build :release mv -f bazel-bin/bazel.tar.gz bazel-bin/bazel.tar.gz.sha256 $(SWIFTLINT_EXECUTABLE) . @@ -167,17 +177,20 @@ display_compilation_time: formula_bump: brew update && brew bump-formula-pr --tag=$(shell git describe --tags) --revision=$(shell git rev-parse HEAD) swiftlint -pod_publish: +bundle_install: bundle install + +oss_scan: bundle_install + bundle exec danger --verbose + +pod_publish: bundle_install bundle exec pod trunk push SwiftLint.podspec -pod_lint: - bundle install +pod_lint: bundle_install bundle exec pod lib lint --verbose SwiftLint.podspec -docs: +docs: bundle_install swift run swiftlint generate-docs - bundle install bundle exec jazzy get_version: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f9bfe1dc97..81af9d715e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -11,8 +11,9 @@ jobs: vmImage: 'ubuntu-24.04' # "Noble Numbat" container: swift:6.0-noble steps: - - script: swift test --parallel -Xswiftc -DDISABLE_FOCUSED_EXAMPLES - displayName: Run tests + - template: .azure/templates/run-make.yml + parameters: + rule: spm_test - job: bazel_linux displayName: 'Bazel, Linux : Swift 6' @@ -47,7 +48,7 @@ jobs: variables: DEVELOPER_DIR: /Applications/Xcode_$(xcode).app steps: - - script: swift test --parallel -Xswiftc -DDISABLE_FOCUSED_EXAMPLES + - script: make spm_test displayName: Run tests - job: plugins_linux # Plugins shall be able to run on older Swift versions. @@ -65,10 +66,9 @@ jobs: image: swift:6.0-noble container: $[ variables['image'] ] steps: - - script: swift build -c release --product SwiftLintCommandPlugin - displayName: Build command plugin - - script: swift build -c release --product SwiftLintBuildToolPlugin - displayName: Build build tool plugin + - template: .azure/templates/run-make.yml + parameters: + rule: spm_build_plugins - job: Jazzy pool: @@ -76,11 +76,7 @@ jobs: variables: DEVELOPER_DIR: /Applications/Xcode_15.4.app steps: - - script: swift run swiftlint generate-docs - displayName: Generate documentation - - script: bundle install --path vendor/bundle - displayName: Install dependencies - - script: bundle exec jazzy + - script: make docs displayName: Run Jazzy - script: > if ruby -rjson -e "j = JSON.parse(File.read('docs/undocumented.json')); exit j['warnings'].length != 0"; then