Skip to content

Commit

Permalink
Move more build steps into Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
SimplyDanny committed Jan 22, 2025
1 parent 854d3f2 commit d04d90c
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 71 deletions.
16 changes: 16 additions & 0 deletions .azure/templates/run-make.yml
Original file line number Diff line number Diff line change
@@ -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 }}
14 changes: 6 additions & 8 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ Packages/
.DS_Store

# Bundler
.bundle/
bundle/
.bundler/

# Bazel
bazel-*
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ source 'https://rubygems.org'

gem 'cocoapods'
gem 'danger'
gem 'jazzy', '~> 0.15.1'
gem 'jazzy', '~> 0.15.3'
109 changes: 66 additions & 43 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -161,7 +184,7 @@ PLATFORMS
DEPENDENCIES
cocoapods
danger
jazzy (~> 0.15.1)
jazzy (~> 0.15.3)

BUNDLED WITH
2.4.12
23 changes: 18 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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) .
Expand All @@ -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:
Expand Down
20 changes: 8 additions & 12 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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.
Expand All @@ -65,22 +66,17 @@ 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:
vmImage: 'macOS-14'
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
Expand Down

0 comments on commit d04d90c

Please sign in to comment.