66 package_name :
77 description : " Package name to build"
88 type : string
9- needs :
10- description : " Parent workflow job dependencies"
11- type : string
12- dependencies :
13- description : " Install additional dependencies"
14- type : string
15- default : " "
169 packages_repository :
1710 description : " MSYS2 packages repository to build from"
1811 type : string
2114 description : " MSYS2 packages branch to build from"
2215 type : string
2316 default : " woarm64"
17+ runner_arch :
18+ description : " Architecture to build on"
19+ type : string
20+ default : " x86_64"
21+ needs :
22+ description : " Parent workflow job dependencies"
23+ type : string
24+ dependencies :
25+ description : " Install additional dependencies"
26+ type : string
27+ default : " "
2428
2529defaults :
2630 run :
2731 shell : msys2 {0}
2832
2933env :
3034 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
35+ CROSS_BUILD : ${{ inputs.runner_arch == 'aarch64' && '1' || '0' }}
36+ CLEAN_BUILD : 1
3137
3238jobs :
3339 build :
3440 name : Build ${{ inputs.package_name }}
35- runs-on : windows-latest
41+ runs-on : >-
42+ ${{ fromJson(inputs.runner_arch == 'aarch64'
43+ && '["Windows", "ARM64", "MSYS2"]'
44+ || '["windows-latest"]') }}
3645
3746 steps :
38- - uses : msys2/setup-msys2@v2
47+ - name : Kill hanging processes
48+ if : ${{ inputs.runner_arch == 'aarch64' }}
49+ shell : powershell
50+ run : |
51+ tasklist
52+ taskkill /F /FI 'MODULES eq msys-2.0.dll'
53+ tasklist
54+ Set-Location "${{ github.workspace }}"
55+ Remove-Item -Recurse -Force -ErrorAction SilentlyContinue -Path packages
56+ exit 0
57+
58+ - name : Fix Git long paths
59+ if : ${{ inputs.runner_arch == 'aarch64' }}
60+ shell : powershell
61+ run : |
62+ git config --global core.longpaths true
63+
64+ - name : Fix $PATH
65+ if : ${{ inputs.runner_arch == 'aarch64' }}
66+ shell : powershell
67+ run : |
68+ Write-Output "GITHUB_PATH: $env:GITHUB_PATH"
69+ Write-Output "C:\Program Files\Git\usr\bin\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
70+
71+ - uses : Windows-on-ARM-Experiments/setup-msys2@main
72+ timeout-minutes : 10
3973 with :
40- msystem : ${{ contains(inputs.packages_repository, 'MINGW') && 'MINGW64' || 'MSYS' }}
74+ msystem : >-
75+ ${{ contains(inputs.packages_repository, 'MINGW')
76+ && ((inputs.runner_arch == 'aarch64') && 'MINGWARM64' || 'MINGW64')
77+ || 'MSYS' }}
4178 update : true
4279 cache : true
4380
4481 - name : Checkout repository
4582 uses : actions/checkout@v4
4683
47- - name : Install dependencies
84+ - name : Checkout ${{ inputs.packages_repository }} repository
85+ uses : actions/checkout@v4
86+ with :
87+ repository : ${{ inputs.packages_repository }}
88+ ref : ${{ inputs.packages_branch }}
89+ sparse-checkout : ${{ inputs.package_name }}
90+ path : ${{ github.workspace }}/packages
91+
92+ - name : Setup packages repository
93+ if : ${{ inputs.runner_arch == 'aarch64' }}
4894 run : |
95+ `cygpath "${{ github.workspace }}"`/.github/scripts/setup-repository.sh
96+
97+ - name : Install dependencies
98+ run : >-
4999 pacman -S --noconfirm \
50100 git \
51101 mingw-w64-x86_64-github-cli \
52102 mingw-w64-x86_64-jq \
53103 base-devel \
54- ${{ contains(inputs.packages_repository, 'MINGW') && 'mingw-w64-cross-gcc mingw-w64-x86_64-ccache' || ' ccache' }} \
104+ ${{ contains(inputs.packages_repository, 'MINGW')
105+ && 'mingw-w64-cross-mingwarm64-gcc mingw-w64-cross-mingwarm64-windows-default-manifest mingw-w64-x86_64-gcc-libs'
106+ || '' }} \
55107 ${{ inputs.dependencies }}
56108
57109 - name : Download artifacts
@@ -69,25 +121,22 @@ jobs:
69121 run : |
70122 `cygpath "${{ github.workspace }}"`/.github/scripts/pthread-headers-hack-before.sh
71123
72- - name : Checkout ${{ inputs.packages_repository }} repository
73- uses : actions/checkout@v4
74- with :
75- repository : ${{ inputs.packages_repository }}
76- ref : ${{ inputs.packages_branch }}
77- sparse-checkout : ${{ inputs.package_name }}
78- path : ${{ github.workspace }}/packages
124+ - name : Setup MINGWARM64 environment
125+ if : ${{ inputs.runner_arch == 'aarch64' }}
126+ run : |
127+ `cygpath "${{ github.workspace }}"`/.github/scripts/setup-mingwarm64.sh
79128
80129 - name : Enable Ccache
81130 id : enable-ccache
82131 run : |
83132 `cygpath "${{ github.workspace }}"`/.github/scripts/enable-ccache.sh
84133
85134 - name : Restore Ccache
86- uses : actions/cache/restore@v4
135+ uses : actions/cache/restore@v4
87136 with :
88137 path : ${{ github.workspace }}/ccache
89- key : main -ccache-${{ steps.enable-ccache.outputs.timestamp }}
90- restore-keys : main-ccache -
138+ key : ${{ inputs.package_name }} -ccache-${{ steps.enable-ccache.outputs.timestamp }}
139+ restore-keys : ${{ inputs.package_name }} -
91140
92141 - name : Build ${{ inputs.package_name }}
93142 working-directory : ${{ github.workspace }}/packages/${{ inputs.package_name }}
@@ -98,10 +147,10 @@ jobs:
98147
99148 - name : Save Ccache
100149 if : always()
101- uses : actions/cache/save@v4
150+ uses : actions/cache/save@v4
102151 with :
103152 path : ${{ github.workspace }}/ccache
104- key : main -ccache-${{ steps.enable-ccache.outputs.timestamp }}
153+ key : ${{ inputs.package_name }} -ccache-${{ steps.enable-ccache.outputs.timestamp }}
105154
106155 - name : Upload ${{ inputs.package_name }}
107156 uses : actions/upload-artifact@v4
0 commit comments