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 9fc6569
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 27 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: Run `${{ parameters.rule }}` 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
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 9fc6569

Please sign in to comment.