From 39646724dd3d04e1809da8df8f5403bf79dd93dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danny=20M=C3=B6sch?= Date: Tue, 19 Aug 2025 22:34:15 +0200 Subject: [PATCH] Build Linux releases with SPM and static linking Bazel does not support that yet, so the whole Swift standard library would be required to run the binary. --- .github/workflows/release.yml | 20 ++++++++------------ Makefile | 3 +++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1942c312f..a8c734872 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -94,15 +94,13 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ env.RELEASE_BRANCH }} - - uses: ./.github/actions/bazel-linux-build - name: Build SwiftLint with Bazel - env: - CI_BAZELRC_FILE_CONTENT: ${{ secrets.CI_BAZELRC_FILE_CONTENT }} - - name: Upload Bazel build artifacts + - name: Build binary + run: make --debug spm_linux_build + - name: Upload binary uses: actions/upload-artifact@v4 with: name: swiftlint_linux_amd64 - path: bazel-bin/swiftlint + path: .build/release/swiftlint build-linux-arm64: name: Build Linux ARM64 Binary @@ -114,15 +112,13 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ env.RELEASE_BRANCH }} - - uses: ./.github/actions/bazel-linux-build - name: Build SwiftLint with Bazel - env: - CI_BAZELRC_FILE_CONTENT: ${{ secrets.CI_BAZELRC_FILE_CONTENT }} - - name: Upload Bazel build artifacts + - name: Build binary + run: make --debug spm_linux_build + - name: Upload binary uses: actions/upload-artifact@v4 with: name: swiftlint_linux_arm64 - path: bazel-bin/swiftlint + path: .build/release/swiftlint build-macos: name: Build macOS Binaries diff --git a/Makefile b/Makefile index 03b4b5a0d..5d75065db 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,9 @@ test_tsan: swift build --build-tests $(TSAN_SWIFT_BUILD_FLAGS) DYLD_INSERT_LIBRARIES=$(TSAN_LIB) $(TSAN_XCTEST) $(TSAN_TEST_BUNDLE) +spm_linux_build: + swift build -c release -Xswiftc -static-stdlib --product swiftlint + spm_build_plugins: swift build -c release --product SwiftLintCommandPlugin swift build -c release --product SwiftLintBuildToolPlugin