Skip to content

Windows: released .exe statically links Swift stdlib - #2265

Merged
nicklockwood merged 6 commits into
nicklockwood:developfrom
roman-bcny:roman-static-linking
Nov 6, 2025
Merged

nicklockwood merged 6 commits into
nicklockwood:developfrom
roman-bcny:roman-static-linking

Conversation

@roman-bcny

@roman-bcny roman-bcny commented Nov 5, 2025 •

Copy link
Copy Markdown
Contributor

Static linking is now supported by the toolchain (to be released in 6.3) which resolves #1775 and avoids issues with loading the wrong Swift.dll.

The resulting .exe in my tests is roughly 50MB and I verified on our (BCNY) codebase that we obtained 0 changed files when testing on the same version as what we use on Mac (0.56.1). I also tested the latest main and saw differences in formatting (as expected from the release notes) so it all seems to work nicely.

As the 6.3 toolchain is not released yet, this relies on the development snapshot @compnerd used in https://github.com/compnerd/vigil/blob/e8e5ca1f0e04f241b8ba625fc7d2a2aacfaba5b6/.github/workflows/release.yml#L31

This change also updates the windows part of build.yml to use the same snapshot, re-enables aarch64 as it's now working, and removes the bundling of the toolchain from the installer as now a statically linked exe is being produced.

@roman-bcny

Copy link
Copy Markdown
Contributor Author

@nicklockwood lmk if this would be acceptable!

Comment thread .github/workflows/build.yml Resolved
Comment thread .github/workflows/windows_release.yml Resolved
Comment thread .github/workflows/build.yml Resolved
Comment thread .github/workflows/windows_release.yml Resolved
@codecov

codecov Bot commented Nov 6, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.10%. Comparing base (b157a79) to head (80bf027).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2265   +/-   ##
========================================
  Coverage    95.10%   95.10%           
========================================
  Files          158      158           
  Lines        23698    23698           
========================================
+ Hits         22538    22539    +1     
+ Misses        1160     1159    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nicklockwood
nicklockwood merged commit 1247771 into nicklockwood:develop Nov 6, 2025
@nicklockwood

Copy link
Copy Markdown
Owner

@roman-bcny thanks!

@roman-bcny

Copy link
Copy Markdown
Contributor Author

Thank you @nicklockwood! When could we get a statically linked release? Looking forward to getting started on the integration into our workflows!

@nicklockwood

Copy link
Copy Markdown
Owner

@roman-bcny I'll include it with the next point release (unless you need it more urgently?)

@roman-bcny

Copy link
Copy Markdown
Contributor Author

@nicklockwood not really urgent, just not sure what to expect - extrapolating from the release history might be a few weeks?

@nicklockwood

Copy link
Copy Markdown
Owner

@roman-bcny there's no fixed release schedule, but yes that sounds about right

@nicklockwood

nicklockwood commented Nov 11, 2025 •

Copy link
Copy Markdown
Owner

@roman-bcny the 0.58.6 release uses your statically linked builds. For some reason the upload script is broken, but I uploaded the MSIs manually for now

@roman-bcny

Copy link
Copy Markdown
Contributor Author

Woohoo thanks @nicklockwood! lmk if the breakage is likely due to some of my changes and I'll have a look

@nicklockwood

Copy link
Copy Markdown
Owner

@roman-bcny

Copy link
Copy Markdown
Contributor Author

That looks odd and probably not related to the change, except for a possible side effect of uploading 2 binaries instead of only the amd64 one.

I see it's using skx/github-action-publish-binaries which has not had updates in a long time.
I have no experience with any of this but a quick search suggests that softprops/action-gh-release is a suggested replacement and I see that it has recent commits. You should probably migrate to that?

Here's a quick diff made by cursor, untested and might be broken or missing context on how your release process works:

      - name: Display structure of uploadable files
        run: ls -R .
-     - name: Get Release ID
-       id: get-release-id
-       run: |
-         if [ -n "${{ github.event.release.id }}" ]; then
-           echo "release-id=${{ github.event.release.id }}" >> $GITHUB_OUTPUT
-         else
-           TAG="${{ inputs.tag }}"
-           RELEASE_ID=$(gh api repos/${{ github.repository }}/releases/tags/$TAG --jq '.id')
-           echo "release-id=$RELEASE_ID" >> $GITHUB_OUTPUT
-         fi
-       env:
-         GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      - name: Upload release assets
-       uses: skx/github-action-publish-binaries@master
+       uses: softprops/action-gh-release@v2
        env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
-         releaseId: ${{ steps.get-release-id.outputs.release-id }}
-         args: 'SwiftFormat.*.msi'
+         tag: ${{ github.event.release.tag_name || inputs.tag }}
+         files: |
+           SwiftFormat.*.msi

@nicklockwood

Copy link
Copy Markdown
Owner

@roman-bcny tag should be tag_name apparently, but after that fix it seems to have worked - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants