Skip to content

Commit 680dc0c

Browse files
authored
Add windows arm support (#841)
* Add windows arm support * Add arm support for setup * Fix zipping and continue on snap error
2 parents 3e7ec1b + 33970bc commit 680dc0c

2 files changed

Lines changed: 48 additions & 15 deletions

File tree

.github/workflows/build.yml

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,17 @@ jobs:
137137
name: apk-x86_64-build-legacy
138138
path: app/linwood-butterfly-android-x86_64-legacy.apk
139139
build-windows:
140-
runs-on: windows-2025
140+
strategy:
141+
fail-fast: false
142+
matrix:
143+
arch:
144+
- image: windows-2025
145+
name: x86_64
146+
dir: x64
147+
- image: windows-11-arm
148+
name: arm64
149+
dir: arm64
150+
runs-on: ${{ matrix.arch.image }}
141151
defaults:
142152
run:
143153
working-directory: app
@@ -155,7 +165,10 @@ jobs:
155165
- uses: subosito/flutter-action@v2.23.0
156166
with:
157167
flutter-version-file: app/pubspec.yaml
168+
channel: "master"
158169
cache: true
170+
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
171+
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:"
159172
- name: ✅ Enable platforms
160173
run: flutter config --enable-windows-desktop
161174
- name: 📦 Get dependencies
@@ -175,24 +188,23 @@ jobs:
175188
shell: pwsh
176189
run: |
177190
Get-Content pubspec.yaml | Select-String -Pattern 'version:\s(.+)\+' | % {Set-Item -Path Env:BUTTERFLY_VERSION -Value "$($_.matches.groups[1])"}
178-
& 'C:/Program Files (x86)/Inno Setup 6/ISCC.exe' /DMyAppVersion=$Env:BUTTERFLY_VERSION ButterflySetup.iss
179-
# flutter pub run msix:create
191+
& 'C:/Program Files (x86)/Inno Setup 6/ISCC.exe' /DMyAppVersion=$Env:BUTTERFLY_VERSION /DMyAppArch=${{ matrix.arch.dir }} ButterflySetup.iss
180192
- name: Copy portable start script
181193
run: |
182-
cp scripts/start.bat build/windows/x64/runner/Release/
183-
cp build/windows/x64/linwood-butterfly-windows-setup.exe linwood-butterfly-windows-setup-x86_64.exe
194+
cp scripts/start.bat build/windows/${{ matrix.arch.dir }}/runner/Release/
195+
cp build/windows/${{ matrix.arch.dir }}/linwood-butterfly-windows-setup.exe linwood-butterfly-windows-setup-${{ matrix.arch.name }}.exe
184196
- name: Archive
185197
uses: actions/upload-artifact@v7
186198
with:
187-
name: windows-build
199+
name: windows-${{ matrix.arch.name }}-build
188200
path: |
189-
app/build/windows/x64/runner/Release/**
201+
app/build/windows/${{ matrix.arch.dir }}/runner/Release/**
190202
- name: Archive
191203
uses: actions/upload-artifact@v7
192204
with:
193-
name: windows-setup
205+
name: windows-${{ matrix.arch.name }}-setup
194206
path: |
195-
app/linwood-butterfly-windows-setup-x86_64.exe
207+
app/linwood-butterfly-windows-setup-${{ matrix.arch.name }}.exe
196208
build-msix:
197209
name: build-msix
198210
runs-on: windows-2025
@@ -402,6 +414,7 @@ jobs:
402414
- uses: snapcore/action-build@v1
403415
id: build
404416
- uses: snapcore/action-publish@v1
417+
continue-on-error: true
405418
name: Publish Snap to Store
406419
if: ${{ github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' || github.ref == 'refs/tags/nightly' || github.ref == 'refs/tags/stable' }}
407420
env:
@@ -603,8 +616,12 @@ jobs:
603616
name: apk-x86_64-build-legacy
604617
- uses: actions/download-artifact@v8
605618
with:
606-
name: windows-build
607-
path: windows-build/
619+
name: windows-arm64-build
620+
path: windows-arm64-build/
621+
- uses: actions/download-artifact@v8
622+
with:
623+
name: windows-x86_64-build
624+
path: windows-x86_64-build/
608625
- uses: actions/download-artifact@v8
609626
with:
610627
name: linux-x86_64-build
@@ -659,7 +676,10 @@ jobs:
659676
name: linux-alternative-arm64-appimage
660677
- uses: actions/download-artifact@v8
661678
with:
662-
name: windows-setup
679+
name: windows-x86_64-setup
680+
- uses: actions/download-artifact@v8
681+
with:
682+
name: windows-arm64-setup
663683
- uses: actions/download-artifact@v8
664684
with:
665685
name: macos-build
@@ -671,8 +691,10 @@ jobs:
671691
name: ipa-build
672692
- name: 📦 Zip artifacts
673693
run: |
674-
cd windows-build
694+
cd windows-x86_64-build
675695
zip -r ../linwood-butterfly-windows-x86_64.zip *
696+
cd ../windows-arm64-build
697+
zip -r ../linwood-butterfly-windows-arm64.zip *
676698
cd ..
677699
tar -C linux-x86_64-build -czf linwood-butterfly-linux-x86_64.tar.gz .
678700
tar -C linux-arm64-build -czf linwood-butterfly-linux-arm64.tar.gz .
@@ -712,6 +734,8 @@ jobs:
712734
files: |
713735
linwood-butterfly-windows-setup-x86_64.exe
714736
linwood-butterfly-windows-x86_64.zip
737+
linwood-butterfly-windows-setup-arm64.exe
738+
linwood-butterfly-windows-arm64.zip
715739
linwood-butterfly-linux-x86_64.tar.gz
716740
linwood-butterfly-linux-x86_64.deb
717741
linwood-butterfly-linux-x86_64.rpm
@@ -756,6 +780,8 @@ jobs:
756780
files: |
757781
linwood-butterfly-windows-setup-x86_64.exe
758782
linwood-butterfly-windows-x86_64.zip
783+
linwood-butterfly-windows-setup-arm64.exe
784+
linwood-butterfly-windows-arm64.zip
759785
linwood-butterfly-linux-x86_64.tar.gz
760786
linwood-butterfly-linux-x86_64.deb
761787
linwood-butterfly-linux-x86_64.rpm
@@ -798,6 +824,8 @@ jobs:
798824
files: |
799825
linwood-butterfly-windows-setup-x86_64.exe
800826
linwood-butterfly-windows-x86_64.zip
827+
linwood-butterfly-windows-setup-arm64.exe
828+
linwood-butterfly-windows-arm64.zip
801829
linwood-butterfly-linux-x86_64.tar.gz
802830
linwood-butterfly-linux-x86_64.deb
803831
linwood-butterfly-linux-x86_64.rpm

app/ButterflySetup.iss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
#ifndef MyAppVersion
66
#define MyAppVersion "1.0"
77
#endif
8+
#ifndef MyAppArch
9+
#define MyAppArch "x64"
10+
#endif
811
#define MyAppPublisher "Linwood"
912
#define MyAppURL "https://www.linwood.dev"
1013
#define MyAppExeName "butterfly.exe"
11-
#define BaseDirRelease "build\windows\x64\runner\Release"
14+
#define BaseDirRelease "build\windows\" + MyAppArch + "\runner\Release"
1215
#define RunnerSourceDir "windows\runner"
1316

1417

@@ -30,12 +33,14 @@ LicenseFile=..\LICENSE
3033
; Uncomment the following line to run in non administrative install mode (install for current user only.)
3134
PrivilegesRequired=lowest
3235
PrivilegesRequiredOverridesAllowed=dialog
33-
OutputDir=build\windows\x64
36+
OutputDir=build\windows\{#MyAppArch}
3437
OutputBaseFilename=linwood-butterfly-windows-setup
3538
SetupIconFile={#RunnerSourceDir}\resources\app_icon.ico
3639
UninstallDisplayIcon={app}\{#MyAppExeName}
3740
Compression=lzma
3841
SolidCompression=yes
42+
ArchitecturesAllowed={#MyAppArch}
43+
ArchitecturesInstallIn64BitMode={#MyAppArch}
3944
WizardStyle=modern
4045
Uninstallable=not WizardIsTaskSelected('portablemode')
4146
ChangesAssociations=yes

0 commit comments

Comments
 (0)